Generating stimulus patterns at the CLI

How to generate complicated stimulus patterns at the command line

There is a command line tool called zapit.utils.stimConfigPatternGenerator for generating patterns of stimuli, like grids or crosses, at the command line. You can access doc text for the tool at the command line:

help zapit.utils.stimConfigPatternGenerator

This page show with plots how it works.

Grid of points over V1 stimulating bilaterally

zapit.utils.stimConfigPatternGenerator('myV1', [-2.75,-3.8], ...
                                       'num', [3,5], ...
                                       'patterns', [1,1.5], ...
                                       'bilateral',true)
Bilateral non-square grid over V1. In a single trial corresponding points on the two sides will be stimulated. e.g. both points labelled "5" will be stimulated in one trial.

The grids above are bilateral stimulation points. In other words, they constitute 15 different trials. All 15 points are not stimulated in a single trial.

Square grid over V1 with independent stimulus conditions on the two sides

To create grids that are independent you need to generate the patterns in two steps. Note that second has 'overwrite', false to allow the new points to be appended to the file created by the first step.

zapit.utils.stimConfigPatternGenerator('myV1', [-2.75,-3.8], ...
                                       'num',3, 'patterns', 1, ...
                                       'overwrite', true)
zapit.utils.stimConfigPatternGenerator('myV1', [2.75,-3.8], ...
                                       'num', 3, 'patterns', 1, ...
                                       'overwrite',false)
Bilateral square grids over V1. In a single trial only one location is stimulated, unlike the bilateral example above. e.g. Point "3" on the left is stimulated alone in one trial.

Generate a variety of patterns

zapit.utils.stimConfigPatternGenerator('myPattern', [3.55,-1.3], ...
                           'pattern','cross', 'num',3, 'patternsize',0.8, ...
                           'overwrite',true)

zapit.utils.stimConfigPatternGenerator('myPattern', [0.55,-2.5], ...
                           'pattern', 'APline', 'num',7, 'patternsize',2, ...
                           'overwrite',false, 'bilateral',true)

zapit.utils.stimConfigPatternGenerator('myPattern', [1.55,2.75], ...
                           'pattern', 'MLline', 'num',5, 'patternsize',1.5, ...
                           'overwrite',false, 'bilateral',true)

zapit.utils.stimConfigPatternGenerator('myPattern', [-3.5,0], ...
                            'pattern','cross', 'num',[3,5], 'patternsize', [0.75,1.5], ...
                            'overwrite',false)
The two crosses are independent. The AP and ML lines each contain points that are stimulated bilaterally.

Generating plots of the stimulus locations

You can generate plots of the stimulus locations in one of two ways.

zapit.utils.plotStimuli('myPattern.yml')

Or with the 'makePlot', true parameter/value pair as an argumnent to the stimConfigPatternGenerator. These files can also be loaded into the stim editor GUI and modified.

Last updated