pymodaq_plugins_acs_motion 1.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. pymodaq_plugins_acs_motion/__init__.py +13 -0
  2. pymodaq_plugins_acs_motion/app/__init__.py +0 -0
  3. pymodaq_plugins_acs_motion/app/custom_app_template.py +125 -0
  4. pymodaq_plugins_acs_motion/daq_move_plugins/__init__.py +13 -0
  5. pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py +190 -0
  6. pymodaq_plugins_acs_motion/daq_viewer_plugins/__init__.py +3 -0
  7. pymodaq_plugins_acs_motion/daq_viewer_plugins/plugins_0D/__init__.py +13 -0
  8. pymodaq_plugins_acs_motion/daq_viewer_plugins/plugins_1D/__init__.py +13 -0
  9. pymodaq_plugins_acs_motion/daq_viewer_plugins/plugins_2D/__init__.py +14 -0
  10. pymodaq_plugins_acs_motion/daq_viewer_plugins/plugins_ND/__init__.py +13 -0
  11. pymodaq_plugins_acs_motion/exporters/__init__.py +6 -0
  12. pymodaq_plugins_acs_motion/extensions/__init__.py +6 -0
  13. pymodaq_plugins_acs_motion/extensions/custom_extension_template.py +140 -0
  14. pymodaq_plugins_acs_motion/hardware/__init__.py +0 -0
  15. pymodaq_plugins_acs_motion/models/PIDModelTemplate.py +100 -0
  16. pymodaq_plugins_acs_motion/models/__init__.py +6 -0
  17. pymodaq_plugins_acs_motion/resources/__init__.py +0 -0
  18. pymodaq_plugins_acs_motion/resources/config_template.toml +2 -0
  19. pymodaq_plugins_acs_motion/scanners/__init__.py +6 -0
  20. pymodaq_plugins_acs_motion/utils.py +15 -0
  21. pymodaq_plugins_acs_motion-1.0.2.dist-info/METADATA +93 -0
  22. pymodaq_plugins_acs_motion-1.0.2.dist-info/RECORD +25 -0
  23. pymodaq_plugins_acs_motion-1.0.2.dist-info/WHEEL +4 -0
  24. pymodaq_plugins_acs_motion-1.0.2.dist-info/entry_points.txt +5 -0
  25. pymodaq_plugins_acs_motion-1.0.2.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,13 @@
1
+ from pathlib import Path
2
+ from .utils import Config
3
+ from pymodaq_utils.utils import get_version, PackageNotFoundError
4
+ from pymodaq_utils.logger import set_logger, get_module_name
5
+
6
+ config = Config()
7
+ try:
8
+ __version__ = get_version(__package__)
9
+ except PackageNotFoundError:
10
+ __version__ = '0.0.0dev'
11
+
12
+
13
+
File without changes
@@ -0,0 +1,125 @@
1
+ from qtpy import QtWidgets
2
+
3
+ from pymodaq_gui import utils as gutils
4
+ from pymodaq_utils.config import Config
5
+ from pymodaq_utils.logger import set_logger, get_module_name
6
+
7
+ # todo: replace here *pymodaq_plugins_template* by your plugin package name
8
+ from pymodaq_plugins_acs_motion.utils import Config as PluginConfig
9
+
10
+ logger = set_logger(get_module_name(__file__))
11
+
12
+ main_config = Config()
13
+ plugin_config = PluginConfig()
14
+
15
+
16
+ # todo: modify the name of this class to reflect its application and change the name in the main
17
+ # method at the end of the script
18
+ class CustomAppTemplate(gutils.CustomApp):
19
+
20
+ # todo: if you wish to create custom Parameter and corresponding widgets. These will be
21
+ # automatically added as children of self.settings. Morevover, the self.settings_tree will
22
+ # render the widgets in a Qtree. If you wish to see it in your app, add is into a Dock
23
+ params = []
24
+
25
+ def __init__(self, parent: gutils.DockArea):
26
+ super().__init__(parent)
27
+
28
+ self.setup_ui()
29
+
30
+ def setup_docks(self):
31
+ """Mandatory method to be subclassed to setup the docks layout
32
+
33
+ Examples
34
+ --------
35
+ >>>self.docks['ADock'] = gutils.Dock('ADock name')
36
+ >>>self.dockarea.addDock(self.docks['ADock'])
37
+ >>>self.docks['AnotherDock'] = gutils.Dock('AnotherDock name')
38
+ >>>self.dockarea.addDock(self.docks['AnotherDock'''], 'bottom', self.docks['ADock'])
39
+
40
+ See Also
41
+ --------
42
+ pyqtgraph.dockarea.Dock
43
+ """
44
+ # todo: create docks and add them here to hold your widgets
45
+ # reminder, the attribute self.settings_tree will render the widgets in a Qtree.
46
+ # If you wish to see it in your app, add is into a Dock
47
+ raise NotImplementedError
48
+
49
+ def setup_actions(self):
50
+ """Method where to create actions to be subclassed. Mandatory
51
+
52
+ Examples
53
+ --------
54
+ >>> self.add_action('quit', 'Quit', 'close2', "Quit program")
55
+ >>> self.add_action('grab', 'Grab', 'camera', "Grab from camera", checkable=True)
56
+ >>> self.add_action('load', 'Load', 'Open', "Load target file (.h5, .png, .jpg) or data from camera"
57
+ , checkable=False)
58
+ >>> self.add_action('save', 'Save', 'SaveAs', "Save current data", checkable=False)
59
+
60
+ See Also
61
+ --------
62
+ ActionManager.add_action
63
+ """
64
+ raise NotImplementedError(f'You have to define actions here')
65
+
66
+ def connect_things(self):
67
+ """Connect actions and/or other widgets signal to methods"""
68
+ raise NotImplementedError
69
+
70
+ def setup_menu(self, menubar: QtWidgets.QMenuBar = None):
71
+ """Non mandatory method to be subclassed in order to create a menubar
72
+
73
+ create menu for actions contained into the self._actions, for instance:
74
+
75
+ Examples
76
+ --------
77
+ >>>file_menu = menubar.addMenu('File')
78
+ >>>self.affect_to('load', file_menu)
79
+ >>>self.affect_to('save', file_menu)
80
+
81
+ >>>file_menu.addSeparator()
82
+ >>>self.affect_to('quit', file_menu)
83
+
84
+ See Also
85
+ --------
86
+ pymodaq.utils.managers.action_manager.ActionManager
87
+ """
88
+ # todo create and populate menu using actions defined above in self.setup_actions
89
+ pass
90
+
91
+ def value_changed(self, param):
92
+ """ Actions to perform when one of the param's value in self.settings is changed from the
93
+ user interface
94
+
95
+ For instance:
96
+ if param.name() == 'do_something':
97
+ if param.value():
98
+ print('Do something')
99
+ self.settings.child('main_settings', 'something_done').setValue(False)
100
+
101
+ Parameters
102
+ ----------
103
+ param: (Parameter) the parameter whose value just changed
104
+ """
105
+ pass
106
+
107
+
108
+ def main():
109
+ from pymodaq_gui.utils.utils import mkQApp
110
+ app = mkQApp('CustomApp')
111
+
112
+ mainwindow = QtWidgets.QMainWindow()
113
+ dockarea = gutils.DockArea()
114
+ mainwindow.setCentralWidget(dockarea)
115
+
116
+ # todo: change the name here to be the same as your app class
117
+ prog = CustomAppTemplate(dockarea)
118
+
119
+ mainwindow.show()
120
+
121
+ app.exec()
122
+
123
+
124
+ if __name__ == '__main__':
125
+ main()
@@ -0,0 +1,13 @@
1
+ import importlib
2
+ from pathlib import Path
3
+ from .. import set_logger
4
+ logger = set_logger('move_plugins', add_to_console=False)
5
+
6
+ for path in Path(__file__).parent.iterdir():
7
+ try:
8
+ if '__init__' not in str(path):
9
+ importlib.import_module('.' + path.stem, __package__)
10
+ except Exception as e:
11
+ logger.warning("{:} plugin couldn't be loaded due to some missing packages or errors: {:}".format(path.stem, str(e)))
12
+ pass
13
+
@@ -0,0 +1,190 @@
1
+
2
+ from typing import Union, List, Dict
3
+ from pymodaq.control_modules.move_utility_classes import (DAQ_Move_base, comon_parameters_fun,
4
+ main, DataActuatorType, DataActuator)
5
+
6
+ from pymodaq_utils.utils import ThreadCommand # object used to send info back to the main thread
7
+ from pymodaq_gui.parameter import Parameter
8
+
9
+
10
+ from acspy.control import Controller
11
+
12
+ class DAQ_Move_AcsXY(DAQ_Move_base):
13
+ """ Minimalistic plugin to control ACS motion stages with PyMoDAQ.
14
+
15
+ This object inherits all functionalities to communicate with PyMoDAQ’s DAQ_Move module through inheritance via
16
+ DAQ_Move_base. It makes a bridge between the DAQ_Move module and the Python wrapper of a particular instrument.
17
+
18
+ Use the ACSpy package wrapper to communicate with the ACS motion stages.
19
+ It may works with up to 8 axes depending the configuration.
20
+ It does not consider the daisy chain option: only one controller.
21
+ Only ETHERNET communication is implemented (see ACS manual for configuration).
22
+ (It has been tested with USB to ethernet adapter).
23
+ Tested with ACS SPiiPlusEC controller and one drive UDMnt(2 axes).
24
+ The stages were alio's translation stages AI-CM-6000-XY.
25
+ PyMoDAQ version during the test was PyMoDAQ==5.0.5.
26
+ The operating system used was Windows 11.
27
+ Installation instructions: ACS drivers must be installed from the manufacturer's.
28
+ They usually come with the controller and with a "buffer" file for coniguration.
29
+
30
+
31
+ Attributes:
32
+ -----------
33
+ controller: object
34
+ The particular object that allow the communication with the hardware, in general a python wrapper around the
35
+ hardware library.
36
+
37
+ # TODO add your particular attributes here if any
38
+
39
+ """
40
+ is_multiaxes = True
41
+ # Configured for only two axiss, but can be changed to 8 axes.
42
+ _axis_names: Union[List[str], Dict[str, int]] = {'Axis0':0, 'Axis1':1}
43
+ # Here all axes are translations stages with the same unit if difefrent type of stages are used as for example one translation and one rotation the dict must be updated in consequences.
44
+ _controller_units: Union[str, List[str]] = {'Axis0': 'mm', 'Axis1': 'mm'}
45
+ # WARNING: Please refer to your specific stage to set a meaningful value. If you use different type of stages (ex: translation and rotation) it can be replaced by the appropriate epsilon value.
46
+ _epsilon: Union[float, List[float]] = 0.00001
47
+ data_actuator_type = DataActuatorType.DataActuator
48
+ # # wether you use the new data style for actuator otherwise set this
49
+ # as DataActuatorType.float (or entirely remove the line)
50
+ # At this step I will not use the new data dtyle it might be implemented in the future
51
+
52
+ params = [ {'title': 'Controller ID:', 'name': 'controller_id', 'type': 'str', 'value': '', 'readonly': True,}
53
+ ] + comon_parameters_fun(is_multiaxes, axis_names=_axis_names, epsilon=_epsilon)
54
+ # _epsilon is the initial default value for the epsilon parameter allowing pymodaq to know if the controller reached
55
+ # the target value. It is the developer responsibility to put here a meaningful value
56
+
57
+ def ini_attributes(self):
58
+ # TODO declare the type of the wrapper (and assign it to self.controller) you're going to use for easy
59
+ # autocompletion
60
+ self.controller: Controller = None
61
+
62
+ #TODO declare here attributes you want/need to init with a default value
63
+ pass
64
+
65
+ def get_actuator_value(self):
66
+ """Get the current value from the hardware with scaling conversion.
67
+
68
+ Returns
69
+ -------
70
+ float: The position obtained after scaling conversion.
71
+ """
72
+
73
+ pos = DataActuator(
74
+ data=self.controller.axes[self.axis_value].rpos,
75
+ unit=self.axis_unit)
76
+ pos = self.get_position_with_scaling(pos)
77
+ return pos
78
+
79
+ def user_condition_to_reach_target(self) -> bool:
80
+ """ Implement a condition for exiting the polling mechanism and specifying that the
81
+ target value has been reached
82
+
83
+ Returns
84
+ -------
85
+ bool: if True, PyMoDAQ considers the target value has been reached
86
+ """
87
+ # TODO either delete this method if the usual polling is fine with you, but if need you can
88
+ # add here some other condition to be fullfilled either a completely new one or
89
+ # using or/and operations between the epsilon_bool and some other custom booleans
90
+ # for a usage example see DAQ_Move_brushlessMotor from the Thorlabs plugin
91
+ return True
92
+
93
+ def close(self):
94
+ """Terminate the communication protocol"""
95
+ self.controller.disable_all()
96
+ self.controller.disconnect()
97
+
98
+ def commit_settings(self, param: Parameter):
99
+ """Apply the consequences of a change of value in the detector settings
100
+
101
+ Parameters
102
+ ----------
103
+ param: Parameter
104
+ A given parameter (within detector_settings) whose value has been changed by the user
105
+ """
106
+ ## TODO for your custom plugin
107
+ if param.name() == 'axis':
108
+ self.get_actuator_value() # to update the current position of the axis
109
+ #self.axis_unit = 'mm'
110
+ # do this only if you can and if the units are not known beforehand, for instance
111
+ # if the motors connected to the controller are of different type (mm, µm, nm, , etc...)
112
+ # see BrushlessDCMotor from the thorlabs plugin for an exemple
113
+
114
+ elif param.name() == "a_parameter_you've_added_in_self.params":
115
+ self.controller.your_method_to_apply_this_param_change()
116
+ else:
117
+ pass
118
+
119
+ def ini_stage(self, controller=None):
120
+ """Actuator communication initialization
121
+
122
+ Parameters
123
+ ----------
124
+ controller: (object)
125
+ custom object of a PyMoDAQ plugin (Slave case). None if only one actuator by controller (Master case)
126
+
127
+ Returns
128
+ -------
129
+ info: str
130
+ initialized: bool
131
+ False if initialization failed otherwise True
132
+ """
133
+
134
+ self.ini_stage_init(slave_controller=controller) # will be useful when controller is slave
135
+
136
+ if self.is_master: # is needed when controller is master
137
+ self.controller = Controller(contype="ethernet", n_axes=2)
138
+ self.controller.connect() # any object that will control the stages
139
+ self.controller.enable_all() # enable all axes
140
+
141
+
142
+ info = "Controller connected and axis enabled"
143
+ initialized = True#self.controller.a_method_or_atttribute_to_check_if_init() # todo
144
+ return info, initialized
145
+
146
+ def move_abs(self, value: DataActuator):
147
+ """ Move the actuator to the absolute target defined by value
148
+
149
+ Parameters
150
+ ----------
151
+ value: (float) value of the absolute target positioning
152
+ """
153
+
154
+ value = self.check_bound(value) #if user checked bounds, the defined bounds are applied here
155
+ self.target_value = value
156
+ value = self.set_position_with_scaling(value) # apply scaling if the user specified one
157
+ self.controller.axes[self.axis_value].ptp(value.value()) # when writing your own plugin replace this line
158
+ self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log']))
159
+
160
+ def move_rel(self, value: DataActuator):
161
+ """ Move the actuator to the relative target actuator value defined by value
162
+
163
+ Parameters
164
+ ----------
165
+ value: (float) value of the relative target positioning
166
+ """
167
+ value = self.check_bound(self.current_position + value) - self.current_position
168
+ self.target_value = value + self.current_position
169
+ value = self.set_position_relative_with_scaling(value)
170
+
171
+
172
+ self.controller.axes[self.axis_value].ptpr(value.value())
173
+ self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log']))
174
+
175
+ def move_home(self):
176
+ """Call the reference method of the controller"""
177
+ self.move_abs(DataActuator(data=0, unit=self.axis_unit))
178
+
179
+
180
+ def stop_motion(self):
181
+ """Stop the actuator and emits move_done signal"""
182
+
183
+ ## TODO for your custom plugin
184
+ raise NotImplemented # when writing your own plugin remove this line
185
+ self.controller.your_method_to_stop_positioning() # when writing your own plugin replace this line
186
+ self.emit_status(ThreadCommand('Update_Status', ['Some info you want to log']))
187
+
188
+
189
+ if __name__ == '__main__':
190
+ main(__file__)
@@ -0,0 +1,13 @@
1
+ import importlib
2
+ from pathlib import Path
3
+ from ... import set_logger
4
+ logger = set_logger('viewer0D_plugins', add_to_console=False)
5
+
6
+ for path in Path(__file__).parent.iterdir():
7
+ try:
8
+ if '__init__' not in str(path):
9
+ importlib.import_module('.' + path.stem, __package__)
10
+ except Exception as e:
11
+ logger.warning("{:} plugin couldn't be loaded due to some missing packages or errors: {:}".format(path.stem, str(e)))
12
+ pass
13
+
@@ -0,0 +1,13 @@
1
+ import importlib
2
+ from pathlib import Path
3
+ from ... import set_logger
4
+ logger = set_logger('viewer1D_plugins', add_to_console=False)
5
+
6
+ for path in Path(__file__).parent.iterdir():
7
+ try:
8
+ if '__init__' not in str(path):
9
+ importlib.import_module('.' + path.stem, __package__)
10
+ except Exception as e:
11
+ logger.warning("{:} plugin couldn't be loaded due to some missing packages or errors: {:}".format(path.stem, str(e)))
12
+ pass
13
+
@@ -0,0 +1,14 @@
1
+ import importlib
2
+ from pathlib import Path
3
+ from ... import set_logger
4
+ logger = set_logger('viewer2D_plugins', add_to_console=False)
5
+
6
+ for path in Path(__file__).parent.iterdir():
7
+ try:
8
+ if '__init__' not in str(path):
9
+ importlib.import_module('.' + path.stem, __package__)
10
+ except Exception as e:
11
+ logger.warning("{:} plugin couldn't be loaded due to some missing packages or errors: {:}".format(path.stem, str(e)))
12
+ pass
13
+
14
+
@@ -0,0 +1,13 @@
1
+ import importlib
2
+ from pathlib import Path
3
+ from ... import set_logger
4
+ logger = set_logger('viewerND_plugins', add_to_console=False)
5
+
6
+ for path in Path(__file__).parent.iterdir():
7
+ try:
8
+ if '__init__' not in str(path):
9
+ importlib.import_module('.' + path.stem, __package__)
10
+ except Exception as e:
11
+ logger.warning("{:} plugin couldn't be loaded due to some missing packages or errors: {:}".format(path.stem, str(e)))
12
+ pass
13
+
@@ -0,0 +1,6 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created the 01/06/2023
4
+
5
+ @author: Sebastien Weber
6
+ """
@@ -0,0 +1,6 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created the 01/06/2023
4
+
5
+ @author: Sebastien Weber
6
+ """
@@ -0,0 +1,140 @@
1
+ from qtpy import QtWidgets
2
+
3
+ from pymodaq_gui import utils as gutils
4
+ from pymodaq_utils.config import Config, ConfigError
5
+ from pymodaq_utils.logger import set_logger, get_module_name
6
+
7
+ from pymodaq.utils.config import get_set_preset_path
8
+ from pymodaq.extensions.utils import CustomExt
9
+
10
+
11
+ # todo: replace here *pymodaq_plugins_template* by your plugin package name
12
+ from pymodaq_plugins_acs_motion.utils import Config as PluginConfig
13
+
14
+ logger = set_logger(get_module_name(__file__))
15
+
16
+ main_config = Config()
17
+ plugin_config = PluginConfig()
18
+
19
+ # todo: modify this as you wish
20
+ EXTENSION_NAME = 'MY_EXTENSION_NAME' # the name that will be displayed in the extension list in the
21
+ # dashboard
22
+ CLASS_NAME = 'CustomExtensionTemplate' # this should be the name of your class defined below
23
+
24
+
25
+ # todo: modify the name of this class to reflect its application and change the name in the main
26
+ # method at the end of the script
27
+ class CustomExtensionTemplate(CustomExt):
28
+
29
+ # todo: if you wish to create custom Parameter and corresponding widgets. These will be
30
+ # automatically added as children of self.settings. Morevover, the self.settings_tree will
31
+ # render the widgets in a Qtree. If you wish to see it in your app, add is into a Dock
32
+ params = []
33
+
34
+ def __init__(self, parent: gutils.DockArea, dashboard):
35
+ super().__init__(parent, dashboard)
36
+
37
+ # info: in an extension, if you want to interact with ControlModules you have to use the
38
+ # object: self.modules_manager which is a ModulesManager instance from the dashboard
39
+
40
+ self.setup_ui()
41
+
42
+ def setup_docks(self):
43
+ """Mandatory method to be subclassed to setup the docks layout
44
+
45
+ Examples
46
+ --------
47
+ >>>self.docks['ADock'] = gutils.Dock('ADock name')
48
+ >>>self.dockarea.addDock(self.docks['ADock'])
49
+ >>>self.docks['AnotherDock'] = gutils.Dock('AnotherDock name')
50
+ >>>self.dockarea.addDock(self.docks['AnotherDock'''], 'bottom', self.docks['ADock'])
51
+
52
+ See Also
53
+ --------
54
+ pyqtgraph.dockarea.Dock
55
+ """
56
+ # todo: create docks and add them here to hold your widgets
57
+ # reminder, the attribute self.settings_tree will render the widgets in a Qtree.
58
+ # If you wish to see it in your app, add is into a Dock
59
+ raise NotImplementedError
60
+
61
+ def setup_actions(self):
62
+ """Method where to create actions to be subclassed. Mandatory
63
+
64
+ Examples
65
+ --------
66
+ >>> self.add_action('quit', 'Quit', 'close2', "Quit program")
67
+ >>> self.add_action('grab', 'Grab', 'camera', "Grab from camera", checkable=True)
68
+ >>> self.add_action('load', 'Load', 'Open', "Load target file (.h5, .png, .jpg) or data from camera"
69
+ , checkable=False)
70
+ >>> self.add_action('save', 'Save', 'SaveAs', "Save current data", checkable=False)
71
+
72
+ See Also
73
+ --------
74
+ ActionManager.add_action
75
+ """
76
+ raise NotImplementedError(f'You have to define actions here')
77
+
78
+ def connect_things(self):
79
+ """Connect actions and/or other widgets signal to methods"""
80
+ raise NotImplementedError
81
+
82
+ def setup_menu(self, menubar: QtWidgets.QMenuBar = None):
83
+ """Non mandatory method to be subclassed in order to create a menubar
84
+
85
+ create menu for actions contained into the self._actions, for instance:
86
+
87
+ Examples
88
+ --------
89
+ >>>file_menu = menubar.addMenu('File')
90
+ >>>self.affect_to('load', file_menu)
91
+ >>>self.affect_to('save', file_menu)
92
+
93
+ >>>file_menu.addSeparator()
94
+ >>>self.affect_to('quit', file_menu)
95
+
96
+ See Also
97
+ --------
98
+ pymodaq.utils.managers.action_manager.ActionManager
99
+ """
100
+ # todo create and populate menu using actions defined above in self.setup_actions
101
+ pass
102
+
103
+ def value_changed(self, param):
104
+ """ Actions to perform when one of the param's value in self.settings is changed from the
105
+ user interface
106
+
107
+ For instance:
108
+ if param.name() == 'do_something':
109
+ if param.value():
110
+ print('Do something')
111
+ self.settings.child('main_settings', 'something_done').setValue(False)
112
+
113
+ Parameters
114
+ ----------
115
+ param: (Parameter) the parameter whose value just changed
116
+ """
117
+ pass
118
+
119
+
120
+ def main():
121
+ from pymodaq.utils.gui_utils.utils import mkQApp
122
+ from pymodaq.utils.gui_utils.loader_utils import load_dashboard_with_preset
123
+ from pymodaq.utils.messenger import messagebox
124
+
125
+ app = mkQApp(EXTENSION_NAME)
126
+ try:
127
+ preset_file_name = plugin_config('presets', f'preset_for_{CLASS_NAME.lower()}')
128
+ load_dashboard_with_preset(preset_file_name, EXTENSION_NAME)
129
+ app.exec()
130
+
131
+ except ConfigError as e:
132
+ messagebox(f'No entry with name f"preset_for_{CLASS_NAME.lower()}" has been configured'
133
+ f'in the plugin config file. The toml entry should be:\n'
134
+ f'[presets]'
135
+ f"preset_for_{CLASS_NAME.lower()} = {'a name for an existing preset'}"
136
+ )
137
+
138
+
139
+ if __name__ == '__main__':
140
+ main()
File without changes
@@ -0,0 +1,100 @@
1
+ import numpy as np
2
+
3
+ from pymodaq.extensions.pid.utils import PIDModelGeneric, DataToActuatorPID, main
4
+ from pymodaq_data.data import DataToExport, DataCalculated
5
+
6
+ from pymodaq.utils.data import DataActuator
7
+
8
+ from typing import List
9
+
10
+
11
+ def some_function_to_convert_the_pid_outputs(outputs: List[float], dt: float, stab=True):
12
+ """ Should be replaced here or in the model class to process the outputs """
13
+ return outputs
14
+
15
+
16
+ def some_function_to_convert_the_data(measurements: DataToExport):
17
+ """ Should be replaced here or in the model class to process the measurement """
18
+ a = 0
19
+ b = 1
20
+ return [a, b]
21
+
22
+
23
+ class PIDModelTemplate(PIDModelGeneric):
24
+ limits = dict(max=dict(state=False, value=100),
25
+ min=dict(state=False, value=-100),)
26
+ konstants = dict(kp=0.1, ki=0.000, kd=0.0000)
27
+
28
+ Nsetpoints = 2 # number of setpoints
29
+ setpoint_ini = [128, 128] # number and values of initial setpoints
30
+ setpoints_names = ['Xaxis', 'Yaxis'] # number and names of setpoints
31
+
32
+ actuators_name = ["Xpiezo", "Ypiezo"] # names of actuator's control modules involved in the PID
33
+ detectors_name = ['Camera'] # names of detector's control modules involved in the PID
34
+
35
+ params = [] # list of dict to initialize specific Parameters
36
+
37
+ def __init__(self, pid_controller):
38
+ super().__init__(pid_controller)
39
+
40
+ def update_settings(self, param):
41
+ """
42
+ Get a parameter instance whose value has been modified by a user on the UI
43
+ Parameters
44
+ ----------
45
+ param: (Parameter) instance of Parameter object
46
+ """
47
+ if param.name() == '':
48
+ pass
49
+
50
+ def ini_model(self):
51
+ super().ini_model()
52
+
53
+ # add here other specifics initialization if needed
54
+
55
+ def convert_input(self, measurements: DataToExport):
56
+ """
57
+ Convert the measurements in the units to be fed to the PID (same dimensionality as the setpoint)
58
+ Parameters
59
+ ----------
60
+ measurements: DataToExport
61
+ Data from the declared detectors from which the model extract a value of the same units as the setpoint
62
+
63
+ Returns
64
+ -------
65
+ InputFromDetector: the converted input in the setpoints units
66
+
67
+ """
68
+
69
+ x, y = some_function_to_convert_the_data(measurements)
70
+ return DataToExport('pid inputs',
71
+ data=[DataCalculated('pid calculated',
72
+ data=[np.array([x]),
73
+ np.array([y])])])
74
+
75
+ def convert_output(self, outputs: List[float], dt: float, stab=True) -> DataToActuatorPID:
76
+ """
77
+ Convert the output of the PID in units to be fed into the actuator
78
+ Parameters
79
+ ----------
80
+ outputs: List of float
81
+ output value from the PID from which the model extract a value of the same units as the actuator
82
+ dt: float
83
+ Ellapsed time since the last call to this function
84
+ stab: bool
85
+
86
+ Returns
87
+ -------
88
+ OutputToActuator: the converted output
89
+
90
+ """
91
+ outputs = some_function_to_convert_the_pid_outputs(outputs, dt, stab)
92
+ return DataToActuatorPID('pid output', mode='rel',
93
+ data=[DataActuator(self.actuators_name[ind], data=outputs[ind])
94
+ for ind in range(len(outputs))])
95
+
96
+
97
+ if __name__ == '__main__':
98
+ main("BeamSteeringMockNoModel.xml") # some preset configured with the right actuators and detectors
99
+
100
+
@@ -0,0 +1,6 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created the 01/06/2023
4
+
5
+ @author: Sebastien Weber
6
+ """
File without changes
@@ -0,0 +1,2 @@
1
+ title = 'this is the configuration file of the plugin pymodaq_plugins_acs_motion'
2
+
@@ -0,0 +1,6 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created the 01/06/2023
4
+
5
+ @author: Sebastien Weber
6
+ """
@@ -0,0 +1,15 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created the 31/08/2023
4
+
5
+ @author: Sebastien Weber
6
+ """
7
+ from pathlib import Path
8
+
9
+ from pymodaq_utils.config import BaseConfig, USER
10
+
11
+
12
+ class Config(BaseConfig):
13
+ """Main class to deal with configuration values for this plugin"""
14
+ config_template_path = Path(__file__).parent.joinpath('resources/config_template.toml')
15
+ config_name = f"config_{__package__.split('pymodaq_plugins_')[1]}"
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: pymodaq_plugins_acs_motion
3
+ Version: 1.0.2
4
+ Summary: This plugins interact with ACS motion controllers to drive stages.
5
+ Project-URL: Homepage, https://pymodaq.cnrs.fr
6
+ Project-URL: Documentation , https://pymodaq.cnrs.fr
7
+ Project-URL: Repository , https://github.com/JMargueritatLab/pymodaq_plugins_acs_motion
8
+ Author-email: Jérémie Margueritat <jeremie.margueritat@univ-lyon1.fr>
9
+ Maintainer-email: Jérémie Margueritat <jeremie.margueritat@univ-lyon1.fr>
10
+ License: The MIT License (MIT)
11
+
12
+ Copyright (c) 2021 Sebastien Weber <sebastien.weber@cemes.fr>
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in
22
+ all copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30
+ THE SOFTWARE.
31
+ License-File: LICENSE
32
+ Classifier: Development Status :: 5 - Production/Stable
33
+ Classifier: Intended Audience :: Science/Research
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Natural Language :: English
36
+ Classifier: Operating System :: OS Independent
37
+ Classifier: Programming Language :: Python :: 3.8
38
+ Classifier: Programming Language :: Python :: 3.9
39
+ Classifier: Programming Language :: Python :: 3.10
40
+ Classifier: Programming Language :: Python :: 3.11
41
+ Classifier: Topic :: Scientific/Engineering :: Human Machine Interfaces
42
+ Classifier: Topic :: Scientific/Engineering :: Visualization
43
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
44
+ Classifier: Topic :: Software Development :: User Interfaces
45
+ Requires-Python: >=3.8
46
+ Requires-Dist: acspy
47
+ Requires-Dist: pymodaq>=5.0.0
48
+ Description-Content-Type: text/x-rst
49
+
50
+ pymodaq_plugins_template
51
+ ########################
52
+
53
+ .. the following must be adapted to your developed package, links to pypi, github description...
54
+
55
+ .. image:: https://img.shields.io/pypi/v/pymodaq_plugins_thorlabs.svg
56
+ :target: https://pypi.org/project/pymodaq_plugins_thorlabs/
57
+ :alt: Latest Version
58
+
59
+ .. image:: https://readthedocs.org/projects/pymodaq/badge/?version=latest
60
+ :target: https://pymodaq.readthedocs.io/en/stable/?badge=latest
61
+ :alt: Documentation Status
62
+
63
+ .. image:: https://github.com/PyMoDAQ/pymodaq_plugins_thorlabs/workflows/Upload%20Python%20Package/badge.svg
64
+ :target: https://github.com/PyMoDAQ/pymodaq_plugins_thorlabs
65
+ :alt: Publication Status
66
+
67
+ PyMoDAQ plugins for the ACS motion control unit.
68
+
69
+ Authors
70
+ =======
71
+
72
+ * Jérémie Margueritat (jeremie.margueritat@univ-lyon1.fr)
73
+
74
+ Instruments
75
+ ===========
76
+
77
+ Below is the list of instruments included in this plugin
78
+
79
+ Actuators
80
+ +++++++++
81
+
82
+ * **ACS motion control**: control up to 8 stages.
83
+
84
+ It has been developped with ACS motion control unit: SPiiPlusEC, linked with a two axis driver (amplifier) UDMnt.
85
+ The stages were alio's translation stages AI-CM-6000-XY
86
+
87
+ Installation instructions
88
+ =========================
89
+ The user as to install the drivers from ACS. He may also need to intialise the stage within the software with the buffer file provided by ACS.
90
+
91
+ * PyMoDAQ’s version: developed with PyMoDAQ 5.0.5
92
+ * Operating system’s version: Windows 11
93
+ * The plugin assumes that the acs drivers are installed.
@@ -0,0 +1,25 @@
1
+ pymodaq_plugins_acs_motion/__init__.py,sha256=kHISHcIGvr98_YfphdBAs1wThG_WCeoh_Vt0mftOxck,306
2
+ pymodaq_plugins_acs_motion/utils.py,sha256=saBKehqiq5myeh7GCW1vYf5wq4QVYhSVLTxFK6KkdP4,419
3
+ pymodaq_plugins_acs_motion/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ pymodaq_plugins_acs_motion/app/custom_app_template.py,sha256=eWZOFcgvK0eHFLUKCoLAVoen0GaabC6sH_2uIPcBcX8,4141
5
+ pymodaq_plugins_acs_motion/daq_move_plugins/__init__.py,sha256=H-DnuGG6lezGyUjuhavlXRbzoQqzMbZaT3mfMNnAhHk,454
6
+ pymodaq_plugins_acs_motion/daq_move_plugins/daq_move_AcsXY.py,sha256=5irT_HmJeQh7RWQcAe4gB_YKpEatS2QbyLBWrvqvI4I,8611
7
+ pymodaq_plugins_acs_motion/daq_viewer_plugins/__init__.py,sha256=ajz1GSNU9xYVrFEDSz6Xwg7amWQ_yvW75tQa1ZvRIWc,3
8
+ pymodaq_plugins_acs_motion/daq_viewer_plugins/plugins_0D/__init__.py,sha256=ooWW3pJyqQ8lk_bgXe8RXvCZLzl41Cm5gJxwSc-vaCc,459
9
+ pymodaq_plugins_acs_motion/daq_viewer_plugins/plugins_1D/__init__.py,sha256=R2Z_g54zfMJ16Kj3dA7MRj3TF8rjK8lWVAqwJ_yPYTA,459
10
+ pymodaq_plugins_acs_motion/daq_viewer_plugins/plugins_2D/__init__.py,sha256=U43pcyA6aNdltDFbW0TbxpQ2MWYJy3BW-dNucGTjoBc,460
11
+ pymodaq_plugins_acs_motion/daq_viewer_plugins/plugins_ND/__init__.py,sha256=AkMkmRCEIkEN8Jxnd0xFhmaTfLm-Sg95TozVstPsHLI,459
12
+ pymodaq_plugins_acs_motion/exporters/__init__.py,sha256=vqgY3SHF6EhPcfeS8lzb7QvAiTIXWmyObIaCYeJNb6Y,81
13
+ pymodaq_plugins_acs_motion/extensions/__init__.py,sha256=vqgY3SHF6EhPcfeS8lzb7QvAiTIXWmyObIaCYeJNb6Y,81
14
+ pymodaq_plugins_acs_motion/extensions/custom_extension_template.py,sha256=c0_-boTr7YHcdqFNBXEeKJv9d1hRGp8cq0DuY8aGJyU,5118
15
+ pymodaq_plugins_acs_motion/hardware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ pymodaq_plugins_acs_motion/models/PIDModelTemplate.py,sha256=i6lCYwHsWiZbv4mTxV-7lExSTrfk_ex6x4EN1wQ8KPI,3540
17
+ pymodaq_plugins_acs_motion/models/__init__.py,sha256=vqgY3SHF6EhPcfeS8lzb7QvAiTIXWmyObIaCYeJNb6Y,81
18
+ pymodaq_plugins_acs_motion/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ pymodaq_plugins_acs_motion/resources/config_template.toml,sha256=aOQUFMWOBtYEn5w_Kah95L_fQFXwIjJGTOwqkdbsvGk,83
20
+ pymodaq_plugins_acs_motion/scanners/__init__.py,sha256=vqgY3SHF6EhPcfeS8lzb7QvAiTIXWmyObIaCYeJNb6Y,81
21
+ pymodaq_plugins_acs_motion-1.0.2.dist-info/METADATA,sha256=wKGqzo9zqf71azCZcT9ECpnY4vodC0nwseq_zTXfqkk,4098
22
+ pymodaq_plugins_acs_motion-1.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ pymodaq_plugins_acs_motion-1.0.2.dist-info/entry_points.txt,sha256=4b3aziL_yb_1RbIOh6Sw5VYG79P9_RD8lSfQpyP0zsM,121
24
+ pymodaq_plugins_acs_motion-1.0.2.dist-info/licenses/LICENSE,sha256=VKOejxexXAe3XwfhAhcFGqeXQ12irxVHdeAojZwFEI8,1108
25
+ pymodaq_plugins_acs_motion-1.0.2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,5 @@
1
+ [pymodaq.instruments]
2
+ acs_motion = pymodaq_plugins_acs_motion
3
+
4
+ [pymodaq.plugins]
5
+ acs_motion = pymodaq_plugins_acs_motion
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Sebastien Weber <sebastien.weber@cemes.fr>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.