malcolm.modules.demo.parts¶
-
class
malcolm.modules.demo.parts.CounterMovePart(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]¶ Provides control of a
counter_blockwithin aManagerControllerParameters: -
setup(registrar: malcolm.core.part.PartRegistrar) → None[source]¶ Use the given
PartRegistrarto populate the hooks and fields. This function is called for all parts in a block when the block’sControlleris added to aProcess
-
move(context: Anno(name='AContext', typ=<class 'malcolm.core.context.Context'>, description='Context that should be used to perform operations on child blocks'), demand: Anno(name='ADemand', typ=<class 'float'>, description='The demand value to move our counter motor to'), duration: Anno(name='ADuration', typ=<class 'float'>, description='The amount of time to get to the demand position') = 0) → None[source]¶ Move the counter to the demand value, taking duration seconds like a motor would do
Parameters:
-
-
class
malcolm.modules.demo.parts.CounterPart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'))[source]¶ Defines a counter
Attributewith zero and incrementMethodobjectsParameters: name (str) – The name of the Part within the Controller -
counter= None¶ Writeable Attribute holding the current counter value
-
delta= None¶ Writeable Attribute holding the amount to increment() by
-
setup(registrar: malcolm.core.part.PartRegistrar) → None[source]¶ Use the given
PartRegistrarto populate the hooks and fields. This function is called for all parts in a block when the block’sControlleris added to aProcess
-
-
class
malcolm.modules.demo.parts.FileWritePart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'), width: Anno(name='AWidth', typ=<class 'int'>, description='Width of detector image'), height: Anno(name='AHeight', typ=<class 'int'>, description='Height of detector image'))[source]¶ Minimal interface demonstrating a file writing detector part
Parameters: -
setup(registrar: malcolm.core.part.PartRegistrar) → None[source]¶ Use the given
PartRegistrarto populate the hooks and fields. This function is called for all parts in a block when the block’sControlleris added to aProcess
-
on_configure(completed_steps: Anno(name='ACompletedSteps', typ=<class 'int'>, description='Number of steps already completed'), steps_to_do: Anno(name='AStepsToDo', typ=<class 'int'>, description='Number of steps we should configure for'), 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'), exposure: Anno(name='AExposure', typ=<class 'float'>, description='The demand exposure time of this scan, 0 for the maximum possible') = 0.0, formatName: Anno(name='AFormatName', typ=<class 'str'>, description='Argument for fileTemplate, normally filename without extension') = 'det', 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]¶ On
ConfigureHookcreate HDF file with datasetsParameters: - completed_steps (int) – Number of steps already completed
- steps_to_do (int) – Number of steps we should configure for
- generator – Generator instance providing specification for scan
- fileDir (str) – Directory to write data to
- exposure (float) – The demand exposure time of this scan, 0 for the maximum possible
- formatName (str) – Argument for fileTemplate, normally filename without extension
- 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:
-
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]¶ On
RunHookrecord where to next take dataParameters: context (Context) – Context that should be used to perform operations on child blocks
-
on_seek(completed_steps: Anno(name='ACompletedSteps', typ=<class 'int'>, description='Number of steps already completed'), steps_to_do: Anno(name='AStepsToDo', typ=<class 'int'>, description='Number of steps we should configure for')) → None[source]¶ On
SeekHook,PostRunArmedHookrecord where to next take dataParameters:
-
-
class
malcolm.modules.demo.parts.HelloPart(name: Anno(name='APartName', typ=<class 'str'>, description='The name of the Part within the Controller'))[source]¶ Defines greet and error
Methodobjects on aBlockParameters: name (str) – The name of the Part within the Controller -
setup(registrar: malcolm.core.part.PartRegistrar) → None[source]¶ Use the given
PartRegistrarto populate the hooks and fields. This function is called for all parts in a block when the block’sControlleris added to aProcess
-
greet(name: Anno(name='AName', typ=<class 'str'>, description='The name of the person to greet'), sleep: Anno(name='ASleep', typ=<class 'float'>, description='Time to wait before returning') = 0) -> Anno(name='AGreeting', typ=<class 'str'>, description='The manufactured greeting')[source]¶ Optionally sleep <sleep> seconds, then return a greeting to <name>
Parameters: Returns: The manufactured greeting
Return type:
-
-
class
malcolm.modules.demo.parts.MotionChildPart(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: 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') = True)[source]¶ Provides control of a
counter_blockwithin aRunnableControllerParameters: - 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
- stateful (bool) – If the child is a StatefulController then this should be True
-
setup(registrar: malcolm.core.part.PartRegistrar) → None[source]¶ Use the given
PartRegistrarto populate the hooks and fields. This function is called for all parts in a block when the block’sControlleris added to aProcess
-
on_configure(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'), steps_to_do: Anno(name='AStepsToDo', typ=<class 'int'>, description='Number of steps we should configure for'), 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'), exceptionStep: Anno(name='AExceptionStep', typ=<class 'int'>, description='If >0, raise an exception at the end of this step') = 0) → None[source]¶ Parameters: - context (Context) – Context that should be used to perform operations on child blocks
- completed_steps (int) – Number of steps already completed
- steps_to_do (int) – Number of steps we should configure for
- generator – Generator instance providing specification for scan
- axesToMove (str) – List of axes in inner dimension of generator that should be moved
- exceptionStep (int) – If >0, raise an exception at the end of this step