PYME.Acquire.SpoolController module

Created on Sat May 28 20:42:16 2016

@author: david

class PYME.Acquire.SpoolController.ProtocolAcquisitionSettings

Bases: object

Manages settings which are specific to protocol-based acquisitions

get_protocol_for_acquisition(settings={})
set_protocol(protocolName=None, reloadProtocol=True)

Set the current protocol.

Parameters
protocolName: str

path to protocol file including extension

reloadProtocolbool

currently ignored; protocol module is reinitialized regardless.

See also: PYME.Acquire.Protocols.
class PYME.Acquire.SpoolController.SpoolController(scope, defDir='/home/runner/PYMEData/runner/2025_10_23', defSeries='%(day)d_%(month)d_series')

Bases: object

Initialise the spooling controller.

Parameters
scopemicroscope instance

The currently active microscope class (see microscope.py)

defDirstring pattern

The default directory to save data to. Any keys of the form %(<key>) will be substituted using the values defined in PYME.fileUtils.nameUtils.dateDict

defSeriesstring pattern

This specifies a pattern for file naming. Keys will be substituted as for defDir

LaunchAnalysis()
SetSpoolDir(dirname)

Set the directory we’re spooling into

SetSpoolMethod(method)

Set the spooling method

Parameters
methodstring

One of ‘File’, ‘Queue’, or ‘Cluster’

SpoolStopped(**kwargs)
StopSpooling(**kwargs)

GUI callback to stop spooling.

property acquisition_cls
property autostart_analysis
property available_spool_methods
property dh5view_cmd
property dirname
property display_dirname

Returns a relative directory name for display in user interfaces

Returns
dirnamestr

current spool directory, relative to local PYMEData directory (ideally)

estimate_spool_time(settings={}, **kwargs)

Estimate the time to spool a series based on the current settings

used by queued actions to set timeouts etc … if in doubt, we should overestimate.

Returns
float

estimated time in seconds

FIXME - these are extremely rough estimates
FIXME - defer to acquisition type
get_cluster_dirname(dirname)
get_dirname(subdirectory=None, spoolType=None)

Get the current directory name, including any subdirectories from chunking or additional spec.

Parameters
subdirectorystr, optional

Directory within current set directory to spool this series. The directory will be created if it doesn’t already exist.

spoolTypestr, optional

Used when using get_dirname externally (e.g. in tiling) to over-ride the spool type.

Returns
str

spool directory name

get_free_space()

Get available space in the target spool directory

Returns
free space in GB
get_info()
get_settings(method_only=False)

Get the current settings for the spool controller

Used when adding actions to the action manager - this should freeze the relevant settings for the acquisition type and method.

launch_analysis()

Launch analysis

open_analysis()

Open the currenly running analysis in PYMEVis

open_view()
property pymeimage_cmd
property pymevis_cmd
register_acquisition_type(name, cls)
property seriesName
start_spooling(fn=None, settings={}, preflight_mode='interactive')
Parameters
fnstr, optional

fn can be hardcoded here, otherwise differs to the seriesName property which will create one if need-be.

settingsdict

keys should be SpoolController attributes or properties with setters. Not all keys must be present, and example keys include:

methodstr

One of ‘File’, ‘Cluster’, or ‘Queue’(py2 only)

hdf_compression_level: int

zlib compression level that pytables should use (spool to file and queue)

z_steppedbool

toggle z-stepping during acquisition

z_dwellint

number of frames to acquire at each z level (predicated on SpoolController.z_stepped being True)

cluster_h5bool

Toggle spooling to single h5 file on cluster rather than pzf file per frame. Only applicable to ‘Cluster’ method and preferred for PYMEClusterOfOne.

pzf_compression_settingsdict

Compression settings relevant for ‘Cluster’ method if cluster_h5 is False. See acquisition_backends.ClusterBackend.defaultCompSettings.

protocol_namestr

Note that passing the protocol name will force a (re)load of the protocol file (even if it is already selected).

max_framesint, optional

point at which to end the series automatically, by default sys.maxsize

subdirectorystr, optional

Directory within current set directory to spool this series. The directory will be created if it doesn’t already exist.

extra_metadatadict, optional

metadata to supplement this series for entries known prior to acquisition which do not have handlers to hook start metadata

preflight_modestr (default=’interactive’)

What to do when the preflight check fails. Options are ‘interactive’, ‘warn’, ‘abort’ and ‘skip’ which will display a dialog and prompt the user, log a warning and continue, and log an error and abort, or skip completely. The former is suitable for interactive acquisition, whereas one of the latter modes is likely better for automated spooling via the action manager.

update_settings(settings)

Sets the state of the SpoolController by calling set-methods or by setting attributes.

Parameters
settingsdict

keys should be SpoolController attributes or properties with setters. Not all keys must be present, and example keys include:

methodstr

One of ‘File’, ‘Cluster’, or ‘Queue’(py2 only)

hdf_compression_level: int

zlib compression level that pytables should use (spool to file and queue)

z_steppedbool

toggle z-stepping during acquisition

z_dwellint

number of frames to acquire at each z level (predicated on SpoolController.z_stepped being True)

cluster_h5bool

Toggle spooling to single h5 file on cluster rather than pzf file per frame. Only applicable to ‘Cluster’ method and preferred for PYMEClusterOfOne.

pzf_compression_settingsdict

Compression settings relevant for ‘Cluster’ method if cluster_h5 is False. See acquisition_backends.ClusterBackend.default_compression_settings.

protocol_namestr

Note that passing the protocol name will force a (re)load of the protocol file (even if it is already selected).

Notable keys which are not supported through this method include ‘series_name’, ‘seriesName’ and ‘dirname’.

class PYME.Acquire.SpoolController.SpoolControllerWrapper(spool_controller)

Bases: object

info()
info_longpoll()
settings(body)
start_spooling(body, filename=None, preflight_mode='abort')

See also SpoolController.start_spooling()

Parameters
filenamestr, optional

fn can be hardcoded here, otherwise differs to the seriesName property which will create one if need-be.

preflight_modestr, default == ‘abort’

One of ‘warn’, ‘abort’, ‘skip, or ‘interactive’. Note that ‘interactive’ requires an active wx.App

The majority of parameters are passed in the request body, which should be a json-formatted dictionary with the
the following keys (see also `settings` parameter to `SpoolController.start_spooling`
z_steppedbool, optional

toggle z-stepping during acquisition. By default None, which differs to current SpoolController state.

hdf_comp_levelint, optional

zlib compression level for pytables. Not relevant for Cluster spool method unless cluster_h5 is True. By default None, which differs to current SpoolController state.

z_dwellint, optional

frames per z-step. By default None, which differs to current SpoolController state.

max_framesint, optional

point at which to end the series automatically, by default sys.maxsize

pzf_compression_settingsdict, optional

Compression settings relevant for ‘Cluster’ method if cluster_h5 is False. See acquisition_backends.ClusterBackend.defaultCompSettings. By default None, which defers to current SpoolController state.

cluster_h5bool, optional

Toggle spooling to single h5 file on cluster rather than pzf file per frame. Only applicable to ‘Cluster’ method and preferred for PYMEClusterOfOne. By default None, which differs to current SpoolController state.

protocolstr, optional

path to acquisition protocol. By default None which differs to current SpoolController state.

subdirectorystr, optional

Directory within current set directory to spool this series. The directory will be created if it doesn’t already exist.

extra_metadatadict, optional

metadata to supplement this series for entries known prior to acquisition which do not have handlers to hook start metadata

stack_settingsdict, optional

The stack settings. See PYME.Acquire.stackSettings.StackSettings. By default the global StackSettings instance is used.

stop_spooling()