PYME.Acquire.frameWrangler module¶
Implementation of the FrameWrangler class (previously PreviewAcquisator) which manages the flow of information from a camera into the rest of the program, letting dependant parts of the program know when new data arrives via signals.
As hardware control in PYMEAcquire is largely driven by and synchronized with camera frames, this also encompasses the ‘heart’ or core of the program which everything else responds to.
- class PYME.Acquire.frameWrangler.FrameWrangler(_cam, _ds=None, event_loop=None)¶
Bases:
objectGrabs frames from the camera buffers
Notes
dispatch Signals are used to allow other files to listen to key events happinging within the acquisition.
- Attributes
- onFramedispatch.Signal
Called once per new-frame appearing in our buffer; used to pass frame data to e.g. spoolers. Note that while onFrame gets called once per new frame, the new frames are only checked for once per polling cycle, meaning that this event will be fired N-times for each onFrameGroup event.
- onFrameGroupdispatch.Signal
Called on each new frame group (once per polling interval) - use for updateing GUIs etc.
- onStopdispatch.Signal
Called when acquisition stops.
- Notify(event=None)¶
Callback which is called regularly by a system timer to poll the camera
- Prepare(keepds=True)¶
Prepare for acquisition by allocating the buffer which will store the data we recieve. The buffer stores a single frame, and all frames pass through this buffer. The current state of the buffer is accessible via the currentFrame variable.
- Parameters
- keepds: Whether or not to keep the previously allocated array
- checkHardware()¶
Check to see if our hardware is ready for us to take the next frame
NB: This is largely legacy code, as the camera is usually used in free-running mode.
- destroy()¶
- property dsa¶
Whatever frame is currently passing through the acquisition queue
NB: this new code should use the more informatively named currentFrame property instead
- getFPS()¶
- getFrame(colours=None)¶
Ask the camera to put a frame into our buffer
- getReqMemChans(colours)¶
Use this function to calc how may channels to allocate when creating a new data stack
- isRunning()¶
- onExpReady()¶
There is an exposure waiting in the Camera, pull it down into our local storage and notify any listeners
- purge()¶
purge (and discard) all remaining frames in the camera buffer
- spooling_paused()¶
Context manager for use within on_frame handlers to ensure that spooling is paused while a task executes. The behavior depends on the camera acquisition mode:
If the camera is in continuous mode, the camera will be stopped and restarted after the task is complete.
If the camera is in single-shot mode, we do nothing (as we automatically restart when the frame handler completes).
If the camera is in software-triggered mode, we fire a software trigger on completion.
TODO - single shot and triggered are currently a bit inconsistent - should we actually be always firing a software trigger in triggered mode where we would restart in single shot mode?
TODO - Hardware triggers???
TODO - add keyword to disable firing the trigger for timelapse???
- spooling_stopped(auto_trigger=True)¶
Context manager to ensure that spooling is stopped while performing a task, returning to the original state when the task is complete.
- start(tiint=100)¶
Start aquisition
- stop()¶
Stop sequence aquisition