malcolm.modules.scanning.parts

class malcolm.modules.scanning.parts.AttributePreRunPart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'), mri: Anno(name='AMri', typ=<class 'str'>, description='Malcolm resource id of child object'), pre_run_value: Anno(name='APreRunVal', typ=<class 'str'>, description='Value to set during PreRunHook'), reset_value: Anno(name='AResetVal', typ=<class 'str'>, description='Value to set after a scan'), attribute_name: Anno(name='AAttrName', typ=<class 'str'>, description='Name of controlled attribute') = 'shutter')[source]

Part for controlling an attribute value during the PreRunHook

Parameters
  • name (str) – The name of the Part within the Controller

  • mri (str) – Malcolm resource id of child object

  • pre_run_value (str) – Value to set during PreRunHook

  • reset_value (str) – Value to set after a scan

  • attribute_name (str) – Name of controlled attribute

on_pre_run(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks')) None[source]
Parameters

context (Context) – Context that should be used to perform operations on child blocks

on_reset(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks')) None[source]
Parameters

context (Context) – Context that should be used to perform operations on child blocks

class malcolm.modules.scanning.parts.DatasetTablePart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'))[source]

Exposes an Attribute that reports the datasets that will be written during a scan

Parameters

name (str) – The name of the Part within the Controller

on_post_configure(part_info: Anno(name='APartInfo', typ=(<class 'str'>, annotypes._array.Array[malcolm.core.info.Info]), description='The Infos returned from other Parts')) None[source]
Parameters

part_info – The Infos returned from other Parts

class malcolm.modules.scanning.parts.DetectorChildPart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'), mri: Anno(name='AMri', typ=<class 'str'>, description='Malcolm resource id of child object'), initial_visibility: Anno(name='AInitialVisibility', typ=<class 'bool'>, description='Whether the part is initially visible with no config loaded, None means only if child Source/Sink Ports connect to another Block') = False, initial_frames_per_step: Anno(name='AInitialFramesPerStep', typ=<class 'int'>, description='The initial value of FramesPerStep for this detector at configure') = 1)[source]

Part controlling a child detector Block that exposes a configure/run interface with fileDir and fileTemplate

Parameters
  • name (str) – The name of the Part within the Controller

  • mri (str) – Malcolm resource id of child object

  • initial_visibility (bool) – Whether the part is initially visible with no config loaded, None means only if child Source/Sink Ports connect to another Block

  • initial_frames_per_step (int) – The initial value of FramesPerStep for this detector at configure

on_layout(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks'), ports: Anno(name='APortMap', typ=(<class 'str'>, annotypes._array.Array[malcolm.modules.builtin.infos.PortInfo]), description='The PortInfos for all the parts'), layout: Anno(name='ALayoutTable', typ=<class 'malcolm.modules.builtin.util.LayoutTable'>, description='A possibly partial set of changes to the layout table that should be acted on')) Optional[Union[Anno(name='ALayoutInfos', typ=<class 'malcolm.modules.builtin.infos.LayoutInfo'>, description='The current layout information'), Sequence[malcolm.modules.builtin.infos.LayoutInfo], malcolm.modules.builtin.infos.LayoutInfo]][source]
Parameters
  • context (Context) – Context that should be used to perform operations on child blocks

  • ports – The PortInfos for all the parts

  • layout (LayoutTable) – A possibly partial set of changes to the layout table that should be acted on

Returns

The current layout information

Return type

LayoutInfo

on_init(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks')) None[source]
Parameters

context (Context) – Context that should be used to perform operations on child blocks

on_reset(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks')) None[source]
Parameters

context (Context) – Context that should be used to perform operations on child blocks

on_validate(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks'), part_info: Anno(name='APartInfo', typ=(<class 'str'>, annotypes._array.Array[malcolm.core.info.Info]), description='The Infos returned from other Parts'), generator: Anno(name='AGenerator', typ=<class 'scanpointgenerator.core.compoundgenerator.CompoundGenerator'>, description='Generator instance providing specification for scan'), fileDir: Anno(name='AFileDir', typ=<class 'str'>, description='Directory to write data to'), detectors: Optional[Anno(name='ADetectorTable', typ=<class 'malcolm.modules.scanning.util.DetectorTable'>, description='The detectors that should be active and their exposures')] = None, axesToMove: Optional[Anno(name='AAxesToMove', typ=<class 'str'>, description='List of axes in inner dimension of generator that should be moved')] = None, breakpoints: Optional[Anno(name='ABreakpoints', typ=<class 'numpy.int32'>, description='List of points at which the run will return in Armed state')] = None, fileTemplate: Anno(name='AFileTemplate', typ=<class 'str'>, description='Printf style template to generate filename relative to fileDir.\nArguments are:\n  1) %s: the value of formatName') = '%s.h5') Optional[Union[Anno(name='AParameterTweakInfos', typ=<class 'malcolm.modules.scanning.infos.ParameterTweakInfo'>, description='Parameters that need to be changed to make them compatible'), Sequence[malcolm.modules.scanning.infos.ParameterTweakInfo], malcolm.modules.scanning.infos.ParameterTweakInfo]][source]
Parameters
  • context (Context) – Context that should be used to perform operations on child blocks

  • part_info – The Infos returned from other Parts

  • generator (CompoundGenerator) – Generator instance providing specification for scan

  • fileDir (str) – Directory to write data to

  • detectors (DetectorTable) – The detectors that should be active and their exposures

  • 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

  • fileTemplate (str) – Printf style template to generate filename relative to fileDir. Arguments are: 1) %s: the value of formatName

Returns

Parameters that need to be changed to make them compatible

Return type

ParameterTweakInfo

on_configure(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks'), generator: Anno(name='AGenerator', typ=<class 'scanpointgenerator.core.compoundgenerator.CompoundGenerator'>, description='Generator instance providing specification for scan'), fileDir: Anno(name='AFileDir', typ=<class 'str'>, description='Directory to write data to'), detectors: Optional[Anno(name='ADetectorTable', typ=<class 'malcolm.modules.scanning.util.DetectorTable'>, description='The detectors that should be active and their exposures')] = None, axesToMove: Optional[Anno(name='AAxesToMove', typ=<class 'str'>, description='List of axes in inner dimension of generator that should be moved')] = None, breakpoints: Optional[Anno(name='ABreakpoints', typ=<class 'numpy.int32'>, description='List of points at which the run will return in Armed state')] = None, fileTemplate: Anno(name='AFileTemplate', typ=<class 'str'>, description='Printf style template to generate filename relative to fileDir.\nArguments are:\n  1) %s: the value of formatName') = '%s.h5') Optional[Union[Anno(name='AInfos', typ=<class 'malcolm.core.info.Info'>, description='Infos about current Part status to be passed to other parts'), Sequence[malcolm.core.info.Info], malcolm.core.info.Info]][source]
Parameters
  • context (Context) – Context that should be used to perform operations on child blocks

  • generator (CompoundGenerator) – Generator instance providing specification for scan

  • fileDir (str) – Directory to write data to

  • detectors (DetectorTable) – The detectors that should be active and their exposures

  • 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

  • fileTemplate (str) – Printf style template to generate filename relative to fileDir. Arguments are: 1) %s: the value of formatName

Returns

Infos about current Part status to be passed to other parts

Return type

Info

on_run(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks')) None[source]
Parameters

context (Context) – Context that should be used to perform operations on child blocks

on_post_run(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks')) None[source]
Parameters

context (Context) – Context that should be used to perform operations on child blocks

on_seek(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks'), completed_steps: Anno(name='ACompletedSteps', typ=<class 'int'>, description='Number of steps already completed')) None[source]
Parameters
  • context (Context) – Context that should be used to perform operations on child blocks

  • completed_steps (int) – Number of steps already completed

on_abort(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks')) None[source]
Parameters

context (Context) – Context that should be used to perform operations on child blocks

class malcolm.modules.scanning.parts.DirectoryMonitorPart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'), mri: Anno(name='AMri', typ=<class 'str'>, description='Malcolm resource id of child object'), error_on_fail: Anno(name='AErrorOnFail', typ=<class 'bool'>, description='Whether to raise a ValueError for a bad status') = True)[source]

Part for checking a directoryMonitor Manager is happy

Parameters
  • name (str) – The name of the Part within the Controller

  • mri (str) – Malcolm resource id of child object

  • error_on_fail (bool) – Whether to raise a ValueError for a bad status

check_directories(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks')) None[source]
Parameters

context (Context) – Context that should be used to perform operations on child blocks

class malcolm.modules.scanning.parts.DoubleTriggerPart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'), mri: Anno(name='AMri', typ=<class 'str'>, description='Malcolm resource id of child object'), initial_visibility: Anno(name='AInitialVisibility', typ=<class 'bool'>, description='Whether the part is initially visible with no config loaded, None means only if child Source/Sink Ports connect to another Block') = False)[source]

Part for informing a parent that it can have 2 triggers per step.

Parameters
  • name (str) – The name of the Part within the Controller

  • mri (str) – Malcolm resource id of child object

  • initial_visibility (bool) – Whether the part is initially visible with no config loaded, None means only if child Source/Sink Ports connect to another Block

on_report_status(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks')) Optional[Union[Anno(name='AInfos', typ=<class 'malcolm.core.info.Info'>, description='Infos about current Part status to be passed to other parts'), Sequence[malcolm.core.info.Info], malcolm.core.info.Info]][source]
Parameters

context (Context) – Context that should be used to perform operations on child blocks

Returns

Infos about current Part status to be passed to other parts

Return type

Info

on_validate(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks'), detectors: Optional[Anno(name='ADetectorTable', typ=<class 'malcolm.modules.scanning.util.DetectorTable'>, description='The detectors that should be active and their exposures')] = None) None[source]
Parameters
  • context (Context) – Context that should be used to perform operations on child blocks

  • detectors (DetectorTable) – The detectors that should be active and their exposures

class malcolm.modules.scanning.parts.ExposureDeadtimePart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'), readout_time: Anno(name='AReadoutTime', typ=<class 'float'>, description='Subtract this time from frame duration when calculating exposure') = 0.0, frequency_accuracy: Anno(name='AAccuracy', typ=<class 'float'>, description='In ppm. Subtract duration*this/1e6 when calculating exposure') = 50.0, min_exposure: Anno(name='AMinExposure', typ=<class 'float'>, description='The minimum exposure time this detector will accept') = 0.0)[source]
Parameters
  • name (str) – The name of the Part within the Controller

  • readout_time (float) – Subtract this time from frame duration when calculating exposure

  • frequency_accuracy (float) – In ppm. Subtract duration*this/1e6 when calculating exposure

  • min_exposure (float) – The minimum exposure time this detector will accept

on_report_status() Optional[Union[Anno(name='AInfos', typ=<class 'malcolm.core.info.Info'>, description='Infos about current Part status to be passed to other parts'), Sequence[malcolm.core.info.Info], malcolm.core.info.Info]][source]
Returns

Infos about current Part status to be passed to other parts

Return type

Info

on_validate(generator: Anno(name='AGenerator', typ=<class 'scanpointgenerator.core.compoundgenerator.CompoundGenerator'>, description='Generator instance providing specification for scan'), exposure: Anno(name='AExposure', typ=<class 'float'>, description='The demand exposure time of this scan, 0 for the maximum possible') = 0.0, frames_per_step: Anno(name='ADetectorFramesPerStep', typ=<class 'int'>, description='Frames per detector step') = 1) Optional[Union[Anno(name='AInfos', typ=<class 'malcolm.core.info.Info'>, description='Infos about current Part status to be passed to other parts'), Sequence[malcolm.core.info.Info], malcolm.core.info.Info]][source]
Parameters
  • generator (CompoundGenerator) – Generator instance providing specification for scan

  • exposure (float) – The demand exposure time of this scan, 0 for the maximum possible

  • frames_per_step (int) – Frames per detector step

Returns

Infos about current Part status to be passed to other parts

Return type

Info

on_configure(exposure: Anno(name='AExposure', typ=<class 'float'>, description='The demand exposure time of this scan, 0 for the maximum possible') = 0.0) None[source]
Parameters

exposure (float) – The demand exposure time of this scan, 0 for the maximum possible

class malcolm.modules.scanning.parts.MinTurnaroundPart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller') = 'minTurnaround', gap: Optional[Anno(name='AMinTurnaround', typ=<class 'float'>, description='Initial value for min time between non-joined points')] = None, interval: Optional[Anno(name='ATurnaroundInterval', typ=<class 'float'>, description='Minimum interval between turnaround points')] = None)[source]
Parameters
  • name (str) – The name of the Part within the Controller

  • gap (float) – Initial value for min time between non-joined points

  • interval (float) – Minimum interval between turnaround points

on_report_status() Optional[Union[Anno(name='AInfos', typ=<class 'malcolm.core.info.Info'>, description='Infos about current Part status to be passed to other parts'), Sequence[malcolm.core.info.Info], malcolm.core.info.Info]][source]
Returns

Infos about current Part status to be passed to other parts

Return type

Info

class malcolm.modules.scanning.parts.ScanRunnerPart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'), mri: Anno(name='AMri', typ=<class 'str'>, description='Malcolm resource id of child object'))[source]

Used to run sets of scans defined in a YAML file with a scan block

Parameters
  • name (str) – The name of the Part within the Controller

  • mri (str) – Malcolm resource id of child object

abort(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks')) None[source]
Parameters

context (Context) – Context that should be used to perform operations on child blocks

run(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks')) None[source]
Parameters

context (Context) – Context that should be used to perform operations on child blocks

class malcolm.modules.scanning.parts.SimultaneousAxesPart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller') = 'simultaneousAxes', value: Optional[Union[Anno(name='ASimultaneousAxes', typ=<class 'str'>, description='Initial value for set of axes that can be moved at the same time'), Sequence[str], str]] = None)[source]
Parameters
  • name (str) – The name of the Part within the Controller

  • value (str) – Initial value for set of axes that can be moved at the same time

on_validate(axesToMove: Anno(name='AAxesToMove', typ=<class 'str'>, description='List of axes in inner dimension of generator that should be moved')) None[source]
Parameters

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

class malcolm.modules.scanning.parts.UnrollingPart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'), mri: Anno(name='AMri', typ=<class 'str'>, description='The Malcolm Resource Identifier for the Block produced'), initial_visibility: Optional[Anno(name='AInitialVisibility', typ=<class 'bool'>, description='Whether the part is initially visible with no config loaded, None means only if child Source/Sink Ports connect to another Block')] = None, stateful: Anno(name='AStateful', typ=<class 'bool'>, description='If the child is a StatefulController then this should be True') = False)[source]

Unroll the dimensions described by axesToMove into one long line by inserting a SquashingExcluder into the generator. This is used for instance in Odin to unroll a snake scan into a long line so the VDS is performant

Parameters
  • name (str) – The name of the Part within the Controller

  • mri (str) – The Malcolm Resource Identifier for the Block produced

  • initial_visibility (bool) – Whether the part is initially visible with no config loaded, None means only if child Source/Sink Ports connect to another Block

  • stateful (bool) – If the child is a StatefulController then this should be True

on_validate(generator: Anno(name='AGenerator', typ=<class 'scanpointgenerator.core.compoundgenerator.CompoundGenerator'>, description='Generator instance providing specification for scan'), axesToMove: Anno(name='AAxesToMove', typ=<class 'str'>, description='List of axes in inner dimension of generator that should be moved')) Optional[Union[Anno(name='AParameterTweakInfos', typ=<class 'malcolm.modules.scanning.infos.ParameterTweakInfo'>, description='Parameters that need to be changed to make them compatible'), Sequence[malcolm.modules.scanning.infos.ParameterTweakInfo], malcolm.modules.scanning.infos.ParameterTweakInfo]][source]
Parameters
  • generator (CompoundGenerator) – Generator instance providing specification for scan

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

Returns

Parameters that need to be changed to make them compatible

Return type

ParameterTweakInfo