Andor

Andor#

class Andor(acqName)#

Bases: Acquisition

Andor acquisition class using Andor’s proprietary SDK via a worker.

Uses a parallel worker loop (andorLoop()) to manage camera acquisition asynchronously and communicates via parallel.pool.DataQueue.

  • Workflow:

    1. connectCamera() (client): Launch worker and establish queues (client receives worker parallel.pool.PollableDataQueue).

    2. setCameraParameterAbsorption() (client→worker): Send SetParameter message with AcquisitionMode="Absorption", ExposureTime, and BitPerSample; sets ImageGroupSize=3 on client.

    3. setCallback(): Register a client callback @(data,event) that handles the 3-frame group (atom, light, dark) pushed by the worker.

    4. startCamera() (client→worker): Send Start; worker acquires frames until a full group is ready, then sends data via DataQueue.

    5. stopCamera() (client→worker): Send Stop; worker aborts acquisition, closes shutter, and shuts down SDK. Client cancels Future and removes listener.

Example:

cam = Andor("MainAndor");
cam.ExposureTime = 0.01;  % [s]
cam.BitsPerSample = 16;
cam.connectCamera();
cam.setCameraParameterAbsorption();
cam.setCallback(@(m,~) disp(size(m)));
cam.startCamera(); pause(1); cam.stopCamera();
Constructor Summary
Andor(acqName)#

Construct an Andor acquisition instance.

Parameters:

acqName (string) – Camera config name

Property Summary
CallbackFunc function_handle#

Client-side callback: @(data,event)

ClientDataQueue parallel.pool.DataQueue#

Queue to receive data from worker

ClientListener event.listener#

Listener that adapts queue messages to callback signature

ClientQueue parallel.pool.PollableDataQueue#

Queue to receive the worker queue handle

Future parallel.FevalFuture#

Handle to the worker task running andorLoop()

WorkerQueue parallel.pool.PollableDataQueue#

Queue to send commands to worker

Method Summary
static andorLoop(cq, cdq)#

Worker loop managing Andor SDK calls.

Parameters:
  • cq (parallel.pool.PollableDataQueue) – Client queue used to deliver the worker queue handle back

  • cdq (parallel.pool.DataQueue) – Data queue used to stream image data to the client

Protocol:

  • Returns a worker parallel.pool.PollableDataQueue to client via cq for receiving messages.

  • Message SetParameter with fields AcquisitionMode, ExposureTime, BitPerSample configures SDK (cooler, read mode, shutter, ROI, etc.).

  • Message Start begins acquisition; worker polls for a full group of frames (group size set during parameter stage).

  • When a group is ready, frames are fetched, oriented, converted to the specified bit depth, and sent to the client via cdq.

  • Message Stop aborts acquisition, closes shutter, and shuts down SDK.

Send the worker queue to the client

checkError()#

Throw worker errors on the client if present.

Raises:

error – Re-throws Future.Error when non-empty

connectCamera()#

Connect by launching a worker loop and establishing queues.

Spawns a background worker running andorLoop(), sets up a parallel.pool.DataQueue (worker→client) and a parallel.pool.PollableDataQueue (client→worker), and stores the returned worker queue in WorkerQueue.

Raises:

error – When worker reports an error during startup

pauseCamera()#

Pause camera recording (not implemented in this backend).

Notes:

Pausing is not supported by the current Andor worker example. Use stopCamera() to end an acquisition.

[ret] = AbortAcquisition(); CheckError(ret);

setCallback(callbackFunc)#

Set camera callback function.

Parameters:

callbackFunc (function_handle) – Function handle invoked as callbackFunc(data, event)

The listener adapts queue payloads to the standard acquisition callback signature by passing an empty event struct.

setCameraParameterAbsorption()#

Set absorption-imaging parameters on the worker.

Sends a message over WorkerQueue with fields: Message="SetParameter", AcquisitionMode="Absorption", ExposureTime, and BitPerSample. Also sets ImageGroupSize to 3 on the client for a 3-frame sequence (atom, light, dark).

startCamera()#

Start acquisition on the worker.

Sends Message="Start" over WorkerQueue and checks for pending worker errors via checkError().

stopCamera()#

Stop camera recording and tear down worker-side state.

Sends Message="Stop" to the worker, checks for errors, cancels the running Future, and deletes ClientListener.