vrf_gabor

class vtem.vrf.vrf_gabor(shape, dtype=<type 'numpy.float64'>, dx=0.0625, dy=0.0625, scale=1, domain=None)

Gabor RFs

Methods

compute_Ds(Mx, My) Returns the dirichlet coefficients of all gabor filters with order Mx, My
compute_Dsw(d_Ds, Mx, My, h_norm) Compute the weighting matrix of the “correlation” between each two RFs
compute_dirich_space(d_Ds, Mx, My, Px, Py, ...) Compute the spatial reconstruction functions
compute_dirich_space_fft(d_Ds, Mx, My, Px, ...)
filter(V) Filter a video V
generate_visual_receptive_fields([...]) Generate a batch of gabor filters from parameters set in self
get_gabor_parameters([dilations, ...]) Create a set of parameters for a family of gabor filters
load_parameters([num_neurons, h_alpha, h_l, ...]) Load gabor parameters to GPU
__init__(shape, dtype=<type 'numpy.float64'>, dx=0.0625, dy=0.0625, scale=1, domain=None)
Parameters:

shape : list

2-tuple indicating the shape (number of pixels in (height,width) / (y,x) ) of RF

dtype : type, optional

numpy dtype to use for RF calculations. If not specified , will default to np.float64

dx : float

spatial resolution in x direction, distance between two pixels

dy: float

spatial resolution in y direction, distance between two pixels

scale : float

scale up the shape by scale and scale down dx,dy by scale effectively increase the resoltuion of the RFs

domain : list

list of 2, [a,b], specifying the domain to cover RFs in default parameter settings a in x direction, b in y direction

Notes

The coordinate system is given by the following:

row (width / X) major

-----------------------------------------> width
|   Y
|   ^-------------------->
|   |-------------------->
|   |-------------------->
|   |--------------------> X
| 
|
v
height
compute_Ds(Mx, My)

Returns the dirichlet coefficients of all gabor filters with order Mx, My in the format of PitchArray with shape (num_neurons, 2*Mx+1, 2*My+1)

compute_Dsw(d_Ds, Mx, My, h_norm)

Compute the weighting matrix of the “correlation” between each two RFs

Parameters:

d_Ds : PitchArray

containing dirichlet coefficient most possibly created by compute_Ds

Mx : integer

order in the x dimension

My : integer

order in the y dimension

Returns:

PitchArray with shape (num_neurons, num_neurons)

compute_dirich_space(d_Ds, Mx, My, Px, Py, Sx, Sy, Wx, Wy, x_start=None, y_start=None)

Compute the spatial reconstruction functions

Parameters:

d_Ds : PitchArray

containing dirichlet coefficient most possibly created by compute_Ds

Mx : integer

Order in the x dimension

My : integer

Order in the y dimension

Px : integer

number of pixels in reconstruction functions in the x dimension

Py : integer

number of pixels in reconstruction functions in the y dimension

Sx : float

spatial domain in degree of reconstruction functions in x direction

Sy : float

spatial domain in degree of reconstruction functions in y direction

Wx : float

spatial bandwidth in x direction

Wy : float

spatial bandwidth in y direction

x_start : float

indicating the starting degree in x direction

y_start : float

indicating the starting degree in y direction

output: PitchArray with shape (num_neurons, Px, Py)

filter(V)

Filter a video V Must set up parameters of gabor first

Parameters:

V : 3D ndarray, with shape (num_frames, Px, Py)

Returns:

The filtered output by the gabor filters specified in self

output is a PitchArray with shape (num_neurons, num_frames)

jth row of which is the output of jth gabor filter

generate_visual_receptive_fields(startbias=0, N_filters=None, x_start=None, y_start=None)

Generate a batch of gabor filters from parameters set in self

Parameters:

start_bias : integer, optional

start the the (start_bias)th filter

N_filters : integer, optional

number of filters to generate

x_start : float, optional

indicating the starting degree in x direction

y_start : float, optional

indicating the starting degree in y direction

get_gabor_parameters(dilations=[1, 0, -1, -2, -3], num_rotations=8, alpha0=2.0, b0=1.5, b0scalebase=1.4142135623730951, KAPPA=2.5)

Create a set of parameters for a family of gabor filters

Parameters:

dilation : list

a list containing the dilation parameter m

num_rotations : integer

number of rotations of each (dilation, translation_x, translation_y) pair

alpha0 : np.float64

base factor of dilation

b0 : np.float64

base factor of translation

b0scalebase : np.float64

effective translation in each dilation will be b0 * (alpha0**dilations[i]) * b0scalebase**(-dilations[i])

KAPPA : float

spatial bandwidth

load_parameters(num_neurons=None, h_alpha=None, h_l=None, h_x0=None, h_y0=None, h_ab=None, KAPPA=2.5, set=0)

Load gabor parameters to GPU

num_neurons, h_alpha, h_l, h_x0, h_y0, h_ab must be specified together or not specified at all

Parameters:

num_neurons : integer

total number of neurons

h_alpha : ndarray of float64

containing dilation parameters alpha = alpha0**(m)

h_l : ndarray of float64

containing rotation parameters l (angles)

h_x0 : ndarray of float64

containing translation parameters x0

h_y0 : ndarray of float64

containing translation parameters y0

h_ab : ndarray of int32

containing 0 or 1, 0 for real part, 1 for imaginary part jth gabor filter will be generated according to h_alpha[j], h_l[j], h_n[j], h_k[j] and h_ab[j]

KAPPA : float

spatial bandwidth

set : integer

0 if self parameters has not been set, 1 if they have been set by get_gabor_parameters or other manner)