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:
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. Please read the MATLAB docs even if you won't use MATLAB to control experiements: most of the information there is relevant to Python and TCP/IP.
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.
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:
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