vision Package

cai97 Module

docstring goes here

mozaik.models.vision.cai97.meshgrid3D(x, y, z)

A slimmed-down version of http://www.scipy.org/scipy/numpy/attachment/ticket/966/meshgrid.py

mozaik.models.vision.cai97.stRF_kernel_2d(duration=200.0, dt=8.333333333333334, size=10.0, scale_factor=10.0, p={})

scale_factor = pixel/degree

mozaik.models.vision.cai97.stRF_2d(x, y, t, p)

x, y, and t should all be 3D arrays, produced by meshgrid3D. If we need to optimize, it would be quicker to do G() on a 1D t array and F_2d() on 2D x and y arrays, and then multiply them, as Jens did in his original implementation. Timing gives 0.44 s for Jens’ implementation, and 2.9 s for this one.

mozaik.models.vision.cai97.G(t, K1, K2, c1, c2, t1, t2, n1, n2)
mozaik.models.vision.cai97.F_2d(x, y, A, sigma)

spatiotemporalfilter Module

Retina/LGN model based on that developed by Jens Kremkow (CNRS-INCM/ALUF)

mozaik.models.vision.spatiotemporalfilter.meshgrid3D(x, y, z)

A slimmed-down version of http://www.scipy.org/scipy/numpy/attachment/ticket/966/meshgrid.py

class mozaik.models.vision.spatiotemporalfilter.SpatioTemporalReceptiveField(func, func_params, width, height, duration)

Bases: object

Implements spatio-temporal receptive field.

Parameters :

func : function

should be a function of x, y, t, and a ParameterSet object

func_params : ParameterSet

ParameterSet that is passed to func.

width : float (degrees)

x-dimension size

height : float (degrees)

y-dimension size

duration : float (ms)

length of the temporal axis of the RF

Notes

Coordinates x = 0 and y = 0 are at the centre of the spatial kernel.

quantize(dx, dy, dt)

Quantizes the the receptive field.

Parameters :

dx : float

The number of pixels along x axis.

dy : float

The number of pixels along y axis.

dy : float

The number of time bins along the t axis.

Notes

If dx does not divide exactly into the width, then the actual width will be slightly larger than the nominal width. dx and dy should be in degrees and dt in ms.

kernel_duration
class mozaik.models.vision.spatiotemporalfilter.CellWithReceptiveField(x, y, receptive_field, gain, visual_space)

Bases: object

A model of the input current to an LGN relay cell, that multiplies, in space and time, the luminance values impinging on its receptive field by a spatiotemporal kernel. Spatial summation over the result of this multiplication at each time point gives a current in nA, that may then be injected into a relay cell.

initialize() should be called once, before stimulus presentation view() should be called in a loop, once for each stimulus frame response_current() should be called at the end of stimulus presentation

Parameters :

x , y : float

x and y coordinates of the center of the RF in visual space.

receptive_field : SpatioTemporalReceptiveField

The receptive field object containing the RFs data.

gain : float

The calculated input current values will be multiplied by the gain parameter.

visual_space : VisualSpace

The object representing the visual space.

initialize(background_luminance, stimulus_duration)

Create the array that will contain the current response, and set the initial values on the assumption that the system was looking at a blank screen of constant luminance prior to stimulus onset.

Parameters :

background_luminance : float

The background luminance of the visual space.

stimulus_duration : float (ms)

The duration of the visual stimulus.

view()

Look at the visual space and update t Where the kernel temporal resolution is the same as the frame duration (visual space update interval):

R_i = Sum[j=0,L-1] K_j.I_i-j
where L is the kernel length/duration
Where the kernel temporal resolution = (frame duration)/α (α an integer)
R_k = Sum[j=0,L-1] K_j.I_i’
where i’ = (k-j)//α (// indicates integer division, discarding the remainder)

To avoid loading the entire image sequence into memory, we build up the response array one frame at a time.

response_current()

Multiply the response (units of luminance (cd/m²) if we assume the kernel values are dimensionless) by the ‘gain’, to produce a current in nA. Returns a dictionary containing ‘times’ and ‘amplitudes’. Might be better to use a NeuroTools AnalogSignal.

class mozaik.models.vision.spatiotemporalfilter.SpatioTemporalFilterRetinaLGN(model, parameters)

Bases: mozaik.core.SensoryInputComponent

Retina/LGN model with spatiotemporal receptive field.

Parameters :

density : int (1/degree^2)

Number of neurons to simulate per square degree of visual space.

size : tuple (degree,degree)

The x and y size of the visual field.

linear_scaler : float

The linear scaler that the RF output is multiplied with.

cached : bool

If the stimuli are chached.

cache_path : str

Path to the directory where to store the create the cache.

mpi_reproducible_noise : bool

If true the background noise is generated in such a way that is reproducible accross runs using different number of mpi processes. Significant slowdown if True.

recorders : :

Notes

If the stimulus is cached SpatioTemporalFilterRetinaLGN will write in the local directory parameters.cache_path the generated amplitudes for all the neurons in the retina (so this will be specific to the model) for each new presented stimulus. If it is asked to generate activities for a stimulus that already exists in the directory (it just checks for the name and parameter values of the stimulus, except trail number) it will retrieve the values from the cahce. Note that the input currents are stored without the noise and the aditional noise is still applied after retrieval so the actual current injected into the retinal neurons will not be identical to the one that was injected when the stimulus was saved in the cache.

IMPORTANT This mechanism assumes that the retinal model stays otherwise identical between simulations. The moment anything is changed in the retinal model one has to delete the retina_cache directory (which effectively resets the cache).

required_parameters = {'noise': {'mean': <type 'float'>, 'stdev': <type 'float'>}, 'density': <type 'int'>, 'cached': <type 'bool'>, 'recorders': <class 'parameters.ParameterSet'>, 'cell': {'model': <type 'str'>, 'initial_values': <class 'parameters.ParameterSet'>, 'params': <class 'parameters.ParameterSet'>}, 'cache_path': <type 'str'>, 'gain': <type 'float'>, 'linear_scaler': <type 'float'>, 'receptive_field': {'func_params': <class 'parameters.ParameterSet'>, 'width': <type 'float'>, 'height': <type 'float'>, 'temporal_resolution': <type 'float'>, 'func': <type 'str'>, 'duration': <type 'float'>, 'spatial_resolution': <type 'float'>}, 'mpi_reproducible_noise': <type 'bool'>, 'size': <type 'tuple'>}
get_cache(stimulus_id)

Returns the cached calculated responses due to stimulus corresponding to stimulus_id.

Parameters :

stimulus_id : StimulusID

The stimulus id of the stimulus for which to return the activities

Returns :

Tuple (input_currents, retinal_input) where input_currents are the currents due to the RFs of the individual RFs and retinal_input is the :

list of frames shown to the retina. :

write_cache(stimulus_id, input_currents, retinal_input)

Stores input currents and the retinal input corresponding to a given stimulus.

Parameters :

stimulus_id : StimulusID

The stimulus id of the stimulus for which we will store the input currents

input_currents : list

List containing the input currents that will be injected to the LGN neurons due to the neuron’s RFs. One per each LGN neuron.

retinal_input : list(ndarray)

List of 2D arrays containing the frames of luminances that were presented to the retina for the stimulus stimulus_id.

process_input(visual_space, stimulus, duration=None, offset=0)

Present a visual stimulus to the model, and create the LGN output (relay) neurons.

Parameters :

visual_space : VisualSpace

The visual space to which the stimuli are presented.

stimulus : VisualStimulus

The visual stimulus to be shown.

duration : int (ms)

The time for which we will simulate the stimulus

offset : int(ms)

The time (in absolute time of the whole simulation) at which the stimulus starts.

Returns :

retinal_input : list(ndarray)

List of 2D arrays containing the frames of luminances that were presented to the retina.

provide_null_input(visual_space, duration=None, offset=0)

This function exists for optimization purposes. It is the analog to :func:.`mozaik.retinal.SpatioTemporalFilterRetinaLGN.process_input` for the special case when blank stimulus is shown.

Parameters :

visual_space : VisualSpace

The visual space to which the blank stimulus are presented.

duration : int (ms)

The time for which we will simulate the blank stimulus

offset : int(ms)

The time (in absolute time of the whole simulation) at which the stimulus starts.

Returns :

retinal_input : list(ndarray)

List of 2D arrays containing the frames of luminances that were presented to the retina.

Previous topic

models Package

Next topic

stimuli Package

This Page