Andor#
- class Andor(acqName)#
Bases:
AcquisitionAndoracquisition class using Andor’s proprietary SDK via a worker.Uses a parallel worker loop (
andorLoop()) to manage camera acquisition asynchronously and communicates viaparallel.pool.DataQueue.Workflow:
connectCamera()(client): Launch worker and establish queues (client receives workerparallel.pool.PollableDataQueue).setCameraParameterAbsorption()(client→worker): SendSetParametermessage withAcquisitionMode="Absorption",ExposureTime, andBitPerSample; setsImageGroupSize=3on client.setCallback(): Register a client callback@(data,event)that handles the 3-frame group (atom, light, dark) pushed by the worker.startCamera()(client→worker): SendStart; worker acquires frames until a full group is ready, then sends data viaDataQueue.stopCamera()(client→worker): SendStop; worker aborts acquisition, closes shutter, and shuts down SDK. Client cancelsFutureand 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
- 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 backcdq (
parallel.pool.DataQueue) – Data queue used to stream image data to the client
Protocol:
Returns a worker
parallel.pool.PollableDataQueueto client viacqfor receiving messages.Message
SetParameterwith fieldsAcquisitionMode,ExposureTime,BitPerSampleconfigures SDK (cooler, read mode, shutter, ROI, etc.).Message
Startbegins 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
Stopaborts 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-throwsFuture.Errorwhen non-empty
- connectCamera()#
Connect by launching a worker loop and establishing queues.
Spawns a background worker running
andorLoop(), sets up aparallel.pool.DataQueue(worker→client) and aparallel.pool.PollableDataQueue(client→worker), and stores the returned worker queue inWorkerQueue.- 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 ascallbackFunc(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
WorkerQueuewith fields:Message="SetParameter",AcquisitionMode="Absorption",ExposureTime, andBitPerSample. Also setsImageGroupSizeto3on the client for a 3-frame sequence (atom, light, dark).
- startCamera()#
Start acquisition on the worker.
Sends
Message="Start"overWorkerQueueand checks for pending worker errors viacheckError().
- stopCamera()#
Stop camera recording and tear down worker-side state.
Sends
Message="Stop"to the worker, checks for errors, cancels the runningFuture, and deletesClientListener.