pymodaq_scripting 5.3.0a1__tar.gz → 5.3.9__tar.gz

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.
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.5
2
+ Name: pymodaq_scripting
3
+ Version: 5.3.9
4
+ Summary: Objects and utilities to use PyMoDAQ from a script
5
+ Project-URL: Homepage, http://pymodaq.cnrs.fr
6
+ Project-URL: Source, https://github.com/PyMoDAQ/pymodaq_scripting
7
+ Project-URL: Tracker, https://github.com/PyMoDAQ/pymodaq_scripting/issues
8
+ Author-email: Sébastien Weber <sebastien.weber@cemes.fr>
9
+ License: The MIT License (MIT)
10
+
11
+ Copyright (c) 2021 Sebastien Weber <sebastien.weber@cemes.fr>
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in
21
+ all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
+ THE SOFTWARE.
30
+ License-File: LICENSE
31
+ Classifier: Development Status :: 5 - Production/Stable
32
+ Classifier: Environment :: Other Environment
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.10
38
+ Classifier: Programming Language :: Python :: 3.11
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Programming Language :: Python :: 3.13
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.10
46
+ Requires-Dist: pyleco
47
+ Requires-Dist: pymodaq-data>=5.0.13
48
+ Requires-Dist: pymodaq-utils>=0.0.8
49
+ Provides-Extra: dev
50
+ Requires-Dist: flake8; extra == 'dev'
51
+ Requires-Dist: hatch; extra == 'dev'
52
+ Requires-Dist: pytest; extra == 'dev'
53
+ Requires-Dist: pytest-cov; extra == 'dev'
54
+ Requires-Dist: pytest-xdist; extra == 'dev'
55
+ Description-Content-Type: text/x-rst
56
+
57
+ .. ############################################################
58
+ .. WARNING: This file is AUTO-GENERATED from README.rst.tpl.
59
+ .. ⚠️ DO NOT EDIT MANUALLY ⚠️
60
+ .. ############################################################
61
+
62
+
63
+ PyMoDAQ Scripting
64
+ #################
65
+
66
+ .. image:: https://img.shields.io/pypi/v/pymodaq_scripting.svg
67
+ :target: https://pypi.org/project/pymodaq_scripting/
68
+ :alt: Latest Version
69
+
70
+ .. image:: https://readthedocs.org/projects/pymodaq/badge/?version=patch-3
71
+ :target: https://pymodaq.readthedocs.io/en/stable/?badge=patch-3
72
+ :alt: Documentation Status
73
+
74
+ .. image:: https://codecov.io/gh/PyMoDAQ/PyMoDAQ/branch/patch-3/graph/badge.svg?token=IQNJRCQDM2
75
+ :target: https://codecov.io/gh/PyMoDAQ/PyMoDAQ
76
+
77
+ +-------------+-------------+---------------+
78
+ | | Linux | Windows |
79
+ +=============+=============+===============+
80
+ | Python 3.10 | |310-linux| | |310-windows| |
81
+ +-------------+-------------+---------------+
82
+ | Python 3.11 | |311-linux| | |311-windows| |
83
+ +-------------+-------------+---------------+
84
+ | Python 3.12 | |312-linux| | |312-windows| |
85
+ +-------------+-------------+---------------+
86
+ | Python 3.13 | |313-linux| | |313-windows| |
87
+ +-------------+-------------+---------------+
88
+
89
+
90
+
91
+
92
+
93
+ .. |310-linux| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Linux_3.10.svg
94
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
95
+
96
+ .. |311-linux| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Linux_3.11.svg
97
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
98
+
99
+ .. |312-linux| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Linux_3.12.svg
100
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
101
+
102
+ .. |313-linux| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Linux_3.13.svg
103
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
104
+
105
+ .. |310-windows| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Windows_3.10.svg
106
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
107
+
108
+ .. |311-windows| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Windows_3.11.svg
109
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
110
+
111
+ .. |312-windows| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Windows_3.12.svg
112
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
113
+
114
+ .. |313-windows| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Windows_3.13.svg
115
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
116
+
117
+
118
+
119
+ .. figure:: http://pymodaq.cnrs.fr/en/latest/_static/splash.png
120
+ :alt: shortcut
121
+
122
+
123
+ PyMoDAQ__, Modular Data Acquisition with Python, is a set of **python** modules used to interface any kind of
124
+ experiments. It simplifies the interaction with detector and actuator hardware to go straight to the data acquisition
125
+ of interest.
126
+
127
+ __ https://pymodaq.readthedocs.io/en/stable/?badge=latest
128
+
129
+ `PyMoDAQ Scripting`__ is a set of utilities (mainly objects) that are used
130
+ to provide direct emulation of the DashBoard set of Control Modules but from a script in
131
+ another process. Communication is handled by the lecco protocol.
132
+
133
+ __ https://pymodaq.cnrs.fr/en/latest/user_folder/scripting.html
134
+
135
+
136
+ Published under the MIT FREE SOFTWARE LICENSE
137
+
138
+ GitHub repo: https://github.com/PyMoDAQ
139
+
140
+ Documentation: http://pymodaq.cnrs.fr/
@@ -0,0 +1,84 @@
1
+ .. ############################################################
2
+ .. WARNING: This file is AUTO-GENERATED from README.rst.tpl.
3
+ .. ⚠️ DO NOT EDIT MANUALLY ⚠️
4
+ .. ############################################################
5
+
6
+
7
+ PyMoDAQ Scripting
8
+ #################
9
+
10
+ .. image:: https://img.shields.io/pypi/v/pymodaq_scripting.svg
11
+ :target: https://pypi.org/project/pymodaq_scripting/
12
+ :alt: Latest Version
13
+
14
+ .. image:: https://readthedocs.org/projects/pymodaq/badge/?version=patch-3
15
+ :target: https://pymodaq.readthedocs.io/en/stable/?badge=patch-3
16
+ :alt: Documentation Status
17
+
18
+ .. image:: https://codecov.io/gh/PyMoDAQ/PyMoDAQ/branch/patch-3/graph/badge.svg?token=IQNJRCQDM2
19
+ :target: https://codecov.io/gh/PyMoDAQ/PyMoDAQ
20
+
21
+ +-------------+-------------+---------------+
22
+ | | Linux | Windows |
23
+ +=============+=============+===============+
24
+ | Python 3.10 | |310-linux| | |310-windows| |
25
+ +-------------+-------------+---------------+
26
+ | Python 3.11 | |311-linux| | |311-windows| |
27
+ +-------------+-------------+---------------+
28
+ | Python 3.12 | |312-linux| | |312-windows| |
29
+ +-------------+-------------+---------------+
30
+ | Python 3.13 | |313-linux| | |313-windows| |
31
+ +-------------+-------------+---------------+
32
+
33
+
34
+
35
+
36
+
37
+ .. |310-linux| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Linux_3.10.svg
38
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
39
+
40
+ .. |311-linux| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Linux_3.11.svg
41
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
42
+
43
+ .. |312-linux| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Linux_3.12.svg
44
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
45
+
46
+ .. |313-linux| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Linux_3.13.svg
47
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
48
+
49
+ .. |310-windows| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Windows_3.10.svg
50
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
51
+
52
+ .. |311-windows| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Windows_3.11.svg
53
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
54
+
55
+ .. |312-windows| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Windows_3.12.svg
56
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
57
+
58
+ .. |313-windows| image:: https://raw.githubusercontent.com/PyMoDAQ/PyMoDAQ/badges/pymodaq_scripting/patch-3/tests_Windows_3.13.svg
59
+ :target: https://github.com/PyMoDAQ/PyMoDAQ/actions/workflows/tests-data.yml
60
+
61
+
62
+
63
+ .. figure:: http://pymodaq.cnrs.fr/en/latest/_static/splash.png
64
+ :alt: shortcut
65
+
66
+
67
+ PyMoDAQ__, Modular Data Acquisition with Python, is a set of **python** modules used to interface any kind of
68
+ experiments. It simplifies the interaction with detector and actuator hardware to go straight to the data acquisition
69
+ of interest.
70
+
71
+ __ https://pymodaq.readthedocs.io/en/stable/?badge=latest
72
+
73
+ `PyMoDAQ Scripting`__ is a set of utilities (mainly objects) that are used
74
+ to provide direct emulation of the DashBoard set of Control Modules but from a script in
75
+ another process. Communication is handled by the lecco protocol.
76
+
77
+ __ https://pymodaq.cnrs.fr/en/latest/user_folder/scripting.html
78
+
79
+
80
+ Published under the MIT FREE SOFTWARE LICENSE
81
+
82
+ GitHub repo: https://github.com/PyMoDAQ
83
+
84
+ Documentation: http://pymodaq.cnrs.fr/
@@ -0,0 +1,297 @@
1
+ from concurrent.futures import Future
2
+ from typing import Optional, TYPE_CHECKING, Union
3
+ from xml.etree.ElementTree import Element
4
+ from pymodaq_data.data import DataToExport
5
+ from pymodaq_scripting.utils import (
6
+ Device,
7
+ LECOActuatorWrapper,
8
+ LECODetectorWrapper,
9
+ LECODashboardWrapper,
10
+ )
11
+
12
+ if TYPE_CHECKING:
13
+ from pymodaq.utils.data import DataActuator
14
+
15
+
16
+ class Actuator(Device[LECOActuatorWrapper]):
17
+ """
18
+ Public interface to control an Actuator of a running Dashboard
19
+
20
+ All the commands return at once with a :class:`concurrent.futures.Future`, filled when the Dashboard
21
+ answers: call ``result()`` on it to wait for the answer. A new command of the same kind replaces the
22
+ previous one, whose future then never completes (the four moves share the same future).
23
+
24
+ Parameters
25
+ ----------
26
+ device: str
27
+ Name of the actuator in the Dashboard (its title in the experiment)
28
+ **kwargs
29
+ Passed to the LECO ``Director`` (for example the ``host`` of the coordinator)
30
+
31
+ Examples
32
+ --------
33
+ >>> actuator = Actuator('Xaxis')
34
+ >>> actuator.move_abs('1.5 mm').result() # position reached, as a DataActuator
35
+ >>> actuator.get_actuator_value().result()
36
+ """
37
+ def __init__(self, device: str, **kwargs) -> None:
38
+ super().__init__(LECOActuatorWrapper(device, **kwargs))
39
+
40
+ def get_actuator_value(self) -> Future['DataActuator']:
41
+ """ Ask for the current position of the actuator
42
+
43
+ Returns
44
+ -------
45
+ Future: its result is the position, as a ``DataActuator``
46
+ """
47
+ return self._wrapper.get_actuator_value()
48
+
49
+ def move_home(self) -> Future['DataActuator']:
50
+ """ Move the actuator to its home position
51
+
52
+ Returns
53
+ -------
54
+ Future: its result is the position once the move is over
55
+ """
56
+ return self._wrapper.move_home()
57
+
58
+ def move_abs(self, value: Union['DataActuator', int, float, str]) -> Future['DataActuator']:
59
+ """ Move the actuator to an absolute position
60
+
61
+ Parameters
62
+ ----------
63
+ value: DataActuator, int, float or str
64
+ The target. A number is sent without units, a string is read with its units (``'1.5 mm'``,
65
+ see :func:`pymodaq_scripting.utils.value_to_data_actuator`).
66
+
67
+ Returns
68
+ -------
69
+ Future: its result is the position once the move is over
70
+ """
71
+ return self._wrapper.move_abs(value)
72
+
73
+ def move_rel(self, value: Union['DataActuator', int, float, str]) -> Future['DataActuator']:
74
+ """ Move the actuator by a displacement relative to its current position
75
+
76
+ Parameters
77
+ ----------
78
+ value: DataActuator, int, float or str
79
+ The displacement, same conversions as in :meth:`move_abs`
80
+
81
+ Returns
82
+ -------
83
+ Future: its result is the position once the move is over
84
+ """
85
+ return self._wrapper.move_rel(value)
86
+
87
+ def stop_move(self) -> Future['DataActuator']:
88
+ """ Stop the movement of the actuator
89
+
90
+ Returns
91
+ -------
92
+ Future: its result is the position once the actuator is stopped
93
+ """
94
+ return self._wrapper.stop_move()
95
+
96
+ def get_settings(self) -> Future[Element]:
97
+ """ Ask for the settings of the actuator
98
+
99
+ Returns
100
+ -------
101
+ Future: its result is the settings tree, as an XML ``Element``. It is also kept as the reference
102
+ against which :meth:`set_settings` detects what changed.
103
+ """
104
+ return self._wrapper.get_settings()
105
+
106
+ def set_settings(self, settings: Element) -> None:
107
+ """ Send the settings that differ from those obtained by the last :meth:`get_settings`
108
+
109
+ Only the parameters whose value or attributes changed are sent. Nothing is sent as long as the answer
110
+ to :meth:`get_settings` has not been received.
111
+
112
+ Parameters
113
+ ----------
114
+ settings: Element
115
+ The settings tree returned by :meth:`get_settings`, with some values modified
116
+ """
117
+ self._wrapper.set_settings(settings)
118
+
119
+
120
+ class Detector(Device[LECODetectorWrapper]):
121
+ """
122
+ Public interface to control a Detector of a running Dashboard
123
+
124
+ Parameters
125
+ ----------
126
+ device: str
127
+ Name of the detector in the Dashboard (its title in the experiment)
128
+ **kwargs
129
+ Passed to the LECO ``Director`` (for example the ``host`` of the coordinator)
130
+
131
+ Examples
132
+ --------
133
+ >>> detector = Detector('Camera')
134
+ >>> data = detector.snap().result() # a DataToExport
135
+ """
136
+ def __init__(self, device: str, **kwargs) -> None:
137
+ super().__init__(LECODetectorWrapper(device, **kwargs))
138
+
139
+ def snap(self) -> Optional[Future[DataToExport]]:
140
+ """ Acquire one data set
141
+
142
+ Returns
143
+ -------
144
+ Future or None: its result is the acquired ``DataToExport``. None, and nothing is asked, while a
145
+ continuous grab started by :meth:`grab` is running.
146
+ """
147
+ return self._wrapper.snap()
148
+
149
+ def grab(self, keep: bool = False) -> Optional[list[DataToExport]]:
150
+ """ Start a continuous acquisition, or stop it when one is running (each call toggles)
151
+
152
+ Parameters
153
+ ----------
154
+ keep: bool
155
+ If True, the data sets received while grabbing are appended to the returned list. Only used by
156
+ the call starting the grab.
157
+
158
+ Returns
159
+ -------
160
+ list or None: when starting with ``keep=True``, the list filling up with the acquired ``DataToExport``;
161
+ None otherwise (``keep=False``, or the call stopping the grab).
162
+ """
163
+ return self._wrapper.grab(keep=keep)
164
+
165
+ def stop_grab(self) -> None:
166
+ """ Stop the continuous acquisition """
167
+ return self._wrapper.stop_grab()
168
+
169
+ def get_settings(self) -> Future[Element]:
170
+ """ Ask for the settings of the detector
171
+
172
+ Returns
173
+ -------
174
+ Future: its result is the settings tree, as an XML ``Element``. It is also kept as the reference
175
+ against which :meth:`set_settings` detects what changed.
176
+ """
177
+ return self._wrapper.get_settings()
178
+
179
+ def set_settings(self, settings: Element) -> None:
180
+ """ Send the settings that differ from those obtained by the last :meth:`get_settings`
181
+
182
+ Only the parameters whose value or attributes changed are sent. Nothing is sent as long as the answer
183
+ to :meth:`get_settings` has not been received.
184
+
185
+ Parameters
186
+ ----------
187
+ settings: Element
188
+ The settings tree returned by :meth:`get_settings`, with some values modified
189
+ """
190
+ self._wrapper.set_settings(settings)
191
+
192
+
193
+ class Dashboard(Device[LECODashboardWrapper]):
194
+ """
195
+ Public interface to control a Dashboard
196
+
197
+ Parameters
198
+ ----------
199
+ **kwargs
200
+ Passed to the LECO ``Director`` (for example the ``host`` of the coordinator)
201
+
202
+ Examples
203
+ --------
204
+ >>> dashboard = Dashboard()
205
+ >>> dashboard.apply_experiment('my_experiment').result() # True once applied
206
+ >>> devices = dashboard.get_scripting_devices()
207
+ >>> devices['actuators']['Xaxis'].move_abs('1 mm').result()
208
+ """
209
+
210
+ def __init__(self, **kwargs) -> None:
211
+ super().__init__(LECODashboardWrapper(**kwargs))
212
+
213
+ @property
214
+ def leco_name(self) -> str:
215
+ """ Name under which this script is known on the LECO network"""
216
+ return self._wrapper.leco_name
217
+
218
+ @property
219
+ def name(self) -> str:
220
+ """ Name of the Dashboard on the LECO network"""
221
+ return self._wrapper.name
222
+
223
+ def sign_out(self) -> None:
224
+ """ Sign this script out of the LECO coordinator (done automatically when Python exits)"""
225
+ self._wrapper.sign_out()
226
+
227
+ def get_devices(self) -> Future[dict[str, list[str]]]:
228
+ """ Ask for the names of the instruments of the applied experiment
229
+
230
+ Returns
231
+ -------
232
+ Future: its result is a dict with the keys ``'actuators'`` and ``'detectors'``, each holding the list
233
+ of the names
234
+ """
235
+ return self._wrapper.get_devices()
236
+
237
+ def get_scripting_devices(self) -> dict[str, dict[str, Actuator | Detector]]:
238
+ """ Get an :class:`Actuator` or :class:`Detector` object for each instrument of the experiment
239
+
240
+ Waits for the answer of the Dashboard (see :meth:`get_devices`).
241
+
242
+ Returns
243
+ -------
244
+ dict: ``{'actuators': {name: Actuator}, 'detectors': {name: Detector}}``
245
+ """
246
+ devices = self._wrapper.get_devices().result()
247
+
248
+ return {
249
+ 'actuators': {name: Actuator(name) for name in devices['actuators']},
250
+ 'detectors': {name: Detector(name) for name in devices['detectors']},
251
+ }
252
+
253
+ def get_states(self) -> Future[list[str]]:
254
+ """ Ask for the names of the available states
255
+
256
+ Returns
257
+ -------
258
+ Future: its result is the list of names
259
+ """
260
+ return self._wrapper.get_states()
261
+
262
+ def apply_state(self, state: str) -> Future[bool]:
263
+ """ Apply a state (instrument settings and actuator values)
264
+
265
+ Parameters
266
+ ----------
267
+ state: str
268
+ Name of the state, as returned by :meth:`get_states`
269
+
270
+ Returns
271
+ -------
272
+ Future: its result is the success of the operation, set when the state has been applied
273
+ """
274
+ return self._wrapper.apply_state(state)
275
+
276
+ def get_experiments(self) -> Future[list[str]]:
277
+ """ Ask for the names of the available experiments
278
+
279
+ Returns
280
+ -------
281
+ Future: its result is the list of names
282
+ """
283
+ return self._wrapper.get_experiments()
284
+
285
+ def apply_experiment(self, experiment: str) -> Future[bool]:
286
+ """ Load an experiment (the list of instruments the Dashboard manages)
287
+
288
+ Parameters
289
+ ----------
290
+ experiment: str
291
+ Name of the experiment, as returned by :meth:`get_experiments`
292
+
293
+ Returns
294
+ -------
295
+ Future: its result is the success of the operation, set when the experiment has been applied
296
+ """
297
+ return self._wrapper.apply_experiment(experiment)
@@ -12,7 +12,7 @@ dashboard.apply_experiment('default')
12
12
  print(dashboard.get_states().result())
13
13
  # >>> ['default', 'my_custom_config']
14
14
 
15
- # Same remark as dashboard.apply_preset
15
+ # Same remark as dashboard.apply_experiment
16
16
  dashboard.apply_state('default')
17
17
 
18
18
  print(dashboard.get_devices().result()) # returns the names
File without changes
@@ -212,7 +212,7 @@ class LECOActuatorWrapper(LECODeviceWrapper):
212
212
 
213
213
  return future
214
214
 
215
- def move_rel(self, value: 'DataActuator') -> Future['DataActuator']:
215
+ def move_rel(self, value: Union['DataActuator', int, float, str]) -> Future['DataActuator']:
216
216
  future = Future()
217
217
  self._move_done_future = future
218
218
 
@@ -1,67 +0,0 @@
1
- Metadata-Version: 2.5
2
- Name: pymodaq_scripting
3
- Version: 5.3.0a1
4
- Summary: Objects and utilities to use PyMoDAQ from a script
5
- Project-URL: Homepage, http://pymodaq.cnrs.fr
6
- Project-URL: Source, https://github.com/PyMoDAQ/pymodaq_scripting
7
- Project-URL: Tracker, https://github.com/PyMoDAQ/pymodaq_scripting/issues
8
- Author-email: Sébastien Weber <sebastien.weber@cemes.fr>
9
- License: The MIT License (MIT)
10
-
11
- Copyright (c) 2021 Sebastien Weber <sebastien.weber@cemes.fr>
12
-
13
- Permission is hereby granted, free of charge, to any person obtaining a copy
14
- of this software and associated documentation files (the "Software"), to deal
15
- in the Software without restriction, including without limitation the rights
16
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
- copies of the Software, and to permit persons to whom the Software is
18
- furnished to do so, subject to the following conditions:
19
-
20
- The above copyright notice and this permission notice shall be included in
21
- all copies or substantial portions of the Software.
22
-
23
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
- THE SOFTWARE.
30
- License-File: LICENSE
31
- Classifier: Development Status :: 5 - Production/Stable
32
- Classifier: Environment :: Other Environment
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.10
38
- Classifier: Programming Language :: Python :: 3.11
39
- Classifier: Programming Language :: Python :: 3.12
40
- Classifier: Programming Language :: Python :: 3.13
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.10
46
- Requires-Dist: pyleco
47
- Requires-Dist: pymodaq-data>=5.0.13
48
- Requires-Dist: pymodaq-utils>=0.0.8
49
- Provides-Extra: dev
50
- Requires-Dist: flake8; extra == 'dev'
51
- Requires-Dist: hatch; extra == 'dev'
52
- Requires-Dist: pytest; extra == 'dev'
53
- Requires-Dist: pytest-cov; extra == 'dev'
54
- Requires-Dist: pytest-xdist; extra == 'dev'
55
- Description-Content-Type: text/x-rst
56
-
57
- .. ############################################################
58
- .. WARNING: This file is AUTO-GENERATED from README.rst.tpl.
59
- .. ⚠️ DO NOT EDIT MANUALLY ⚠️
60
- .. ############################################################
61
-
62
-
63
- PyMoDAQ Scripting
64
- #################
65
-
66
- Set of Objects to use PyMoDAQ Dasboard control modules from an external script
67
-
@@ -1,11 +0,0 @@
1
- .. ############################################################
2
- .. WARNING: This file is AUTO-GENERATED from README.rst.tpl.
3
- .. ⚠️ DO NOT EDIT MANUALLY ⚠️
4
- .. ############################################################
5
-
6
-
7
- PyMoDAQ Scripting
8
- #################
9
-
10
- Set of Objects to use PyMoDAQ Dasboard control modules from an external script
11
-
@@ -1,107 +0,0 @@
1
- from concurrent.futures import Future
2
- from typing import Optional, TYPE_CHECKING, Union
3
- from xml.etree.ElementTree import Element
4
- from pymodaq_data.data import DataToExport
5
- from pymodaq_scripting.utils import (
6
- Device,
7
- LECOActuatorWrapper,
8
- LECODetectorWrapper,
9
- LECODashboardWrapper,
10
- )
11
-
12
- if TYPE_CHECKING:
13
- from pymodaq.utils.data import DataActuator
14
-
15
-
16
- class Actuator(Device[LECOActuatorWrapper]):
17
- """
18
- Public interface to control an Actuator
19
- """
20
- def __init__(self, device: str, **kwargs) -> None:
21
- super().__init__(LECOActuatorWrapper(device, **kwargs))
22
-
23
- def get_actuator_value(self) -> Future['DataActuator']:
24
- return self._wrapper.get_actuator_value()
25
-
26
- def move_home(self) -> Future['DataActuator']:
27
- return self._wrapper.move_home()
28
-
29
- def move_abs(self, value: Union['DataActuator', int, float, str]) -> Future['DataActuator']:
30
- return self._wrapper.move_abs(value)
31
-
32
- def move_rel(self, value: Union['DataActuator', int, float, str]) -> Future['DataActuator']:
33
- return self._wrapper.move_rel(value)
34
-
35
- def stop_move(self) -> Future['DataActuator']:
36
- return self._wrapper.stop_move()
37
-
38
- def get_settings(self) -> Future[Element]:
39
- return self._wrapper.get_settings()
40
-
41
- def set_settings(self, settings: Element) -> None:
42
- self._wrapper.set_settings(settings)
43
-
44
- class Detector(Device[LECODetectorWrapper]):
45
- """
46
- Public interface to control a Detector
47
- """
48
- def __init__(self, device: str, **kwargs) -> None:
49
- super().__init__(LECODetectorWrapper(device, **kwargs))
50
-
51
- def snap(self) -> Optional[Future[DataToExport]]:
52
- return self._wrapper.snap()
53
-
54
- def grab(self, keep=False) -> Optional[list[DataToExport]]:
55
- return self._wrapper.grab(keep=keep)
56
-
57
- def stop_grab(self) -> None:
58
- return self._wrapper.stop_grab()
59
-
60
- def get_settings(self) -> Future[Element]:
61
- return self._wrapper.get_settings()
62
-
63
- def set_settings(self, settings: Element) -> None:
64
- self._wrapper.set_settings(settings)
65
-
66
-
67
- class Dashboard(Device[LECODashboardWrapper]):
68
- """
69
- Public interface to control a Dashboard
70
- """
71
-
72
- def __init__(self, **kwargs) -> None:
73
- super().__init__(LECODashboardWrapper(**kwargs))
74
-
75
- @property
76
- def leco_name(self):
77
- return self._wrapper.leco_name
78
-
79
- @property
80
- def name(self) -> str:
81
- return self._wrapper.name
82
-
83
- def sign_out(self) -> None:
84
- self._wrapper.sign_out()
85
-
86
- def get_devices(self) -> Future[dict[str, list[str]]]:
87
- return self._wrapper.get_devices()
88
-
89
- def get_scripting_devices(self) -> dict[str, dict[str, Actuator | Detector]]:
90
- devices = self._wrapper.get_devices().result()
91
-
92
- return {
93
- 'actuators': {name: Actuator(name) for name in devices['actuators']},
94
- 'detectors': {name: Detector(name) for name in devices['detectors']},
95
- }
96
-
97
- def get_states(self) -> Future[list[str]]:
98
- return self._wrapper.get_states()
99
-
100
- def apply_state(self, state: str) -> Future[bool]:
101
- return self._wrapper.apply_state(state)
102
-
103
- def get_experiments(self) -> Future[list[str]]:
104
- return self._wrapper.get_experiments()
105
-
106
- def apply_experiment(self, experiment: str) -> Future[bool]:
107
- return self._wrapper.apply_experiment(experiment)