Device Classes

dabs.resources.devices holds the abstract device classes: one per kind of hardware ScanImage® knows how to use. A vendor driver derives from the class matching its function and implements a handful of abstract members; everything above the driver - components, GUIs, widgets - is written against the abstract class, never against the vendor.

This page documents those abstract interfaces, which is what you need both to drive a device from a script and to write a new driver.


MotorController

dabs.resources.devices.MotorController. Used by hSI.hMotors.

Member

Description

numAxes

Number of axes.

lastKnownPosition

1 x numAxes position vector. Observable - this is how ScanImage tracks the stage.

isMoving

True while a move started with move or moveAsync is running.

isHomed

True when the absolute position is known relative to home.

defaultTimeout_s

Timeout used when a move does not specify one.

initSuccessful

True when errorMsg is empty.

hMotor.move(position,timeout_s)

Blocking move.

hMotor.moveAsync(position,callback)

Non-blocking move; callback runs on completion.

hMotor.stop()

Stop motion.

hMotor.startHoming()

Begin the homing sequence.

position = hMotor.queryPosition()

Query the controller.

tf = hMotor.queryMoving()

Query motion state.

dabs.resources.devices.StreamableMotor extends this for controllers that can stream a position trajectory.


LinearScanner

dabs.resources.devices.LinearScanner models an analog-controlled actuator with optional position feedback: galvos (GalvoAnalog) and analog FastZ actuators (FastZAnalog) both derive from it.

Member

Description

hAOControl, hAOOffset, hAIFeedback

The IO channels used for control, offset and feedback. Assigning a name resolves it through the resource store.

travelRange, parkPosition, daqOutputRange

Mechanical and electrical limits.

voltsPerDistance, distanceVoltsOffset

Linear command scaling.

positionLUT, feedbackVoltLUT

Lookup tables for non-linear command and feedback response.

slewRateLimit_V_per_s

Applied to the control AO on reinit.

targetPosition

Updated by pointPosition.

lastKnownPositionOutput, lastKnownPositionFeedback, lastKnownPositionFeedback_V

Updated by the read methods.

positionAvailable, feedbackAvailable

Whether the corresponding channels are configured.

Method

Description

hScanner.pointPosition(position,tfNaive)

Drive the actuator to a position.

hScanner.pointPosition_V(voltage)

Drive it to a raw voltage.

hScanner.park(), hScanner.center()

Move to the park position or to zero.

hScanner.smoothTransitionPosition(new) / smoothTransitionVolts(newV)

Ramp rather than step to a new position.

[mean,samples] = hScanner.readPositionFeedback(n)

Read the feedback channel, in position units.

v = hScanner.readPositionOutput()

Read back the commanded position.

tf = hScanner.isMoving(), hScanner.waitMoveComplete(timeout_s)

Motion state.

hScanner.volts2Position(v), position2Volts(p,...), feedbackVolts2Position(v)

Unit conversions that honor the LUTs.

hScanner.calibrate(hWb), calibrateFeedback(...), calibrateOffset(...)

Calibration routines.

hScanner.plotPositionLUT()

Plot the position lookup table.

feedback = hScanner.testWaveformVolts(waveformVolts,sampleRate,...)

Output a waveform and capture the feedback.

[wvfm,err] = hScanner.optimizeWaveformIteratively(desiredWaveform,sampleRateHz,cache)

Iteratively optimize a waveform against the measured feedback. An ...Async variant exists.

hScanner.isCached(...), getCachedOptimizedWaveform(...), cacheOptimizedWaveform(...), clearCache()

The optimized waveform cache that hSI.hWaveformManager sits on top of.


SyncedScanner, ResonantScanner and PolygonalScanner

dabs.resources.devices.SyncedScanner is the base for scanners whose sync signal is the master clock for the acquisition.

Member

Description

hDISync

Digital input carrying the sync signal.

nominalFrequency_Hz, currentFrequency_Hz

Nominal and measured line frequency.

angularRange_deg

Full angular range.

settleTime_s, waitSettlingTime()

Start-up transient, and a blocking wait for it.

park()

Park the scanner.

ResonantScanner adds amplitude control and the calibration maps that make a resonant scanner usable across zoom levels:

Member

Description

hScanner.setAmplitude(degrees_pp)

Command the amplitude.

currentAmplitude_deg

Read-only current amplitude.

amplitudeToFrequencyMap

N x 2 map from amplitude to resonant frequency.

amplitudeToLinePhaseMap

N x 2 map from amplitude to line phase.

amplitudeLUT

N x 2 command linearization table.

hScanner.estimateFrequency(amp_deg), estimateLinePhase(amp_deg)

Interpolate the maps.

hScanner.lookUpAmplitude(amp_deg,reverse)

Apply the amplitude LUT.

hScanner.addToAmplitudeToFrequencyMap(amp_deg,freq_Hz), addToAmplitudeToLinePhaseMap(amp_deg,linePhase_s)

Add a measured point. A near-duplicate amplitude is replaced by the new entry.

hScanner.plotFrequency(), plotLinePhase(), plotLUT()

Plot the maps.

PolygonalScanner covers polygonal scanners, which are synced scanners with a different amplitude model.


PMT

dabs.resources.devices.PMT. Used by hSI.hPmts.

Member

Description

powerOn, gain_V, gainOffset_V, bandwidth_Hz

Read-only state, updated by queryStatus.

tripped

Read-only trip state.

wavelength_nm

Wavelength the PMT is being used at. Default 700.

autoOn

Power the PMT with the acquisition.

hPMT.setPower(tf), setGain(gain_V), setGainOffset(offset_V), setBandwidth(bandwidth_Hz)

Command the controller.

hPMT.resetTrip()

Clear a trip.

hPMT.queryStatus()

Refresh the properties from the controller. Called automatically on the resource store’s 1 Hz beacon.


Shutter

dabs.resources.devices.Shutter. Used by hSI.hShutters.

Member

Description

isOpen

Read-only state.

openTime_s

Time the shutter needs to open fully.

shutterTarget

dabs.resources.devices.shutter.ShutterTarget values describing what the shutter gates - for example the imaging or the photostimulation path.

hShutter.open(), close(), transition(tf)

Blocking transitions.

hShutter.startTransition(tf), waitTransitionComplete()

The non-blocking pair.


BeamModulator

dabs.resources.devices.BeamModulator, with BeamModulatorFast (Pockels cells and similar) and BeamModulatorSlow (motorized half-wave plates) beneath it. Used by hSI.hBeams.

Member

Description

lastKnownPowerFraction

Observable. Listen to this rather than lastKnownPower_W.

lastKnownPower_W

Last known power in watts.

powerFractionLimit

Upper limit on the commanded fraction.

powerFraction2PowerWattLut

Measured calibration from fraction to watts.

hBeam.setPowerFraction(fraction)

Command the modulator.

watt = hBeam.convertPowerFraction2PowerWatt(fraction)

Convert using the LUT.

hBeam.calibrate(ignorePowerLimit)

Run the power calibration.


FastZ

dabs.resources.devices.FastZ is the minimal interface - moveBlocking(position,timeout) plus the Device lifecycle. FastZAnalog combines it with LinearScanner for analog-controlled actuators, and FastZDiscrete covers actuators that only support a fixed set of positions and therefore have no native waveform.


SLM

dabs.resources.devices.SLM. Used by scanimage.mroi.scanners.SLM and SlmScan.

Member

Description

pixelResolutionXY

Panel resolution.

pixelPitchXY, interPixelGapXY

Pixel pitch and gap in meters; ..._um variants in microns.

pixelBitDepth, pixelDataType

Bit depth, and the corresponding MATLAB integer type.

maxRefreshRate

Maximum refresh rate in Hz.

queueAvailable

Whether the SLM supports a frame queue.

lastKnownBitmap

The last phase mask written.

computeTransposedPhaseMask

Whether the phase mask is computed transposed.

hSlm.writeBitmap(phaseMaskRaw,waitForTrigger)

Write a phase mask.

hSlm.reset()

Write a blank mask.

hSlm.writeQueue(frames,frameOutputIdxs), startQueue(), abortQueue()

Frame queue control. All three assert that queueAvailable is true.

See also

SLM Optogenetics and the SLM coordinate systems in ScanImage Coordinate System Instances.


Camera

dabs.resources.devices.Camera. Wrapped by hSI.hCameraManager.

Member

Description

cameraName

Immutable name.

resolutionXY

Frame resolution.

isTransposed

Constant. Whether frame data is row-major.

cameraExposureTime

Exposure time.

datatype, availableDatatypes

Pixel type, as dabs.resources.devices.camera.Datatype.

isAcquiring

Read-only. True during a buffered continuous acquisition.

lastAcquiredFrame

The most recent frame.

hCam.start(), hCam.stop()

Start and stop a continuous buffered acquisition.

img = hCam.snapshot()

Single frame. Also updates lastAcquiredFrame.

[data,meta] = hCam.getAcquiredFrames()

Drain the acquisition buffer.

hCam.flush()

Discard buffered frames.


Driver inventory

Concrete drivers live in the vendor packages under +dabs. The generic package is the one to reach for when a device is driven purely through DAQ channels.

Package

Drivers

dabs.generic

GalvoPureAnalog, ResonantScannerAnalog, PolygonalScannerGeneric, FastZPureAnalog, GenericActuator, BeamModulatorFastAnalog, MotorizedHalfWavePlate, MotorAnalog, PMTAnalog, DigitalShutter, DigitalServoShutter, GenericSLM, BeamRouter, WaveformGenerator, ScannerLagCompensation, IntegrationRoiOutputChannel, TipTilt, GlobalCurvatureCorrection, TriggerScript, UserButtons, DataRecorder.

dabs.thorlabs

ECU1 / ECU2 resonant scanners and PMTs, MCM3000 / MCM301 / MCM6000 / MCM5000 controllers and their shutters and mirrors, Kinesis motors, MFF101 flipper, LiquidCrystalFastZ, PMT2100 / Pmt3k / PMT5100, ThorExulusSLM, BCM, Prelude, DCxCamera, ScientificCamera.

dabs.scientifica

MotionController, Motion8Motor, PMTController.

dabs.sutter

MP285 / MP285A / MPC200 controllers, resonant and galvo-galvo scan boxes.

dabs.pi

C867, E727_D, E753_D, E861, C413A and its scanner.

dabs.zaber

BinaryController_Async, streaming motor support.

dabs.meadowlark

SLM 1024 / 1920, Slm1024v2, MeadowlarkSlmOdp.

dabs.vidrio

RMR8kHz and RMR12kHz resonant scanners, VCAM.

dabs.simulated

Simulated motor, camera, SLM, slow beam modulator, vDAQ and FlexRIO. Everything needed to run ScanImage without hardware.

dabs.asi, dabs.bruker, dabs.galil, dabs.marzhauser, dabs.newport, dabs.npoint, dabs.prior, dabs.sensapex

Stage and actuator controllers.

dabs.mirrorcle, dabs.phaseform, dabs.picoquant, dabs.rapp, dabs.mini2p, dabs.micromanager, dabs.remote, dabs.zmq

Specialty scanners, adaptive optics, timing electronics, illumination, the MINI2P system, Micro-Manager cameras and remote / messaging transports.

% list every instantiable device class the installation knows about
classNames = dabs.resources.Device.findAllDevices();

See also

Devices for the configuration side of each of these.