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)

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 mstate(*args, **kwargs)[source]

Prints the state of a motor

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)

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)

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

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

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.

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_lim(*args, **kwargs)[source]

Sets the software limits on the specified motor hello

run(motor, low, high)[source]

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

Raises

RuntimeError

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

Sets the dial limits on the specified motor

run(motor, low, high)[source]

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

Raises

RuntimeError

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

Sets the position of the motor to the specified value

run(motor, pos)[source]

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

Raises

RuntimeError

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).

run(motor, pos, update_limit)[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

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

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

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

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.

static format_value(fmt, str_fmt, value)[source]

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

Parameters
  • fmt (str) – The value format.

  • str_fmt (str) – The string format.

  • value (float) – The value to be formatted.

Returns

The string formatted value.

Return type

str

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

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

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.

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

run(channel)[source]

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

Raises

RuntimeError

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

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

run(channel)[source]

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

Raises

RuntimeError

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

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

run(channel)[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.

run()[source]

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

Raises

RuntimeError