discrete

Discrete pseudo motor controller configuration related macros

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

Define a (calibrated) point for a discrete pseudomotor configuration.

The mandatory parameters to execute the macro are: pseudo, label and pos.

Two different scenarios exist: To define a new point or to modify an existing one. The controller protects from uploading repeated pos values.

If the point is new, the default dmin and dmax parameters are used to construct the calibration. If no set point is provided, the current physical position is used instead.

If the point already exists, the values are updated as in the previous case. However, if no dmin and dmax are provided, the previous calibration values for dmin and dmax are calculated and used to rebuild the calibration.

Note

The def_discr_pos 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.

param_def = [['pseudo', 'PseudoMotor', None, 'Discrete pseudomotor name.'], ['label', 'String', None, 'Label name.'], ['pos', 'Integer', None, 'Discrete (pseudo) position.'], ['set', 'Float', inf, 'Continuous position.'], ['dmin', 'Float', -inf, 'Delta increment used to define the minimum position.'], ['dmax', 'Float', inf, 'Delta increment used to define the maximum position.']]

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(pseudo, label, pos, setpos, dmin, dmax)[source]

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

Raises:

RuntimeError

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

Remove a point from a discrete pseudomotor configuration.

Note

The udef_discr_pos 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.

param_def = [['pseudo', 'PseudoMotor', None, 'Discrete pseudomotor name'], ['label', 'String', None, 'Label name']]

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(pseudo, label)[source]

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

Raises:

RuntimeError

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

Print discrete pseudomotor configuration.

Note

The prdef_discr_pos 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.

param_def = [['pseudo', 'PseudoMotor', None, 'Discrete pseudomotor name']]

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

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

Raises:

RuntimeError