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
setup(registrar: malcolm.core.part.PartRegistrar) → None[source]

Use the given PartRegistrar to populate the hooks and fields. This function is called for all parts in a block when the block’s Controller is added to a Process

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
setup(registrar: malcolm.core.part.PartRegistrar) → None[source]

Use the given PartRegistrar to populate the hooks and fields. This function is called for all parts in a block when the block’s Controller is added to a Process

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
setup(registrar)[source]

Use the given PartRegistrar to populate the hooks and fields. This function is called for all parts in a block when the block’s Controller is added to a Process

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')) → 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, None][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

notify_dispatch_request(request: malcolm.core.request.Request) → None[source]

Will be called when a context passed to a hooked function is about to dispatch a request

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=<MagicMock name='mock.CompoundGenerator' id='139916666047248'>, description='Generator instance providing specification for scan'), fileDir: Anno(name='AFileDir', typ=<class 'str'>, description='Directory to write data to'), detectors: Anno(name='ADetectorTable', typ=<class 'malcolm.modules.scanning.util.DetectorTable'>, description='The detectors that should be active and their exposures') = None, axesToMove: Anno(name='AAxesToMove', typ=<class 'str'>, description='List of axes in inner dimension of generator that should be moved') = None, breakpoints: 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') → 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, None][source]
Parameters:
  • context (Context) – Context that should be used to perform operations on child blocks
  • part_info – The Infos returned from other Parts
  • generator – 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=<MagicMock name='mock.CompoundGenerator' id='139916666047248'>, description='Generator instance providing specification for scan'), fileDir: Anno(name='AFileDir', typ=<class 'str'>, description='Directory to write data to'), detectors: Anno(name='ADetectorTable', typ=<class 'malcolm.modules.scanning.util.DetectorTable'>, description='The detectors that should be active and their exposures') = None, axesToMove: Anno(name='AAxesToMove', typ=<class 'str'>, description='List of axes in inner dimension of generator that should be moved') = None, breakpoints: 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') → 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, None][source]
Parameters:
  • context (Context) – Context that should be used to perform operations on child blocks
  • generator – 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
setup(registrar: malcolm.core.part.PartRegistrar) → None[source]

Use the given PartRegistrar to populate the hooks and fields. This function is called for all parts in a block when the block’s Controller is added to a Process

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.ExposureDeadtimePart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'), initial_readout_time: Anno(name='AInitialReadoutTime', typ=<class 'float'>, description='Subtract this time from frame duration when calculating exposure') = 0.0, initial_frequency_accuracy: Anno(name='AInitialAccuracy', 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
  • initial_readout_time (float) – Subtract this time from frame duration when calculating exposure
  • initial_frequency_accuracy (float) – In ppm. Subtract duration*this/1e6 when calculating exposure
  • min_exposure (float) – The minimum exposure time this detector will accept
setup(registrar: malcolm.core.part.PartRegistrar) → None[source]

Use the given PartRegistrar to populate the hooks and fields. This function is called for all parts in a block when the block’s Controller is added to a Process

on_report_status() → 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, None][source]
Returns:Infos about current Part status to be passed to other parts
Return type:Info
on_validate(generator: Anno(name='AGenerator', typ=<MagicMock name='mock.CompoundGenerator' id='139916666047248'>, 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) → 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, None][source]
Parameters:
  • generator – Generator instance providing specification for scan
  • exposure (float) – The demand exposure time of this scan, 0 for the maximum possible
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: Anno(name='AMinTurnaround', typ=<class 'float'>, description='Initial value for min time between non-joined points') = None, interval: 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() → 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, None][source]
Returns:Infos about current Part status to be passed to other parts
Return type:Info
setup(registrar: malcolm.core.part.PartRegistrar) → None[source]

Use the given PartRegistrar to populate the hooks and fields. This function is called for all parts in a block when the block’s Controller is added to a Process

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
setup(registrar: malcolm.core.part.PartRegistrar) → None[source]

Use the given PartRegistrar to populate the hooks and fields. This function is called for all parts in a block when the block’s Controller is added to a Process

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: 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
setup(registrar: malcolm.core.part.PartRegistrar) → None[source]

Use the given PartRegistrar to populate the hooks and fields. This function is called for all parts in a block when the block’s Controller is added to a Process

class malcolm.modules.scanning.parts.UnrollingPart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'))[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
on_validate(generator: Anno(name='AGenerator', typ=<MagicMock name='mock.CompoundGenerator' id='139916666047248'>, 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')) → 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, None][source]
Parameters:
  • generator – 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

setup(registrar: malcolm.core.part.PartRegistrar) → None[source]

Use the given PartRegistrar to populate the hooks and fields. This function is called for all parts in a block when the block’s Controller is added to a Process