pymodaq.control_modules.daq_move.DAQ_Move([...])

Main PyMoDAQ class to drive actuators

pymodaq.control_modules.daq_move.ActuatorWorker(...)

Worker class mediating between DAQ_Move and the actuator plugin instance.

pymodaq.control_modules.move_utility_classes.params

Built-in mutable sequence.

8.1.5. The DAQ_Move Class

This documentation highlights the useful entry and output points that you may use in your applications.

class pymodaq.control_modules.daq_move.DAQ_Move(parent=None, title='DAQ Move', ui_identifier=None, **kwargs)[source]

Main PyMoDAQ class to drive actuators

Qt object and generic UI to drive actuators.

Variables:
  • move_done_signal (pyqtSignal, DataActuator]) – This signal is emitted when the chosen actuator finished its action. It gives the actuator’s name and current value

  • bounds_signal (pyqtSignal) – This signal is emitted when the actuator reached defined limited boundaries.

See also

ControlModule, ParameterManager

Attributes:
actuator

str: the selected actuator’s type

move_done_bool

bool: status of the actuator’s status (done or not)

Methods

get_actuator_value([send_to_leco])

Get the current actuator value via the "get_actuator_value" command send to the hardware

get_continuous_actuator_value([get_value])

Start the continuous getting of the actuator's value

grab()

move(move_command)

Generic method to trigger the correct action on the actuator

move_abs(value[, send_to_leco])

Move the connected hardware to the absolute value

move_home([send_to_leco])

Move the connected actuator to its home value (if any)

move_rel(rel_value[, send_to_leco])

Move the connected hardware to the relative value

stop_motion()

Stop any motion

thread_status(status)

Get back info (using the ThreadCommand object) from the hardware

get_actuator_value(send_to_leco=False)[source]

Get the current actuator value via the “get_actuator_value” command send to the hardware

Returns nothing but the move_done_signal will be send once the action is done :type send_to_leco: bool :param send_to_leco: if True, this position is send through the LECO communication canal :type send_to_leco: bool

get_continuous_actuator_value(get_value=True)[source]

Start the continuous getting of the actuator’s value

Parameters:

get_value (bool) – if True start the timer to periodically fetch the actuator’s value, else stop it

Notes

The current timer period is set by the refresh value ‘refresh_timeout’ in the actuator main settings.

init_hardware_ui(do_init=True)

Programmatic entry to simulate a click on the user interface init button

Parameters:

do_init (bool) – if True initialize the selected hardware else deinitialize it

Notes

This method should be preferred to init_hardware()

move(move_command)[source]

Generic method to trigger the correct action on the actuator

Parameters:

move_command (MoveCommand) – MoveCommand with move_type attribute either: * ‘abs’: performs an absolute action * ‘rel’: performs a relative action * ‘home’: find the actuator’s home

See also

move_abs(), move_rel(), move_home(), utility_classes.MoveCommand

move_abs(value, send_to_leco=False)[source]

Move the connected hardware to the absolute value

Returns nothing but the move_done_signal will be send once the action is done

Parameters:
  • value (Union[DataActuator, Number]) – The value the actuator should reach

  • send_to_leco (bool) – if True, this position is send through the LECO communication canal

move_home(send_to_leco=False)[source]

Move the connected actuator to its home value (if any)

Parameters:

send_to_leco (bool) – if True, this position is send through the LECO communication canal

move_rel(rel_value, send_to_leco=False)[source]

Move the connected hardware to the relative value

Returns nothing but the move_done_signal will be send once the action is done

Parameters:
  • value (float) – The relative value the actuator should reach

  • send_to_leco (bool) – if True, this position is send through the LECO communication canal

quit_fun()

Programmatic quitting: deinit hardware, emit quit signal, run cleanup hook, close UI.

stop_motion()[source]

Stop any motion

thread_status(status)[source]

Get back info (using the ThreadCommand object) from the hardware

And re-emit this ThreadCommand using the custom_sig signal if it should be used in a higher level module

Commands valid for all control modules are defined in the parent class, here are described only the specific ones

Parameters:

status (ThreadCommand) –

Possible values are:

  • ini_stage: obtains info from the initialization

  • get_actuator_value: update the UI current value

  • move_done: update the UI current value and emits the move_done signal

  • outofbounds: emits the bounds_signal signal with a True argument

  • set_allowed_values: used to change the behaviour of the spinbox controlling absolute values (see daq_move_ui.set_abs_spinbox_properties()

  • stop: stop the motion

property actuator

the selected actuator’s type

Type:

str

property initialized_state

Check if the module is initialized

Type:

bool

property move_done_bool

status of the actuator’s status (done or not)

Type:

bool

8.1.6. The DAQ_Move UI class

This object is the User Interface of the DAQ_Viewer, allowing easy access to all of the DAQ_Viewer functionnalities in a generic interface.

class pymodaq.control_modules.daq_move_ui.ui_base.DAQMoveUI(app, parent, title='DAQ_Move', controls_dock=None, settings_dock=None)[source]

DAQ_Move user interface.

This class manages the UI and emit dedicated signals depending on actions from the user

Variables:

command_sig (pyqtSignal) –

This signal is emitted whenever some actions done by the user has to be applied on the main module. Possible commands are:

  • init

  • get_value

  • loop_get_value

  • find_home

  • stop

  • move_abs

  • move_rel

  • actuator_changed

  • rel_value

  • show_plugin_config

Methods:
  • display_value(value (float)) – Update the display of the actuator’s value on the UI

  • do_init() – Programmatic init

See also

pymodaq.utils.daq_utils.ThreadCommand

Attributes:
actuator
actuator_init
actuators
move_done

bool: True when the actuator is idle (not moving).

Methods

close()

connect_things()

do_init([do_init])

Programmatically press the Init button API entry :type do_init: bool :param do_init: will fire the Init button depending on the argument value and the button check state :type do_init: bool

quit_fun()

send_init(checked)

set_abs_spinbox_properties(**properties)

Change the Spinbox properties

set_ui_type(ui_type)

Called after initialization to finalize the UI setup given the chosen UI type

set_unit_as_suffix(unit)

Will append the actuator units in the value display

set_unit_prefix([show])

Change the display status of the spinbox SI prefix

setup_actions([toolbar])

setup_docks_and_widgets()

setup_menus_and_toolbars([menubar])

cleanup_ui

connect_common_move_actions

connect_move_actions

display_value

emit_move_abs

emit_move_rel

enable_move_buttons

populate_control_ui

remove_absolute_actions

remove_absolute_spinbox_actions

remove_relative_actions

set_abs_value

set_abs_value_green

set_abs_value_red

set_rel_value

set_relative_value

set_settings_tree

setup_absolute_actions

setup_absolute_spinbox_actions

setup_relative_actions

show_controls

show_data

show_graph

do_init(do_init=True)[source]

Programmatically press the Init button API entry :type do_init: bool :param do_init: will fire the Init button depending on the argument value and the button check state :type do_init: bool

set_abs_spinbox_properties(**properties)[source]

Change the Spinbox properties

Parameters:

properties (dict or named parameters) –

possible keys are :

  • decimals: to set the number of displayed decimals

  • ’minimum’: to set the minimum value

  • ’maximum’: to set the maximum value

  • ’step’: to set the step value

set_ui_type(ui_type)[source]

Called after initialization to finalize the UI setup given the chosen UI type

set_unit_as_suffix(unit)[source]

Will append the actuator units in the value display

set_unit_prefix(show=True)[source]

Change the display status of the spinbox SI prefix

property move_done

True when the actuator is idle (not moving).

Type:

bool

8.1.7. The ActuatorWorker class

The worker object living in the plugin thread and responsible for the communication between DAQ_Move and the plugin itself

class pymodaq.control_modules.daq_move.ActuatorWorker(actuator_type, position, title='actuator')[source]

Worker class mediating between DAQ_Move and the actuator plugin instance.

Variables:
  • status_sig (pyqtSignal) – inherited

  • plugin (DAQ_Move_base) – actuator plugin instance

  • plugin_name (str) – inherited property

  • controller_address (int or None)

  • axis_address (str)

  • motion_stopped (bool)

Attributes:
actuator_type
hardware
hardware_adress
motion_stoped

Methods

Move_Stoped(pos)

Send a 'move_done' Thread Command with the given position as an attribute.

check_position()

Get the current position checking the hardware position (deprecated)

close()

Uninitialize the stage closing the hardware.

get_actuator_value()

Get the current position from the plugin.

ini_hardware([params_state, controller])

Init the actuator plugin and wire its signals.

ini_stage([params_state, controller])

Deprecated: use ini_hardware instead.

move_done(pos)

Send the move_done signal back to the main class

move_home()

Make the hardware move to the init position.

queue_command(command)

Interpret command sent by DAQ_Move class.

stop_motion()

Stop hardware motion.

move_abs

move_rel

reset_value

Move_Stoped(pos)[source]

Send a ‘move_done’ Thread Command with the given position as an attribute.

check_position()[source]

Get the current position checking the hardware position (deprecated)

close()[source]

Uninitialize the stage closing the hardware.

get_actuator_value()[source]

Get the current position from the plugin.

Return type:

Optional[DataActuator]

ini_hardware(params_state=None, controller=None)[source]

Init the actuator plugin and wire its signals.

Return type:

EasyDict

ini_stage(params_state=None, controller=None)[source]

Deprecated: use ini_hardware instead.

Return type:

EasyDict

move_done(pos)[source]

Send the move_done signal back to the main class

move_home()[source]

Make the hardware move to the init position.

queue_command(command)[source]

Interpret command sent by DAQ_Move class.

Common commands (ini_hardware, close) are handled by the base class. Move-specific commands are handled here.

stop_motion()[source]

Stop hardware motion.

8.1.8. The DAQ_Move Plugin Class

This object is the base class from which all actuator plugins should inherit. It exposes a few methods, attributes and signal that could be useful to understand.

class pymodaq.control_modules.move_utility_classes.DAQ_Move_base(parent=None, params_state=None, **kwargs)[source]

The base class to be inherited by all actuator modules

This base class implements all necessary parameters and methods for the plugin to communicate with its parent (the DAQ_Move module)

Parameters:
  • parent (Optional[ActuatorWorker])

  • params_state (Optional[dict]) – pyqtgraph Parameter instance from which the module will get the initial settings (as defined in the experiment)

Variables:
  • move_done_signal (pyqtSignal) – signal represented by a float. Is emitted each time the hardware reached the target position within the epsilon precision (see comon_parameters variable)

  • controller (object) – the object representing the hardware in the plugin. Used to access hardware functionality

  • settings (Parameter) – instance representing the hardware settings defined from the params attribute. Modifications on the GUI settings will be transferred to this attribute. It stores at all times the current state of the hardware/plugin settings

  • params (List of dict used to create a Parameter object.) – Its definition on the class level enable the automatic update of the GUI settings when changing plugins (even in managers mode creation). To be populated on the plugin level as the base class does’t represents a real hardware

  • is_multiaxes (bool) – class level attribute. Defines if the plugin controller controls multiple axes. If True, one has to define a Master instance of this plugin and slave instances of this plugin (all sharing the same controller_ID parameter)

  • current_value (DataActuator) – stores the current position after each call to the get_actuator_value in the plugin

  • target_value (DataActuator) – stores the target position the controller should reach within epsilon

Attributes:
axis_index_key

Get the current index or key correspondingto the current axis

axis_name

Get/Set the current axis using its string identifier

axis_names

Get/Set the names of all axes controlled by this instrument plugin

axis_unit

Get/set the unit of the currently chosen axis

axis_units

Get/Set the units for each axis of the controller

axis_value

Get the current value selected from the current axis

controller_units

Get/Set the units of the currently chosen axis of the controller

current_position
current_value
epsilon

Get/Set the epsilon of the currently chosen axis

epsilons

Get/Set the epsilon for each axis of the controller

is_master

Get the controller master/slave status

ispolling

Get/Set the polling status

target_position
target_value

Methods

absolute_difference_condition_to_reach_target()

Implement the condition for exiting the polling mechanism and specifying that the target value has been reached

check_bound(position)

Check if the current position is within the software bounds

commit_settings(param)

to subclass to transfer parameters to hardware

emit_value(pos)

Convenience method to emit the current actuator value back to the UI

get_class_axis_names([axis_names, ...])

Convenience method to access the declared axis in a given plugin

get_position_with_scaling(pos)

Get the current position from the hardware with scaling conversion.

ini_attributes()

To be subclassed, in order to init specific attributes needed by the real implementation.

ini_stage([controller])

Actuator communication initialization

ini_stage_init([old_controller, ...])

Deprecated — use ini_controller_init instead.

move_done([position])

Emit a move done signal transmitting the actuator's value to the GUI

poll_moving()

Poll the current moving.

set_position_relative_with_scaling(pos)

Set the scaled positions in case of relative moves

set_position_with_scaling(pos)

Set the current position from the parameter and hardware with scaling conversion.

stop_motion(*args, **kwargs)

Stop the actuator and emit move_done signal.

update_settings(settings_parameter_dict)

Apply settings-tree change and handle actuator-specific axis/epsilon side-effects.

user_condition_to_reach_target()

Implement a user defined condition for exiting the polling mechanism and specifying that the target value has been reached (on top of the existing epsilon mechanism)

check_target_reached

close

get_actuator_value

move_abs

move_done_signal

move_home

move_rel

classmethod get_class_axis_names(axis_names=None, deprecated_names=None)[source]

Convenience method to access the declared axis in a given plugin

Handles some old declaration style and eventual attribute as None or empty string

Return type:

list[str]

absolute_difference_condition_to_reach_target()[source]

Implement the condition for exiting the polling mechanism and specifying that the target value has been reached

Returns:

bool

Return type:

bool

check_bound(position)[source]

Check if the current position is within the software bounds

Return the new position eventually coerced within the bounds

Return type:

DataActuator

commit_settings(param)[source]

to subclass to transfer parameters to hardware

emit_value(pos)[source]

Convenience method to emit the current actuator value back to the UI

get_position_with_scaling(pos)[source]

Get the current position from the hardware with scaling conversion.

Return type:

DataActuator

ini_attributes()[source]

To be subclassed, in order to init specific attributes needed by the real implementation.

abstractmethod ini_stage(controller=None)[source]

Actuator communication initialization

Parameters:

controller (Optional[TypeVar(HardwareController)]) – custom object of a PyMoDAQ plugin (Slave case). None if only one actuator by controller (Master case)

Return type:

tuple[str, bool]

Returns:

  • info (str)

  • initialized (bool) – False if initialization failed otherwise True

ini_stage_init(old_controller=None, new_controller=None, slave_controller=None)[source]

Deprecated — use ini_controller_init instead.

move_done(position=None)[source]

Emit a move done signal transmitting the actuator’s value to the GUI

The position argument is just there to match some signature of child classes.

poll_moving()[source]

Poll the current moving. In case of timeout emit the raise timeout Thread command.

See also

DAQ_utils.ThreadCommand, move_done

set_position_relative_with_scaling(pos)[source]

Set the scaled positions in case of relative moves

Return type:

DataActuator

set_position_with_scaling(pos)[source]

Set the current position from the parameter and hardware with scaling conversion.

Return type:

DataActuator

abstractmethod stop_motion(*args, **kwargs)[source]

Stop the actuator and emit move_done signal.

Return type:

None

update_settings(settings_parameter_dict)[source]

Apply settings-tree change and handle actuator-specific axis/epsilon side-effects.

user_condition_to_reach_target()[source]

Implement a user defined condition for exiting the polling mechanism and specifying that the target value has been reached (on top of the existing epsilon mechanism)

Should be reimplemented in plugins to implement other conditions

Returns:

bool

Return type:

bool

property axis_index_key: int | str

Get the current index or key correspondingto the current axis

In case axis_names is a list, return the index wihtin the list In case axis_names is a dict, return the key of the dict self.axis_name

property axis_name: str

Get/Set the current axis using its string identifier

property axis_names: List | Dict

Get/Set the names of all axes controlled by this instrument plugin

Return type:

List of string or dictionary mapping names to integers

property axis_unit: str

Get/set the unit of the currently chosen axis

Will update the printed controller unit in the UI

New in 4.4.0

property axis_units: List[str] | Dict[str, str]

Get/Set the units for each axis of the controller

New in 4.4.0

property axis_value: int

Get the current value selected from the current axis

In case axis_names is a list, return the element of the list: self.axis_name In case axis_names is a dict, return the value of the dict self.axis_names[self.axis_name]

property controller_units

Get/Set the units of the currently chosen axis of the controller

Deprecated with pymodaq >= 4.4.0

The property controller_units is deprecated please use the axis_unit property

property epsilon: float

Get/Set the epsilon of the currently chosen axis

New in 4.4.0

property epsilons: List[float] | Dict[str, float]

Get/Set the epsilon for each axis of the controller

New in 4.4.0

property is_master: bool

Get the controller master/slave status

new in version 4.3.0

property ispolling

Get/Set the polling status