util

scanning.utils provides shared utility functions and classes. For consistency and to avoid circular dependencies, the following rules are applied: - All types required to initialize hook classes are in the hooks namespace - All types required to initialize info classes are in the infos namespace - util depends on hooks and infos (not vice versa)

class malcolm.modules.scanning.util.ConfigureParams(generator: Anno(name='AGenerator', typ=<class 'scanpointgenerator.core.compoundgenerator.CompoundGenerator'>, description='Generator instance providing specification for scan'), axesToMove: Optional[Union[Anno(name='AAxesToMove', typ=<class 'str'>, description='List of axes in inner dimension of generator that should be moved'), Sequence[str]]] = None, breakpoints: Optional[Anno(name='ABreakpoints', typ=<class 'numpy.int32'>, description='List of points at which the run will return in Armed state')] = None, **kwargs: Any)[source]
Parameters
  • generator (CompoundGenerator) – Generator instance providing specification for scan

  • axesToMove (str) – List of axes in inner dimension of generator that should be moved

  • breakpoints (int32) – List of points at which the run will return in Armed state

class malcolm.modules.scanning.util.PointGeneratorMeta(description: Anno(name='AMetaDescription', typ=<class 'str'>, description='Description of what this element represents') = '', tags: Union[Anno(name='ATags', typ=<class 'str'>, description='Generic text tags for client tools to interpret'), Sequence[str], str] = (), writeable: Anno(name='AWriteable', typ=<class 'bool'>, description='Whether this element is currently writeable') = False, label: Anno(name='ALabel', typ=<class 'str'>, description='A human readable label for the element') = '')[source]
Parameters
  • description (str) – Description of what this element represents

  • tags (str) – Generic text tags for client tools to interpret

  • writeable (bool) – Whether this element is currently writeable

  • label (str) – A human readable label for the element

attribute_class

alias of malcolm.core.models.NTUnion

class malcolm.modules.scanning.util.DatasetTable(name: Union[Anno(name='ADatasetNames', typ=<class 'str'>, description='Dataset names'), Sequence[str]], filename: Union[Anno(name='AFilenames', typ=<class 'str'>, description='Filenames of HDF files relative to fileDir'), Sequence[str]], type: Union[Anno(name='ADatasetTypes', typ=<enum 'DatasetType'>, description='Types of dataset'), Sequence[malcolm.modules.scanning.infos.DatasetType]], rank: Union[Anno(name='ARanks', typ=<class 'numpy.int32'>, description='Rank (number of dimensions) of the dataset'), Sequence[numpy.int32]], path: Union[Anno(name='APaths', typ=<class 'str'>, description='Dataset paths within HDF files'), Sequence[str]], uniqueid: Union[Anno(name='AUniqueIDs', typ=<class 'str'>, description='UniqueID array paths within HDF files'), Sequence[str]])[source]
Parameters
  • name (str) – Dataset names

  • filename (str) – Filenames of HDF files relative to fileDir

  • type (DatasetType) – Types of dataset

  • rank (int32) – Rank (number of dimensions) of the dataset

  • path (str) – Dataset paths within HDF files

  • uniqueid (str) – UniqueID array paths within HDF files

class malcolm.modules.scanning.util.DetectorTable(enable: Union[Anno(name='AEnable', typ=<class 'bool'>, description='Whether the detectors are enabled or not'), Sequence[bool]], name: Union[Anno(name='ADetectorNames', typ=<class 'str'>, description='Detector names'), Sequence[str]], mri: Union[Anno(name='ADetectorMris', typ=<class 'str'>, description='Detector block mris'), Sequence[str]], exposure: Union[Anno(name='AExposures', typ=<class 'float'>, description='Exposure of each detector frame for the current scan'), Sequence[float]], framesPerStep: Union[Anno(name='AFramesPerStep', typ=<class 'numpy.int32'>, description='Number of detector frames for each generator point'), Sequence[numpy.int32]])[source]
Parameters
  • enable (bool) – Whether the detectors are enabled or not

  • name (str) – Detector names

  • mri (str) – Detector block mris

  • exposure (float) – Exposure of each detector frame for the current scan

  • framesPerStep (int32) – Number of detector frames for each generator point

class malcolm.modules.scanning.util.RunnableStates[source]

This state set covers controllers and parts that can be configured and then run, and have the ability to pause and rewind

digraph { newrank=true; // Sensible ranking of clusters bgcolor=transparent compound=true rankdir=LR node [fontname=Arial fontsize=10 shape=rect style=filled fillcolor="#8BC4E9"] graph [fontname=Arial fontsize=11] edge [fontname=Arial fontsize=10 arrowhead=vee] Fault [fillcolor="#F03232"] Disabled [fillcolor="#AAAAAA"] subgraph cluster_normal { subgraph cluster_abortable { Ready [fillcolor="#BBE7BB"] Ready -> Configuring [label="configure()" weight=30] Ready -> Saving [label="save()"] Saving -> Ready [weight=0] Ready -> Loading [label="put\ndesign"] Loading -> Ready [weight=0] Armed [fillcolor="#BBE7BB"] Configuring -> Armed Armed -> Running [label="run()"] Armed -> Seeking [label="put\nsteps"] Running -> PostRun Running -> Seeking [label="pause()"] PostRun -> Finished PostRun -> Armed PostRun -> Seeking [label="pause()"] Finished [fillcolor="#BBE7BB"] Finished -> Seeking [label="pause()"] Finished -> Configuring [label="configure()" weight=30] Seeking -> Armed Seeking -> Paused Paused -> Seeking [label="put\nsteps"] Paused -> Running [label="resume()"] } Aborted [fillcolor="#FFBE89"] Resetting -> Ready Seeking -> Aborting [ltail=cluster_abortable label="abort()"] Aborting -> Aborted Aborted -> Resetting [label="reset()"] Armed -> Resetting [label="reset()"] Finished -> Resetting [label="reset()"] } Aborted -> Disabling [ltail=cluster_normal label="disable()"] Aborted -> Fault [ltail=cluster_normal label="on_error"] Fault -> Resetting [label="reset()"] Fault -> Disabling [label="disable()"] Disabling -> Fault [label="on_error"] Disabling -> Disabled Disabled -> Resetting [label="reset()"] {rank=min Ready Resetting Fault} {rank=same Loading Saving Configuring} {rank=same Armed Seeking Finished Aborted Disabling} {rank=max Paused Running PostRun Aborting Disabled} label="Unlabelled transitions take place in response to internal actions\n Labelled transitions are triggered externally."; labelloc=bottom; }