expert

Expert macros

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

Creates a new motor in the active pool

run(name, controller, axis)[source]

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

Raises:RuntimeError
class defmeas(*args, **kwargs)[source]

Create a new measurement group. First channel in channel_list MUST be an internal sardana channel. At least one channel MUST be a Counter/Timer (by default, the first Counter/Timer in the list will become the master).

prepare(name, channel_list, **opts)[source]

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

run(name, channel_list)[source]

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

Raises:RuntimeError
class udefmeas(*args, **kwargs)[source]

Deletes existing measurement groups

run(mntgrps)[source]

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

Raises:RuntimeError
class defelem(*args, **kwargs)[source]

Creates an element on a controller with an axis

run(name, ctrl, axis)[source]

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

Raises:RuntimeError
class udefelem(*args, **kwargs)[source]

Deletes existing elements

run(elements)[source]

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

Raises:RuntimeError
class defctrl(*args, **kwargs)[source]

Creates a new controller ‘role_prop’ is a sequence of roles and/or properties. - A role is defined as <role name>=<role value> (only applicable to pseudo controllers) - A property is defined as <property name> <property value>

If both roles and properties are supplied, all roles must come before properties. All controller properties that don’t have default values must be given.

Example of creating a motor controller (with a host and port properties):

[1]: defctrl SuperMotorController myctrl host homer.springfield.com port 5000

Example of creating a Slit pseudo motor (sl2t and sl2b motor roles, Gap and Offset pseudo motor roles):

[1]: defctrl Slit myslit sl2t=mot01 sl2b=mot02 Gap=gap01 Offset=offset01

run(ctrl_class, name, props)[source]

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

Raises:RuntimeError
class udefctrl(*args, **kwargs)[source]

Deletes existing controllers

run(controllers)[source]

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

Raises:RuntimeError
class send2ctrl(*args, **kwargs)[source]

Sends the given data directly to the controller

run(controller, data)[source]

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

Raises:RuntimeError
class edctrlcls(*args, **kwargs)[source]

Returns the contents of the library file which contains the given controller code.

run(ctrlclass)[source]

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

Raises:RuntimeError
class edctrllib(*args, **kwargs)[source]

Returns the contents of the given library file

run(filename)[source]

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

Raises:RuntimeError
class commit_ctrllib(*args, **kwargs)[source]

Puts the contents of the given data in a file inside the pool

run(filename, username, comment, filedata)[source]

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

Raises:RuntimeError
class prdef(*args, **kwargs)[source]

Returns the the macro code for the given macro name.

run(macro_data)[source]

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

Raises:RuntimeError
class relctrllib(*args, **kwargs)[source]

Reloads the given controller library code from the pool server filesystem.

run(ctrl_library)[source]

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

Raises:RuntimeError
class addctrllib(*args, **kwargs)[source]

Adds the given controller library code to the pool server filesystem.

run(ctrl_library_name)[source]

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

Raises:RuntimeError
class relctrlcls(*args, **kwargs)[source]

Reloads the given controller class code from the pool server filesystem.

run(ctrl_class)[source]

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

Raises:RuntimeError
class rellib(*args, **kwargs)[source]

Reloads the given python library code from the macro server filesystem.

Warning

use with extreme care! Accidentally reloading a system module or an installed python module may lead to unpredictable behavior

Warning

Prior to the Sardana version 1.6.0 this macro was successfully reloading python libraries located in the MacroPath. The MacroPath is not a correct place to locate your python libraries. They may be successfully loaded on the MacroServer startup, but this can not be guaranteed. In order to use python libraries within your macro code, locate them in either of valid system PYTHONPATH or MacroServer PythonPath property (of the host where MacroServer runs). In order to achieve the previous behavior, just configure the the same directory in both system PYTHONPATH (or MacroServer’s PythonPath) and MacroPath.

Note

if python module is used by any macro, don’t forget to reload the corresponding macros afterward so the changes take effect.

run(module_name)[source]

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

Raises:RuntimeError
class relmaclib(*args, **kwargs)[source]

Reloads the given macro library code from the macro server filesystem.

run(macro_library)[source]

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

Raises:RuntimeError
class addmaclib(*args, **kwargs)[source]

Loads a new macro library.

Warning

Keep in mind that macros from the new library can override macros already present in the system.

prepare(macro_library_name)[source]

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

run(macro_library_name)[source]

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

Raises:RuntimeError
class relmac(*args, **kwargs)[source]

Reloads the given macro code from the macro server filesystem. Attention: All macros inside the same file will also be reloaded.

run(macro_code)[source]

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

Raises:RuntimeError
class sar_info(*args, **kwargs)[source]

Prints details about the given sardana object

run(obj)[source]

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

Raises:RuntimeError