standard

This is the standard macro module

class ct(*args, **kwargs)[source]

Count for the specified time on the measurement group or experimental channel given as second argument (if not given the active measurement group is used)

hints = {'allowsHooks': ('pre-acq', 'post-acq')}

Hints to give a client to perform special tasks. Example: scan macros give hints on the types of hooks they support. A GUI can use this information to allow a scan to have sub-macros executed as hooks.

param_def = [['integ_time', 'Float', 1.0, 'Integration time'], ['countable_elem', 'Countable', {'___optional_parameter__': True}, 'Countable element e.g. MeasurementGroup or ExpChannel']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(integ_time, countable_elem)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class mstate(*args, **kwargs)[source]

Prints the state of a motor

param_def = [['motor', 'Moveable', None, 'Motor to check state']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(motor)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class mv(*args, **kwargs)[source]

Move motor(s) to the specified position(s)

hints = {'allowsHooks': ('pre-move', 'post-move')}

Hints to give a client to perform special tasks. Example: scan macros give hints on the types of hooks they support. A GUI can use this information to allow a scan to have sub-macros executed as hooks.

param_def = [['motor_pos_list', [['motor', 'Moveable', None, 'Motor to move'], ['pos', 'Float', None, 'Position to move to']], None, 'List of motor/position pairs']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(motor_pos_list)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class mvr(*args, **kwargs)[source]

Move motor(s) relative to the current position(s)

hints = {'allowsHooks': ('pre-move', 'post-move')}

Hints to give a client to perform special tasks. Example: scan macros give hints on the types of hooks they support. A GUI can use this information to allow a scan to have sub-macros executed as hooks.

param_def = [['motor_disp_list', [['motor', 'Moveable', None, 'Motor to move'], ['disp', 'Float', None, 'Relative displacement']], None, 'List of motor/displacement pairs']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(motor_disp_list)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class pwa(*args, **kwargs)[source]

Show all motor positions in a pretty table

param_def = [['filter', [['filter', 'String', '.*', 'a regular expression filter'], {'min': 1}], ['.*'], 'a regular expression filter']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(filter)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class pwm(*args, **kwargs)[source]

Show the position of the specified motors in a pretty table

param_def = [['motor_list', [['motor', 'Moveable', None, 'Motor to move']], None, 'List of motor to show']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(motor_list)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class repeat(*args, **kwargs)[source]

This macro executes as many repetitions of a set of macros as specified by nr parameter. The macros to be repeated can be given as parameters or as body hooks. If both are given first will be executed the ones given as parameters and then the ones given as body hooks. If nr has negative value, repetitions will be executed until you stop repeat macro.

Note

The repeat macro has been included in Sardana on a provisional basis. Backwards incompatible changes (up to and including removal of the macro) may occur if deemed necessary by the core developers.

hints = {'allowsHooks': ('body',)}

Hints to give a client to perform special tasks. Example: scan macros give hints on the types of hooks they support. A GUI can use this information to allow a scan to have sub-macros executed as hooks.

param_def = [['nr', 'Integer', None, 'Nr of iterations'], ['macro_name_params', [['token', 'String', None, 'Macro name and parameters (if any)'], {'min': 0}], None, 'List with macro name and parameters (if any)']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
prepare(nr, macro_name_params)[source]

Macro API. Prepare phase. Overwrite as necessary. Default implementation does nothing

run(nr, macro_name_params)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class set_user_lim(*args, **kwargs)[source]

Sets the user limits on the specified motor

param_def = [['motor', 'Moveable', None, 'Motor name'], ['low', 'Float', None, 'lower user limit'], ['high', 'Float', None, 'upper user limit']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(motor, low, high)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class set_dial_lim(*args, **kwargs)[source]

Sets the dial limits on the specified motor

param_def = [['motor', 'Motor', None, 'Motor name'], ['low', 'Float', None, 'lower dial limit'], ['high', 'Float', None, 'upper dial limit']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(motor, low, high)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class set_lim(*args, **kwargs)[source]

Deprecated: Sets the user limits on the specified motor

prepare(motor, low, high)[source]

Macro API. Prepare phase. Overwrite as necessary. Default implementation does nothing

class set_lm(*args, **kwargs)[source]

Deprecated: Sets the dial limits on the specified motor

prepare(motor, low, high)[source]

Macro API. Prepare phase. Overwrite as necessary. Default implementation does nothing

class set_dial_pos(*args, **kwargs)[source]

Sets the USER position of the motor to the specified value (by changing DIAL and keeping OFFSET).

param_def = [['motor', 'Motor', None, 'Motor name'], ['pos', 'Float', None, 'Position to move to']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(motor, pos)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class set_pos(*args, **kwargs)[source]

Deprecated: Sets the dial position on the specified motor

prepare(motor, pos)[source]

Macro API. Prepare phase. Overwrite as necessary. Default implementation does nothing

class set_user_pos(*args, **kwargs)[source]

Sets the USER position of the motor to the specified value (by changing OFFSET and keeping DIAL) and recalculates the USER limits (can be disabled with the update_limit parameter).

param_def = [['motor', 'Motor', None, 'Motor name'], ['pos', 'Float', None, 'Position to move to'], ['update_limit', 'Boolean', True, 'Update the software limit, enabled by default']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(motor, pos, update_limit)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class set_step_per_unit(*args, **kwargs)[source]

Set the step_per_unit defined by user. Macro allows to update limits (user and dial) depending on update_limits value.

param_def = [['motor', 'Moveable', None, 'Motor to update steps_per_unit.'], ['step_per_unit', 'Float', None, 'New step per unit to be applied.'], ['update_limits', 'Boolean', False, 'Update limits.']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(motor, step_per_unit, update_limits)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class sleep(*args, **kwargs)[source]

This macro waits for a time amount specified by dtime parameter (in seconds). In contrary to Python time.sleep(dtime) this macro execution can by interrupted (stopped or aborted).

param_def = [['dtime', 'Float', 0, 'Sleep time in seconds']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(dtime)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class uct(*args, **kwargs)[source]

Count on the active measurement group and update

param_def = [['integ_time', 'Float', 1.0, 'Integration time'], ['countable_elem', 'Countable', {'___optional_parameter__': True}, 'Countable element e.g. MeasurementGroup or ExpChannel']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
prepare(integ_time, countable_elem, **opts)[source]

Macro API. Prepare phase. Overwrite as necessary. Default implementation does nothing

run(integ_time, countable_elem)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class umv(*args, **kwargs)[source]

Move motor(s) to the specified position(s) and update

hints = {'allowsHooks': ('pre-move', 'post-move')}

Hints to give a client to perform special tasks. Example: scan macros give hints on the types of hooks they support. A GUI can use this information to allow a scan to have sub-macros executed as hooks.

param_def = [['motor_pos_list', [['motor', 'Moveable', None, 'Motor to move'], ['pos', 'Float', None, 'Position to move to']], None, 'List of motor/position pairs']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
prepare(motor_pos_list, **opts)[source]

Macro API. Prepare phase. Overwrite as necessary. Default implementation does nothing

run(motor_pos_list)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class umvr(*args, **kwargs)[source]

Move motor(s) relative to the current position(s) and update

hints = {'allowsHooks': ('pre-move', 'post-move')}

Hints to give a client to perform special tasks. Example: scan macros give hints on the types of hooks they support. A GUI can use this information to allow a scan to have sub-macros executed as hooks.

param_def = [['motor_disp_list', [['motor', 'Moveable', None, 'Motor to move'], ['disp', 'Float', None, 'Relative displacement']], None, 'List of motor/displacement pairs']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(motor_disp_list)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class wa(*args, **kwargs)[source]

Show all motor positions

param_def = [['filter', [['filter', 'String', '.*', 'a regular expression filter'], {'min': 1}], ['.*'], 'a regular expression filter']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
prepare(filter, **opts)[source]

Macro API. Prepare phase. Overwrite as necessary. Default implementation does nothing

run(filter)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class wm(*args, **kwargs)[source]

Show the position of the specified motors.

param_def = [['motor_list', [['motor', 'Moveable', None, 'Motor to see where it is']], None, 'List of motor to show']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
static format_value(fmt, str_fmt, value)[source]

Formats given value following the fmt and/or str_fmt rules.

Parameters

fmtstr

The value format.

str_fmtstr

The string format.

valuefloat

The value to be formatted.

Returns

str

The string formatted value.

prepare(motor_list, **opts)[source]

Macro API. Prepare phase. Overwrite as necessary. Default implementation does nothing

run(motor_list)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class tw(*args, **kwargs)[source]

Tweak motor by variable delta

param_def = [['motor', 'Moveable', 'test', 'Motor to move'], ['delta', 'Float', None, 'Amount to tweak']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(motor, delta)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class logmacro(*args, **kwargs)[source]

Turn on/off logging of the spock output.

Note

The logmacro class has been included in Sardana on a provisional basis. Backwards incompatible changes (up to and including its removal) may occur if deemed necessary by the core developers

param_def = [['offon', 'Boolean', None, 'Unset/Set logging'], ['mode', 'Integer', -1, 'Mode: 0 append, 1 new file']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(offon, mode)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class newfile(*args, **kwargs)[source]

Sets the ScanDir and ScanFile as well as ScanID in the environment.

If ScanFilePath is only a file name, the ScanDir must be set externally via senv ScanDir or using the %expconf. Otherwise, the path in ScanFilePath must be absolute and existing on the MacroServer host.

The ScanID should be set to the value before the upcoming scan number. Default value is 0.

hints = {'allowsHooks': ('post-newfile',)}

Hints to give a client to perform special tasks. Example: scan macros give hints on the types of hooks they support. A GUI can use this information to allow a scan to have sub-macros executed as hooks.

param_def = [['ScanFilePath_list', [['ScanFilePath', 'String', None, '(ScanDir/)ScanFile']], None, 'List of (ScanDir/)ScanFile'], ['ScanID', 'Integer', 0, 'Scan ID']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(ScanFilePath_list, ScanID)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class plotselect(*args, **kwargs)[source]

select channels for plotting in the active measurement group

env = ('ActiveMntGrp',)

a set of mandatory environment variable names without which your macro cannot run

param_def = [['channel', [['channel', 'ExpChannel', 'None', ''], {'min': 0}], None, 'List of channels to plot']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(channel)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class pic(*args, **kwargs)[source]

This macro moves a motor of the last scan to its PEAK position for a given channel. If no channel is given, it selects the first channel from the ScanStats env variable. If no motor is given, it selects the first/only motor from the ScanStats env variable.

param_def = [['channel', 'ExpChannel', {'___optional_parameter__': True}, 'name of channel'], ['motor', 'Moveable', {'___optional_parameter__': True}, 'name of motor']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(channel, motor)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class cen(*args, **kwargs)[source]

This macro moves a motor of the last scan to its CEN position for a given channel. If no channel is given, it selects the first channel from the ScanStats env variable.

param_def = [['channel', 'ExpChannel', {'___optional_parameter__': True}, 'name of channel'], ['motor', 'Moveable', {'___optional_parameter__': True}, 'name of motor']]

This property holds the macro parameter description. It consists of a sequence of parameter information objects. A parameter information object is either:

  1. a simple parameter object

  2. a parameter repetition object

A simple parameter object is a sequence of:

  1. a string representing the parameter name

  2. a member of Macro.Type representing the parameter data type

  3. a default value for the parameter or None if there is no default value

  4. a string with the parameter description

Example:

param_def = ( ('value', Type.Float, None, 'a float parameter' ) )

A parameter repetition object is a sequence of:

  1. a string representing the parameter repetition name

  2. a sequence of parameter information objects

  3. a dictionary representing the parameter repetition semantics or None to use the default parameter repetition semantics. Dictionary keys are:

    • min - integer representing minimum number of repetitions or None for no minimum.

    • max - integer representing maximum number of repetitions or None for no maximum.

    Default parameter repetition semantics is { 'min': 1, 'max' : None } (in other words, “at least one repetition” semantics)

Example:

param_def = (
    ( 'motor_list', ( ( 'motor', Type.Motor, None, 'motor name') ), None, 'List of motors')
)
run(channel, motor)[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError

class where(*args, **kwargs)[source]

This macro shows the current position of the last scanned motor.

env = ('ScanStats',)

a set of mandatory environment variable names without which your macro cannot run

run()[source]

Macro API. Runs the macro. Overwrite MANDATORY! Default implementation raises RuntimeError.

Raises:

RuntimeError