WaveformManager

scanimage.components.WaveformManager, reachable as hSI.hWaveformManager, turns the current ROI group and scanner set into the analog output waveforms that drive the galvos, the FastZ actuator and the beam modulators. It also owns the optimized-waveform cache.

See also

Motion Estimation and Correction for the correction offsets applied to these waveforms. The unrelated Waveform Generator device outputs user-defined waveforms on spare vDAQ ports and is not managed by this component.


Properties

Property

Description

scannerAO

Read-only struct holding the current command waveforms. Populated by updateWaveforms. The fields are grouped per actuator; G is the galvo group, Z the FastZ group, B the beams.

optimizedScanners

Read-only cell array of the scanner names for which an optimized waveform is available.


Generating waveforms

Method

Description

hSI.hWaveformManager.updateWaveforms()

Regenerate the command waveforms for the current configuration and store them in scannerAO. Automatically checks the cache for optimized waveforms.

hSI.hWaveformManager.updateWaveforms(true)

The same, but re-checks the cache even when the command waveform has not changed.

hSI.hWaveformManager.resetWaveforms()

Clear scannerAO. Required after switching the waveform cache path, so that the correct optimized waveforms are loaded.

hSI.hWaveformManager.plotWaveforms(scanner)

Plot the command waveform for a scanner. scanner is one of 'G' or 'Z'.

hSI.hWaveformManager.updateWaveformCacheBasePath()

Point the cache at the current configuration’s directory.

hSI.hWaveformManager.updateWaveforms();
ao = hSI.hWaveformManager.scannerAO;

hSI.hWaveformManager.plotWaveforms('G');

Optimizing waveforms

Waveform optimization drives the actuator, measures its feedback, and iteratively adjusts the commanded waveform so that the measured trajectory matches the desired one.

Method

Description

hSI.hWaveformManager.optimizeWaveforms(scanner,updateCallback,updateWaveforms,samplesToAvg,numOfSignals,optIterations)

Run the optimization for a scanner.

feedback = hSI.hWaveformManager.testWaveforms(scanner,updateCallback,updateWaveforms)

Output the current waveform once and return the measured feedback, without optimizing.

[waveform,metaData] = hSI.hWaveformManager.retrieveOptimizedAO(scanner,updateWaveforms)

Fetch the cached optimized waveform for a scanner.

hSI.hWaveformManager.clearCachedWaveform(scanner)

Drop the optimized version of the current waveform for a scanner.

hSI.hWaveformManager.clearCache(scanner)

Drop every optimized waveform for a scanner.

hSI.hWaveformManager.calibrateScanner(scanner)

Calibrate a scanner’s feedback and offset.

hSI.hWaveformManager.optimizeWaveformsLive(prefix,guiCallback,opts)

Run optimization live, during an acquisition.

hSI.hWaveformManager.abortLiveOptimization()

Stop a live optimization.

hSI.hWaveformManager.calibrateScanner('G');
hSI.hWaveformManager.optimizeWaveforms('G');

fb = hSI.hWaveformManager.testWaveforms('Z');

Note

scanner is the actuator group name, not a device name: 'G' for the galvos and 'Z' for FastZ.


Waveform sources

getWaveformSources and getPhotostimWaveformSources return scanimage.components.waveforms.WaveformSource objects, one per adaptable actuator column of scannerAO - galvos, fast analog beams, analog FastZ - and one photostim source per stim group and actuator column. Actuators with no usable waveform, for example a FastZDiscrete device with no native waveform, are skipped.

sources = hSI.hWaveformManager.getWaveformSources();

Motion correction hooks

Method

Description

scannerAO = hSI.hWaveformManager.updateWaveformsMotionCorrection(scannerAO)

Apply the current motion correction offsets to a waveform set.

scannerAO = hSI.hWaveformManager.clearWaveformsMotionCorrection(scannerAO)

Remove them again.

hSI.hWaveformManager.blankPowerBoxBeams()

Blank the beams outside the active power boxes.