PYME.Acquire.protocol_acquisition module

class PYME.Acquire.protocol_acquisition.ProtocolAcquisition(filename, frameSource, frame_wrangler, protocol=<PYME.Acquire.protocol.Protocol object>, maxFrames=9223372036854775807, backend='hdf', backend_kwargs={}, **kwargs)

Bases: AcquisitionBase

Spooler base class

Create a new spooler.

Parameters
scopePYME.Acquire.microscope.Microscope object

The microscope providing the data

filenamestring

The file into which to spool

frameSourcedispatch.Signal object

A source of frames we can subscribe to. It should implement a “connect” method allowing us to register a callback and then call the callback with the frame data in a “frameData” kwarg.

frame_wranglerPYME.IO.FrameWrangler object

The frame wrangler object to use for spooling - used to stop and start while we update settings

protocolPYME.Acquire.protocol.TaskListProtocol object

The acquisition protocol

guiUpdateCallbackfunction

a function to call when the spooling GUI needs updating

FlushBuffer()
StartSpool()
StopSpool()
abort()

Tidy up if something goes horribly wrong. Disconnects frame source and event logger and then calls cleanup()

cleanup()

over-ride to do any cleanup

finalise()

Over-ride in derived classes to do any spooler specific tidy up - e.g. sending events to server

finished()

over-ride in derived classes to indicate when buffers flushed

classmethod from_spool_settings(scope, settings, backend, backend_kwargs={}, series_name=None, spool_controller=None)

Create an XYZTCAcquisition object from a spool_controller settings object

classmethod get_frozen_settings(scope, spool_controller=None)

Return a dictionary of settings for the acquisition

Used to “freeze” the state of the spool_controller and/or other settings objects when queueing acquisitions for subsequent execution via the ActionManager

get_n_frames()
property md

Return acqusition metadata (a PYME.IO.MetaDataHandler object)

generally just a short wrapper around the backend metadata

#TODO - rename this to .mdh, or remove entirely and standardise backend access?

on_frame(sender, frameData, **kwargs)

Callback which should be called on every frame

start()

Perform protocol ‘frame -1’ tasks, log start metadata, then connect to the frame source.

status()
stop()

Stop the acquisition

This should disconnect from the frame souce, flush any remaining buffers, return hardware to starting state (if modified), do any cleanup, and finalise the backend.

It is desirable to send a final on_progress signal so that the GUI reflects the actual number of frames spooled etc… .

Once everything is complete, the on_stop signal should be emitted and the spool_complete flag set.

PYME.Acquire.protocol_acquisition.getReducedFilename(filename)