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

Main PyMoDAQ class to drive actuators

pymodaq.control_modules.daq_move.DAQ_Move_Hardware(...)

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.

init_signal

This signal is emitted when the chosen actuator is correctly initialized

Type:

pyqtSignal

move_done_signal

This signal is emitted when the chosen actuator finished its action. It gives the actuator’s name and current value

Type:

pyqtSignal, DataActuator]

bounds_signal

This signal is emitted when the actuator reached defined limited boundaries.

Type:

pyqtSignal

See also

ControlModule, ParameterManager

Attributes:
actuator

str: the selected actuator’s type

initialized_state

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

move_done_bool

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

Methods

get_actuator_value()

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_tcpip])

Move the connected hardware to the absolute value

move_home([send_to_tcpip])

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

move_rel(rel_value[, send_to_tcpip])

Move the connected hardware to the relative value

quit_fun()

Programmatic quitting of the current instance of DAQ_Move

stop_motion()

Stop any motion

thread_status(status)

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

get_actuator_value()[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

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_tcpip=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_tcpip (bool) – if True, this position is send through the TCP/IP communication canal

move_home(send_to_tcpip=False)[source]

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

Parameters:

send_to_tcpip (bool) – if True, this position is send through the TCP/IP communication canal

move_rel(rel_value, send_to_tcpip=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_tcpip (bool) – if True, this position is send through the TCP/IP communication canal

quit_fun()[source]

Programmatic quitting of the current instance of DAQ_Move

Des-init the actuator then close the UI parent widget

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

status of the actuator’s initialization (init or not)

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.

8.1.7. 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[DAQ_Move_Hardware])

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

move_done_signal

signal represented by a float. Is emitted each time the hardware reached the target position within the epsilon precision (see comon_parameters variable)

Type:

pyqtSignal

controller

the object representing the hardware in the plugin. Used to access hardware functionality

Type:

object

settings
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

Type:

Parameter

params

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

Type:

List of dict used to create a Parameter object.

is_multiaxes

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)

Type:

bool

current_value

stores the current position after each call to the get_actuator_value in the plugin

Type:

DataActuator

target_value

stores the target position the controller should reach within epsilon

Type:

DataActuator

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_status(status)

Emit the status_sig signal with the given status ThreadCommand back to the main GUI.

emit_value(pos)

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

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

Manage the Master/Slave controller issue

move_done([position])

poll_moving()

Poll the current moving.

send_param_status(param, changes)

Send changes value updates to the gui to update consequently the User Interface

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(value)

Stop the actuator and emit move_done signal.

update_settings(settings_parameter_dict)

Receive the settings_parameter signal from the param_tree_changed method and make hardware updates of modified values.

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

commit_common_settings

get_actuator_value

move_abs

move_done_signal

move_home

move_rel

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

Emit the status_sig signal with the given status ThreadCommand back to the main GUI.

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]

Manage the Master/Slave controller issue

First initialize the status dictionary Then check whether this stage is controlled by a multiaxe controller (to be defined for each plugin)

if it is a multiaxes controller then: * if it is Master: init the controller here * if it is Slave: use an already initialized controller (defined in the preset of the dashboard)

Parameters:
  • old_controller (Optional[TypeVar(HardwareController)]) – The particular object that allow the communication with the hardware, in general a python wrapper around the hardware library. In case of Slave this one comes from a previously initialized plugin

  • new_controller (Optional[TypeVar(HardwareController)]) – The particular object that allow the communication with the hardware, in general a python wrapper around the hardware library. In case of Master it is the new instance of your plugin controller

Return type:

Optional[TypeVar(HardwareController)]

move_done(position=None)[source]
Emit a move done signal transmitting the float position to hardware.
The position argument is just there to match some signature of child classes.

Arguments

Type

Description

position

float

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

send_param_status(param, changes)[source]

Send changes value updates to the gui to update consequently the User Interface

The message passing is made via the ThreadCommand “update_settings”.

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

Stop the actuator and emit move_done signal.

Return type:

None

update_settings(settings_parameter_dict)[source]

Receive the settings_parameter signal from the param_tree_changed method and make hardware updates of modified values.

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