Photostim

scanimage.components.Photostim, reachable as hSI.hPhotostim, drives photostimulation: it holds the stimulus ROI groups, arms the stimulation path, triggers stimuli and monitors the resulting signals.

See also

Photostimulation for the feature guide, and Stimulus Field API for building stimulus scanfields.


Stimulus definition

Property

Description

stimRoiGroups

Array of scanimage.mroi.RoiGroup. Each entry is one stimulus group.

stimulusMode

'onDemand' or 'sequence'. Cannot be changed while the module is active.

sequenceSelectedStimuli

Indices into stimRoiGroups that make up the sequence.

numSequences

Number of times the sequence repeats. Inf repeats until aborted.

zMode

'2D' or '3D'. Forced to '3D' when the z actuator shares a DAQ with the beams or galvos, and to '2D' when there is no z actuator.

compensateMotionEnabled

Apply the active motion correction offsets to the stimulus.

useOptimizedStimWaveforms

Use optimized waveforms for the stimulus output.

laserActiveSignalAdvance

Seconds by which the laser-active signal leads the stimulus. Default 1 ms.

allowMultipleOutputs

Allow further externally triggered stimuli after one completes.

stimImmediately

Output the stimulus as soon as it is armed.

autoTriggerPeriod

Seconds between automatic triggers. 0 disables auto-triggering.


Triggering and terminals

Property

Description

stimTriggerTerm

Terminal that triggers a stimulus.

syncTriggerTerm

Terminal that provides the sync trigger.

stimSelectionTriggerTerm, stimSelectionDevice, stimSelectionTerms, stimSelectionAssignment

External stimulus selection: which terminals encode which stimulus group.

stimActiveOutputChannel, beamActiveOutputChannel

Outputs that report stimulus and beam activity.

pairStimActiveOutputChannel, pairBeamActiveOutputChannel

When true, Photostim reports an error unless the configured active outputs are also wired to the auxIn3 / auxIn4 ports of every other RggScan scanner.

slmTriggerOutputChannel

Output that triggers the SLM.

loggingStartTrigger

Trigger that starts monitor logging.

BeamAiId

Analog input used to monitor the beam.


Running stimuli

Method

Description

hSI.hPhotostim.start()

Arm the photostimulation module.

hSI.hPhotostim.abort()

Disarm it.

hSI.hPhotostim.onDemandStimNow(stimGroupIdx,verbose)

Output one stimulus group immediately. Requires stimulusMode = 'onDemand', the module to be started, and the linear scanner to be idle. verbose prints timing information.

hSI.hPhotostim.triggerStim()

Issue the stimulus trigger in software.

hSI.hPhotostim.triggerSync()

Issue the sync trigger in software.

hSI.hPhotostim.backupRoiGroups()

Snapshot the stimulus ROI groups.

hSI.hPhotostim.stimulusMode = 'onDemand';
hSI.hPhotostim.start();

hSI.abort();                             % the linear scanner must not be imaging
hSI.hPhotostim.onDemandStimNow(1);

Warning

onDemandStimNow asserts rather than queueing: it throws if the mode is wrong, if the module has not been started, or if the linear scanner is still acquiring.


Monitoring

Member

Description

monitoring

Enable signal monitoring.

logging

Log the monitored signals.

monitoringSampleRate

Sample rate of the monitor analog inputs, in Hz. Default 9000.

hSI.hPhotostim.startMonitoring(sync) / stopMonitoring()

Start and stop monitoring.

hSI.hPhotostim.startMonitoringDisplayTimer() / stopMonitoringDisplayTimer()

Start and stop the display refresh timer for the monitor plot.

hSI.hPhotostim.calibrateMonitorAndOffset()

Calibrate the monitor input and its offset.

The monitorDataAcquired event fires whenever a new block of monitor data is available.

hL = most.ErrorHandler.addCatchingListener(hSI.hPhotostim,'monitorDataAcquired', ...
     @(src,evt)disp('monitor data ready'));

Stimulus waveforms

Method

Description

[ao,rates] = hSI.hPhotostim.getStimGroupAO(groupIdx)

Compute the analog output and sample rates for a stimulus group.

hSI.hPhotostim.optimizeStimGroupWaveform(desiredCol,sampleRateHz,hAdapter,cb,opts)

Optimize the waveform of one actuator column of a stimulus group.

fb = hSI.hPhotostim.testStimGroupWaveform(desiredCol,sampleRateHz,hAdapter,cb)

Output the waveform once and return the measured feedback.

hSI.hPhotostim.resetStimGroupWaveform(desiredCol,sampleRateHz,hAdapter)

Discard the optimized version.

See also

WaveformManager - getPhotostimWaveformSources enumerates these actuator columns.