Generating a drifting sinusoidal grating or drifting bar stimulus¶
This example shows how to use drifting psychophysics-based stimuli for a retinal implant.
Creating a Stimulus¶
First, create the stimuli:
(height, width) in pixels) is the only required parameter for creating these stimuli.
A drifting sinusoidal grating is represented by
The following illustrates one frame of a grating stimulus.
You can view the entire stimulus over time using
Here, the spatial frequency of the grating (i.e., the inverse of how many pixels it takes to represent one cycle of the sinusoid) is given as 0.1 cycles/pixel, whereas the temporal frequency (i.e., the inverse of how many frames it takes to represent one cycle of the sinusoid) is given as 0.1 cycles/frame. By default, the drift direction of the grating will be to the right (0 degrees).
A drifting bar is represented by
A visual example of a basic sinusoidal grating can be generated as such: