early_vision_toolbox.tuning¶
functions for measuring tuning of model neurons as in real experiments
-
class
early_vision_toolbox.tuning.LinearSquareNeuronBank(w)[source]¶ Bases:
early_vision_toolbox.interface.NeuronBankNeuronBank with linear response computing methods and square RF size
Attributes
n_neuronnumber of neurons rf_sizesize of RF Methods
predict(imgs[, neuron_idx])get neuron response to images -
n_neuron¶ number of neurons
-
rf_size¶ size of RF
-
-
early_vision_toolbox.tuning.find_optimal_paras_rf(w, freqvalues=None, orvalues=None, phasevalues=None, legacy=False)[source]¶ Parameters: w : numpy.ndarray or a NeuronBank object
if a 2d array, then each row representing a flattened filter, in row major order. and response will be evaluated in a linear fasion. Otherwise, it must be a NeuronBank object.
freqvalues, orvalues, phasevalues : array_like or None, optional
(implicitly flattened) 1d array of frequency, orientation, and phase values to test. By default, they have values as used in the demo program (
figures.m) of the original code (see Notes):%set number of different values for the grating parameters used in %computing tuning curves and optimal parameters freqno=50; %how many frequencies orno=50; %how many orientations phaseno=20; %how many phases %compute the used values for the orientation angles and frequencies orvalues=[0:orno-1]/orno*pi; freqvalues=[0:freqno-1]/freqno*patchsize/2; phasevalues=[0:phaseno-1]/phaseno*2*pi;
legacy: bool, optional
whether returning exactly the same optx and opty as in the original implementation (which I believe is problematic). Default
Falsealso, this will use the original implementation for computing grating.Returns: a numpy structured array with 5 columns, each row for a filter. It has the following
dtype.[('optx', np.float64), # gravity center of x (column) ('opty', np.float64), # gravity center of y (ro) ('optfreq', np.float64), # optimal frequency ('optor', np.float64), # optimal orientation. ('optphase', np.float64)] # optimal phase
Notes
The linear part of this function is basically a port of
findoptimalparas.mfrom code for [R1].References
[R1] (1, 2) Hyvärinen, A., Hurri, J., & Hoyer, P. O. (2009). Natural Image Statistics: A Probabilistic Approach to Early Computational Vision. (1st ed., Vol. 39). Springer Publishing Company, Incorporated. Retrieved from http://www.naturalimagestatistics.net/ http://dx.doi.org/10.1007/978-1-84882-491-1
-
early_vision_toolbox.tuning.freq_tuning_curve(w, freqvalues_test=None, **kwargs)[source]¶ find the frequency tuning of a bunch of neurons.
Parameters: w
freqvalues_test : array_like
kwargs
Returns: a 2d numpy ndarray, each row being the response of neuron to freqvalues_probe