Main PyMoDAQ class to drive actuators |
|
|
|
|
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')[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
Signal[bool]
- move_done_signal
This signal is emitted when the chosen actuator finished its action. It gives the actuator’s name and current value
- Type
Signal[str, DataActuator]
- bounds_signal
This signal is emitted when the actuator reached defined limited boundaries.
- Type
Signal[bool]
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 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
()Programmatic entry to grab data from detectors or current value from actuator
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 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: MoveCommand)[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: Union[DataActuator, Number], 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 (ndarray) – 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: Union[DataActuator, Number], 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
- quit_fun()[source]
Programmatic quitting of the current instance of DAQ_Move
Des-init the actuator then close the UI parent widget
- thread_status(status: ThreadCommand)[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
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.DAQ_Move_UI(parent, title='DAQ_Move')[source]
DAQ_Move user interface.
This class manages the UI and emit dedicated signals depending on actions from the user
- command_sig
This signal is emitted whenever some actions done by the user has to be applied on the main module. Possible commands are:
init
quit
get_value
loop_get_value
find_home
stop
move_abs
move_rel
show_log
actuator_changed
rel_value
show_config
show_plugin_config
- Type
Signal[Threadcommand]
- Attributes
- actuator
actuator_init
bool: the status of the init LED.
- actuators
move_done
bool: the status of the move_done LED.
Methods
Connect actions and/or other widgets signal to methods
do_init
([do_init])Programmatically press the Init button API entry :param do_init: will fire the Init button depending on the argument value and the button check state :type do_init: bool
send_init
(checked)Should be implemented to send to the main app the fact that someone (un)checked init.
set_abs_spinbox_properties
(**properties)Change the Spinbox properties
Method where to create actions to be subclassed.
Mandatory method to be subclassed to setup the docks layout
close
display_value
emit_move_abs
emit_move_rel
enable_move_buttons
set_settings_tree
show_data
- do_init(do_init=True)[source]
Programmatically press the Init button API entry :param do_init: will fire the Init button depending on the argument value and the button check state :type do_init: bool
- send_init(checked)[source]
Should be implemented to send to the main app the fact that someone (un)checked init.
- 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
- setup_actions()[source]
Method where to create actions to be subclassed. Mandatory
Examples
>>> self.add_action('Quit', 'close2', "Quit program") >>> self.add_action('Grab', 'camera', "Grab from camera", checkable=True) >>> self.add_action('Load', 'Open', "Load target file (.h5, .png, .jpg) or data from camera", checkable=False) >>> self.add_action('Save', 'SaveAs', "Save current data", checkable=False)
See also
ActionManager.add_action
- setup_docks()[source]
Mandatory method to be subclassed to setup the docks layout
Examples
>>>self.docks[‘ADock’] = gutils.Dock(‘ADock name’) >>>self.dockarea.addDock(self.docks[‘ADock’]) >>>self.docks[‘AnotherDock’] = gutils.Dock(‘AnotherDock name’) >>>self.dockarea.addDock(self.docks[‘AnotherDock’’’], ‘bottom’, self.docks[‘ADock’])
See also
pyqtgraph.dockarea.Dock
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: DAQ_Move_Hardware = None, params_state: dict = None)[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 (DAQ_Move_Hardware) –
params_state (Parameter) – 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
Signal
- controller
the object representing the hardware in the plugin. Used to access hardware functionality
- Type
- 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
- 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_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_value
Get the current value selected from the current axis
controller_units
Get/Set the units of this plugin
- current_position
- current_value
ispolling
Get/Set the polling status
- target_position
- target_value
Methods
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 the current position from the hardware with scaling conversion.
To be subclassed, in order to init specific attributes needed by the real implementation
ini_stage_init
([old_controller, new_controller])Manage the Master/Slave controller issue
move_done
([position])Emit a move done signal transmitting the float position to hardware.Poll the current moving.
send_param_status
(param, changes)Send changes value updates to the gui to update consequently the User Interface
Set the scaled positions in case of relative moves
Set the current position from the parameter and hardware with scaling conversion.
update_settings
(settings_parameter_dict)Receive the settings_parameter signal from the param_tree_changed method and make hardware updates of modified values.
check_target_reached
commit_common_settings
get_actuator_value
move_abs
move_done_signal
move_home
move_rel
- check_bound(position: DataActuator) DataActuator [source]
Check if the current position is within the software bounds
Return the new position eventually coerced within the bounds
- emit_status(status: ThreadCommand)[source]
Emit the status_sig signal with the given status ThreadCommand back to the main GUI.
- emit_value(pos: DataActuator)[source]
Convenience method to emit the current actuator value back to the UI
- get_position_with_scaling(pos: DataActuator) DataActuator [source]
Get the current position from the hardware with scaling conversion.
- ini_attributes()[source]
To be subclassed, in order to init specific attributes needed by the real implementation
- ini_stage_init(old_controller=None, new_controller=None)[source]
Manage the Master/Slave controller issue
First initialize the status dictionnary 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 (object) – 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 (object) – 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
- move_done(position: Optional[DataActuator] = 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: DataActuator) DataActuator [source]
Set the scaled positions in case of relative moves
- set_position_with_scaling(pos: DataActuator) DataActuator [source]
Set the current position from the parameter and hardware with scaling conversion.
- update_settings(settings_parameter_dict)[source]
Receive the settings_parameter signal from the param_tree_changed method and make hardware updates of modified values.
- property axis_names: Union[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 controller_units
Get/Set the units of this plugin
- property ispolling
Get/Set the polling status