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_block
within aManagerController
- Parameters
- 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
- 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
Attribute
with zero and incrementMethod
objects- Parameters
name (str) – The name of the Part within the Controller
- counter: Optional[malcolm.core.models.AttributeModel] = None
Writeable Attribute holding the current counter value
- delta: Optional[malcolm.core.models.AttributeModel] = None
Writeable Attribute holding the amount to increment() by
- 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
- 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=<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'), 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') 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]
On
ConfigureHook
create HDF file with datasets- Parameters
completed_steps (int) – Number of steps already completed
steps_to_do (int) – Number of steps we should configure for
generator (CompoundGenerator) – 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
RunHook
record where to next take data- Parameters
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
,PostRunArmedHook
record where to next take data
- 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
Method
objects on aBlock
- Parameters
name (str) – The name of the Part within the Controller
- 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>
- 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_block
within aRunnableController
- 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
stateful (bool) – If the child is a StatefulController then this should be True
- 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=<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'), 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 (CompoundGenerator) – 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