Introduction: Running Experiments

Integrating photostimulation into your experiments

Once you have calibrated the scanners and the sample, and loaded a set of stimulus coordinates, you are ready to present the stimuli in an experiment. At this point the GUI plays little role, as the key task is to integrate photostimulation commands into the code that runs your experiment. The Zapit ecosystem provides APIs for MATLAB and Python, or you can PControl Zapit via TCP/IP from any PC or language.

Common Basic Concepts

No matter how you control Zapit, the overall approach will be the same. Zapit can present stimuli of either a precise fixed duration or continuously until terminated with a software command. Laser power is ramped down gently over a user-defined period on stimulus offset. Stimuli can be started either immediately on receipt of a software command or queued until a hardware trigger is received. Optionally, stimulus onset can be delayed with respect to the TTL trigger. These triggering options allow opto-stim to be delivered precisely with respect to other stimuli.

Let's assume you want the photostimulation waveforms triggered by an external hardware trigger and to continue until some event has ceased. Your pseudo-code event sequence will then be something along these lines:

<Trial is initiated>
<Photo-stimulus condition is selected and queued to the DAQ buffer>
...
Misc. stuff happens in the trial
...
An external device or software entity sends a 5V trigger pulse to the Zapit DAQ
<Photo-stimulus begins>
...
Some event of unknown duration occurs
...
<Photo-stimulus is stopped by a software command>
...
Trial ends 

The two key commands needed to achieve these goals are sendSamples (send_samples in Python) and stopOptoStim (stop_opto_stim in Python). The following sections will discuss how these commands are used in practice and discuss other relevant commands.

Knowing what happens in each stimulus condition

Should you need to know what will happen in each stimulus condition you can type hZP.stimConfig.print into the command line to see a text summary.

>> hZP.stimConfig.print

1. ML = +3.56 / AP = -1.24  <-->  ML = -3.56 / AP = -1.24  1' somatosensory barrel field
2. ML = +3.95 / AP = -0.08  <-->  ML = -3.95 / AP = -0.08  1' somatosensory nose
3. ML = +0.01 / AP = -0.91  Retrosplenial dorsal part
4. ML = +2.73 / AP = +1.66  <-->  ML = +1.88 / AP = +0.94  1' motor 
5. ML = -2.73 / AP = -2.98  <-->  ML = -2.73 / AP = -4.09  1' visual 

Alternatively, you can press "Plot stim coords" in the "Calibrate Sample" tab to see a plot of the same information.

This plot is generated by a function called zapit.utils.plotStimuli and you can you can generate the same plot at the MATLAB command line as follows:

>> zapit.utils.plotStimuli(hZP.stimConfig)

This command also accepts file names of stimulus config files, so you can run it on any saved file on disk to visualise its contents (see help zapit.utils.plotStimuli).

Last updated