malcolm.modules.scanning.controllers

class malcolm.modules.scanning.controllers.RunnableController(mri: Anno(name='AMri', typ=<class 'str'>, description='The Malcolm Resource Identifier for the Block produced'), config_dir: Anno(name='AConfigDir', typ=<class 'str'>, description='Directory to write save/load config to'), template_designs: Anno(name='ATemplateDesigns', typ=<class 'str'>, description='A directory of templates with which to initially populate designs Attribute. These cannot be saved over.') = '', initial_design: Anno(name='AInitialDesign', typ=<class 'str'>, description='Design to load at init') = '', description: Anno(name='ADescription', typ=<class 'str'>, description='Description of the Block produced by the controller') = '')[source]

RunnableDevice implementer that also exposes GUI for child parts

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

  • config_dir (str) – Directory to write save/load config to

  • template_designs (str) – A directory of templates with which to initially populate designs Attribute. These cannot be saved over.

  • initial_design (str) – Design to load at init

  • description (str) – Description of the Block produced by the controller

update_configure_params(part: Optional[malcolm.core.part.Part] = None, info: Optional[malcolm.modules.scanning.infos.ConfigureParamsInfo] = None) None[source]

Tell controller part needs different things passed to Configure

validate(generator: Anno(name='AGenerator', typ=<class 'scanpointgenerator.core.compoundgenerator.CompoundGenerator'>, description='Generator instance providing specification for scan'), 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, **kwargs: Any) -> Anno(name='AConfigureParams', typ=<class 'malcolm.modules.scanning.util.ConfigureParams'>, description='The validated configure parameters')[source]

Validate configuration parameters and return validated parameters.

Doesn’t take device state into account so can be run in any state

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

Returns

The validated configure parameters

Return type

ConfigureParams

configure(generator: Anno(name='AGenerator', typ=<class 'scanpointgenerator.core.compoundgenerator.CompoundGenerator'>, description='Generator instance providing specification for scan'), 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, **kwargs: Any) -> Anno(name='AConfigureParams', typ=<class 'malcolm.modules.scanning.util.ConfigureParams'>, description='The validated configure parameters')[source]

Validate the params then configure the device ready for run().

Try to prepare the device as much as possible so that run() is quick to start, this may involve potentially long running activities like moving motors.

Normally it will return in Armed state. If the user aborts then it will return in Aborted state. If something goes wrong it will return in Fault state. If the user disables then it will return in Disabled state.

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

Returns

The validated configure parameters

Return type

ConfigureParams

run() None[source]

Run a device where configure() has already be called

Normally it will return in Ready state. If setup for multiple-runs with a single configure() then it will return in Armed state. If the user aborts then it will return in Aborted state. If something goes wrong it will return in Fault state. If the user disables then it will return in Disabled state.

abort() None[source]

Abort the current operation and block until aborted

Normally it will return in Aborted state. If something goes wrong it will return in Fault state. If the user disables then it will return in Disabled state.

pause(lastGoodStep: Anno(name='ALastGoodStep', typ=<class 'int'>, description='Step to mark as the last completed step, -1 for current') = -1) None[source]

Pause a run() so that resume() can be called later, or seek within an Armed or Paused state.

The original call to run() will not be interrupted by pause(), it will wait until the scan completes or is aborted.

Normally it will return in Paused state. If the scan is finished it will return in Finished state. If the scan is armed it will return in Armed state. If the user aborts then it will return in Aborted state. If something goes wrong it will return in Fault state. If the user disables then it will return in Disabled state.

Parameters

lastGoodStep (int) – Step to mark as the last completed step, -1 for current

do_pause(completed_steps: int) None[source]

Recalculates the number of configured steps Arguments: completed_steps – Last good step performed

resume() None[source]

Resume a paused scan.

Normally it will return in Running state. If something goes wrong it will return in Fault state.