Skip to content

Commit

Permalink
axis units and epsilons
Browse files Browse the repository at this point in the history
  • Loading branch information
seb5g committed Sep 23, 2024
1 parent c756e67 commit 53dcd35
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion plugin_info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ license = 'MIT'

[plugin-install]
#packages required for your plugin:
packages-required = ['pymodaq>=4.3.0']
packages-required = ['pymodaq>=4.3.6']

[features] # defines the plugin features contained into this plugin
instruments = true # true if plugin contains instrument classes (else false, notice the lowercase for toml files)
Expand Down
22 changes: 16 additions & 6 deletions src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Union, List, Dict

from pymodaq.control_modules.move_utility_classes import DAQ_Move_base, comon_parameters_fun, main, DataActuatorType,\
DataActuator # common set of parameters for all actuators
from pymodaq.utils.daq_utils import ThreadCommand # object used to send info back to the main thread
Expand Down Expand Up @@ -36,12 +38,14 @@ class DAQ_Move_Template(DAQ_Move_base):
# TODO add your particular attributes here if any
"""
_controller_units = 'whatever' # TODO for your plugin: put the correct unit here
is_multiaxes = False # TODO for your plugin set to True if this plugin is controlled for a multiaxis controller
_axis_names = ['Axis1', 'Axis2'] # TODO for your plugin: complete the list
_epsilon = 0.1 # TODO replace this by a value that is correct depending on your controller
data_actuator_type = DataActuatorType['DataActuator'] # wether you use the new data style for actuator otherwise set this
# as DataActuatorType['float'] (or entirely remove the line)
_axis_names: Union[List[str], Dict[str, int]] = ['Axis1', 'Axis2'] # TODO for your plugin: complete the list
_controller_units: Union[str, List[str]] = 'mm' # TODO for your plugin: put the correct unit here, it could be
# TODO a single str (the same one is applied to all axes) or a list of str (as much as the number of axes)
_epsilon: Union[float, List[float]] = 0.1 # TODO replace this by a value that is correct depending on your controller
# TODO it could be a single float of a list of float (as much as the number of axes)
data_actuator_type = DataActuatorType.DataActuator # wether you use the new data style for actuator otherwise set this
# as DataActuatorType.float (or entirely remove the line)

params = [ # TODO for your custom plugin: elements to be added here as dicts in order to control your custom stage
] + comon_parameters_fun(is_multiaxes, axis_names=_axis_names, epsilon=_epsilon)
Expand Down Expand Up @@ -84,7 +88,13 @@ def commit_settings(self, param: Parameter):
A given parameter (within detector_settings) whose value has been changed by the user
"""
## TODO for your custom plugin
if param.name() == "a_parameter_you've_added_in_self.params":
if param.name() == 'axis':
self.axis_unit = self.controller.your_method_to_get_correct_axis_unit()
# do this only if you can and if the units are not known beforehand, for instance
# if the motors connected to the controller are of different type (mm, µm, nm, , etc...)
# see BrushlessDCMotor from the thorlabs plugin for an exemple

elif param.name() == "a_parameter_you've_added_in_self.params":
self.controller.your_method_to_apply_this_param_change()
else:
pass
Expand Down

0 comments on commit 53dcd35

Please sign in to comment.