pymodaq 5.0.0__py3-none-any.whl → 5.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.
Potentially problematic release.
This version of pymodaq might be problematic. Click here for more details.
- pymodaq/__init__.py +55 -89
- pymodaq/control_modules/daq_move.py +129 -55
- pymodaq/control_modules/daq_move_ui.py +42 -11
- pymodaq/control_modules/daq_viewer.py +32 -13
- pymodaq/control_modules/move_utility_classes.py +346 -79
- pymodaq/control_modules/utils.py +26 -9
- pymodaq/control_modules/viewer_utility_classes.py +51 -14
- pymodaq/daq_utils/daq_utils.py +6 -0
- pymodaq/dashboard.py +532 -263
- pymodaq/examples/qt_less_standalone_module.py +128 -0
- pymodaq/extensions/bayesian/bayesian_optimisation.py +30 -21
- pymodaq/extensions/bayesian/utils.py +6 -3
- pymodaq/extensions/daq_logger/__init__.py +1 -0
- pymodaq/extensions/daq_logger/daq_logger.py +4 -5
- pymodaq/extensions/daq_scan.py +28 -8
- pymodaq/extensions/daq_scan_ui.py +7 -9
- pymodaq/extensions/pid/__init__.py +0 -1
- pymodaq/extensions/pid/actuator_controller.py +13 -0
- pymodaq/extensions/pid/daq_move_PID.py +25 -46
- pymodaq/extensions/pid/pid_controller.py +49 -41
- pymodaq/extensions/pid/utils.py +7 -31
- pymodaq/extensions/utils.py +41 -7
- pymodaq/post_treatment/load_and_plot.py +43 -10
- pymodaq/resources/setup_plugin.py +1 -0
- pymodaq/updater.py +107 -0
- pymodaq/utils/chrono_timer.py +6 -7
- pymodaq/utils/daq_utils.py +6 -3
- pymodaq/utils/data.py +21 -17
- pymodaq/utils/enums.py +6 -0
- pymodaq/utils/gui_utils/loader_utils.py +29 -2
- pymodaq/utils/gui_utils/utils.py +9 -12
- pymodaq/utils/gui_utils/widgets/lcd.py +8 -0
- pymodaq/utils/h5modules/module_saving.py +5 -2
- pymodaq/utils/leco/daq_move_LECODirector.py +22 -16
- pymodaq/utils/leco/daq_xDviewer_LECODirector.py +15 -9
- pymodaq/utils/leco/leco_director.py +4 -3
- pymodaq/utils/leco/pymodaq_listener.py +9 -13
- pymodaq/utils/leco/utils.py +40 -7
- pymodaq/utils/managers/modules_manager.py +22 -12
- pymodaq/utils/managers/overshoot_manager.py +45 -1
- pymodaq/utils/managers/preset_manager.py +22 -46
- pymodaq/utils/managers/preset_manager_utils.py +17 -13
- pymodaq/utils/managers/remote_manager.py +1 -1
- pymodaq/utils/messenger.py +6 -0
- pymodaq/utils/parameter/__init__.py +5 -1
- pymodaq/utils/tcp_ip/mysocket.py +4 -110
- pymodaq/utils/tcp_ip/serializer.py +4 -769
- pymodaq/utils/tcp_ip/tcp_server_client.py +5 -5
- pymodaq-5.0.2.dist-info/METADATA +242 -0
- {pymodaq-5.0.0.dist-info → pymodaq-5.0.2.dist-info}/RECORD +54 -55
- {pymodaq-5.0.0.dist-info → pymodaq-5.0.2.dist-info}/WHEEL +1 -1
- {pymodaq-5.0.0.dist-info → pymodaq-5.0.2.dist-info}/entry_points.txt +1 -0
- pymodaq/examples/custom_app.py +0 -255
- pymodaq/examples/custom_viewer.py +0 -112
- pymodaq/examples/parameter_ex.py +0 -158
- pymodaq/examples/preset_MockCamera.xml +0 -1
- pymodaq/post_treatment/daq_measurement/daq_measurement_GUI.py +0 -142
- pymodaq/post_treatment/daq_measurement/daq_measurement_GUI.ui +0 -232
- pymodaq/post_treatment/daq_measurement/daq_measurement_main.py +0 -391
- pymodaq/post_treatment/daq_measurement/process_from_QtDesigner_DAQ_Measurement_GUI.bat +0 -2
- pymodaq-5.0.0.dist-info/METADATA +0 -166
- /pymodaq/{post_treatment/daq_measurement → daq_utils}/__init__.py +0 -0
- {pymodaq-5.0.0.dist-info → pymodaq-5.0.2.dist-info}/licenses/LICENSE +0 -0
pymodaq/control_modules/utils.py
CHANGED
|
@@ -15,7 +15,7 @@ from qtpy.QtCore import Signal, QObject, Qt, Slot, QThread
|
|
|
15
15
|
from pymodaq_utils.utils import ThreadCommand, find_dict_in_list_from_key_val
|
|
16
16
|
from pymodaq_utils.config import Config
|
|
17
17
|
from pymodaq_utils.enums import BaseEnum, enum_checker
|
|
18
|
-
from pymodaq_utils.logger import get_base_logger
|
|
18
|
+
from pymodaq_utils.logger import get_base_logger, set_logger, get_module_name
|
|
19
19
|
|
|
20
20
|
from pymodaq_gui.utils.custom_app import CustomApp
|
|
21
21
|
from pymodaq_gui.parameter import Parameter, ioxml
|
|
@@ -76,7 +76,9 @@ DET_TYPES = {'DAQ0D': get_plugins('daq_0Dviewer'),
|
|
|
76
76
|
if len(DET_TYPES['DAQ0D']) == 0:
|
|
77
77
|
raise DetectorError('No installed Detector')
|
|
78
78
|
|
|
79
|
+
|
|
79
80
|
config = Config()
|
|
81
|
+
logger = set_logger(get_module_name(__file__))
|
|
80
82
|
|
|
81
83
|
|
|
82
84
|
class ViewerError(Exception):
|
|
@@ -134,6 +136,9 @@ class ControlModule(QObject):
|
|
|
134
136
|
def __repr__(self):
|
|
135
137
|
return f'{self.__class__.__name__}: {self.title}'
|
|
136
138
|
|
|
139
|
+
def custom_command(self, command: str, **kwargs):
|
|
140
|
+
self.command_hardware.emit(ThreadCommand(command, kwargs))
|
|
141
|
+
|
|
137
142
|
def thread_status(self, status: ThreadCommand, control_module_type='detector'):
|
|
138
143
|
"""Get back info (using the ThreadCommand object) from the hardware
|
|
139
144
|
|
|
@@ -144,7 +149,8 @@ class ControlModule(QObject):
|
|
|
144
149
|
----------
|
|
145
150
|
status: ThreadCommand
|
|
146
151
|
The info returned from the hardware, the command (str) can be either:
|
|
147
|
-
* Update_Status: display messages and log info
|
|
152
|
+
* Update_Status: display messages and log info (deprecated)
|
|
153
|
+
* update_status: display info on the UI status bar
|
|
148
154
|
* close: close the current thread and delete corresponding attribute on cascade.
|
|
149
155
|
* update_settings: Update the "detector setting" node in the settings tree.
|
|
150
156
|
* update_main_settings: update the "main setting" node in the settings tree
|
|
@@ -160,6 +166,9 @@ class ControlModule(QObject):
|
|
|
160
166
|
else:
|
|
161
167
|
self.update_status(status.attribute[0])
|
|
162
168
|
|
|
169
|
+
elif status.command == 'update_status':
|
|
170
|
+
self.update_status(status.attribute)
|
|
171
|
+
|
|
163
172
|
elif status.command == "close":
|
|
164
173
|
try:
|
|
165
174
|
self.update_status(status.attribute[0])
|
|
@@ -173,7 +182,7 @@ class ControlModule(QObject):
|
|
|
173
182
|
self._hardware_thread.terminate()
|
|
174
183
|
self.update_status('thread is locked?!', 'log')
|
|
175
184
|
except Exception as e:
|
|
176
|
-
|
|
185
|
+
logger.exception(f'Wrong call to the "close" command: \n{str(e)}')
|
|
177
186
|
|
|
178
187
|
self._initialized_state = False
|
|
179
188
|
self.init_signal.emit(self._initialized_state)
|
|
@@ -188,7 +197,7 @@ class ControlModule(QObject):
|
|
|
188
197
|
elif status.attribute[2] == 'options':
|
|
189
198
|
self.settings.child('main_settings', *status.attribute[0]).setOpts(**status.attribute[1])
|
|
190
199
|
except Exception as e:
|
|
191
|
-
|
|
200
|
+
logger.exception(f'Wrong call to the "update_main_settings" command: \n{str(e)}')
|
|
192
201
|
|
|
193
202
|
elif status.command == 'update_settings':
|
|
194
203
|
# using this the settings shown in the UI for the plugin reflects the real plugin settings
|
|
@@ -196,7 +205,7 @@ class ControlModule(QObject):
|
|
|
196
205
|
self.settings.sigTreeStateChanged.disconnect(
|
|
197
206
|
self.parameter_tree_changed) # any changes on the detcetor settings will update accordingly the gui
|
|
198
207
|
except Exception as e:
|
|
199
|
-
|
|
208
|
+
logger.exception(str(e))
|
|
200
209
|
try:
|
|
201
210
|
if status.attribute[2] == 'value':
|
|
202
211
|
self.settings.child(f'{control_module_type}_settings',
|
|
@@ -215,9 +224,18 @@ class ControlModule(QObject):
|
|
|
215
224
|
*status.attribute[0]).addChild(status.attribute[1][0])
|
|
216
225
|
|
|
217
226
|
except Exception as e:
|
|
218
|
-
|
|
227
|
+
logger.exception(f'Wrong call to the "update_settings" command: \n{str(e)}')
|
|
219
228
|
self.settings.sigTreeStateChanged.connect(self.parameter_tree_changed)
|
|
220
229
|
|
|
230
|
+
elif status.command == 'update_ui':
|
|
231
|
+
try:
|
|
232
|
+
if self.ui is not None:
|
|
233
|
+
if hasattr(self.ui, status.attribute):
|
|
234
|
+
getattr(self.ui, status.attribute)(*status.args,
|
|
235
|
+
**status.kwargs)
|
|
236
|
+
except Exception as e:
|
|
237
|
+
logger.info(f'Wrong call to the "update_ui" command: \n{str(e)}')
|
|
238
|
+
|
|
221
239
|
elif status.command == 'raise_timeout':
|
|
222
240
|
self.raise_timeout()
|
|
223
241
|
|
|
@@ -301,7 +319,7 @@ class ControlModule(QObject):
|
|
|
301
319
|
def show_log(self):
|
|
302
320
|
"""Open the log file in the default text editor"""
|
|
303
321
|
import webbrowser
|
|
304
|
-
webbrowser.open(get_base_logger(
|
|
322
|
+
webbrowser.open(get_base_logger(logger).handlers[0].baseFilename)
|
|
305
323
|
|
|
306
324
|
def show_config(self, config: Config) -> Config:
|
|
307
325
|
""" Display in a tree the current configuration"""
|
|
@@ -326,7 +344,7 @@ class ControlModule(QObject):
|
|
|
326
344
|
self.ui.display_status(txt)
|
|
327
345
|
self.status_sig.emit(txt)
|
|
328
346
|
if log:
|
|
329
|
-
|
|
347
|
+
logger.info(txt)
|
|
330
348
|
|
|
331
349
|
def manage_ui_actions(self, action_name: str, attribute: str, value):
|
|
332
350
|
"""Method to manage actions for the UI (if any).
|
|
@@ -364,7 +382,6 @@ class ParameterControlModule(ParameterManager, ControlModule):
|
|
|
364
382
|
listener_class: Type[ActorListener] = ActorListener
|
|
365
383
|
|
|
366
384
|
def __init__(self, **kwargs):
|
|
367
|
-
QObject.__init__(self)
|
|
368
385
|
ParameterManager.__init__(self, action_list=('save', 'update'))
|
|
369
386
|
ControlModule.__init__(self)
|
|
370
387
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Union
|
|
1
|
+
from typing import Union, Iterable
|
|
2
2
|
from qtpy import QtWidgets
|
|
3
3
|
from qtpy.QtCore import QObject, Slot, Signal
|
|
4
4
|
|
|
@@ -15,11 +15,18 @@ from pymodaq_utils.config import Config, get_set_local_dir
|
|
|
15
15
|
from pymodaq.utils.tcp_ip.tcp_server_client import TCPServer, tcp_parameters
|
|
16
16
|
from pymodaq_data.data import DataToExport, DataRaw
|
|
17
17
|
from pymodaq_utils.warnings import deprecation_msg
|
|
18
|
-
from
|
|
19
|
-
from
|
|
18
|
+
from pymodaq_utils.serialize.mysocket import Socket
|
|
19
|
+
from pymodaq_utils.serialize.serializer_legacy import DeSerializer, Serializer
|
|
20
|
+
from pymodaq_gui.plotting.utils.plot_utils import RoiInfo
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
from pymodaq_gui.utils.utils import mkQApp
|
|
23
|
+
|
|
24
|
+
comon_parameters = [{'title': 'Controller Status:', 'name': 'controller_status', 'type': 'list',
|
|
25
|
+
'value': 'Master',
|
|
26
|
+
'limits': ['Master', 'Slave']},
|
|
27
|
+
{'title': 'Controller ID:', 'name': 'controller_ID', 'type': 'int', 'value': 0,
|
|
28
|
+
'default': 0, 'readonly': False},
|
|
29
|
+
]
|
|
23
30
|
|
|
24
31
|
local_path = get_set_local_dir()
|
|
25
32
|
# look for eventual calibration files
|
|
@@ -39,7 +46,7 @@ params = [
|
|
|
39
46
|
{'title': 'Detector type:', 'name': 'detector_type', 'type': 'str', 'value': '', 'readonly': True},
|
|
40
47
|
{'title': 'Detector Name:', 'name': 'module_name', 'type': 'str', 'value': '', 'readonly': True},
|
|
41
48
|
{'title': 'Plugin Config:', 'name': 'plugin_config', 'type': 'bool_push', 'label': 'Show Config', },
|
|
42
|
-
|
|
49
|
+
|
|
43
50
|
{'title': 'Show data and process:', 'name': 'show_data', 'type': 'bool', 'value': True, },
|
|
44
51
|
{'title': 'Refresh time (ms):', 'name': 'refresh_time', 'type': 'float', 'value': 50., 'min': 0.},
|
|
45
52
|
{'title': 'Naverage', 'name': 'Naverage', 'type': 'int', 'default': 1, 'value': 1, 'min': 1},
|
|
@@ -92,7 +99,7 @@ params = [
|
|
|
92
99
|
]
|
|
93
100
|
|
|
94
101
|
|
|
95
|
-
def main(plugin_file=None, init=True):
|
|
102
|
+
def main(plugin_file=None, init=True, title='Testing'):
|
|
96
103
|
"""
|
|
97
104
|
this method start a DAQ_Viewer object with this defined plugin as detector
|
|
98
105
|
Returns
|
|
@@ -104,10 +111,7 @@ def main(plugin_file=None, init=True):
|
|
|
104
111
|
from pymodaq.control_modules.daq_viewer import DAQ_Viewer
|
|
105
112
|
from pathlib import Path
|
|
106
113
|
|
|
107
|
-
app =
|
|
108
|
-
if config('style', 'darkstyle'):
|
|
109
|
-
import qdarkstyle
|
|
110
|
-
app.setStyleSheet(qdarkstyle.load_stylesheet())
|
|
114
|
+
app = mkQApp("PyMoDAQ Viewer")
|
|
111
115
|
|
|
112
116
|
win = QtWidgets.QMainWindow()
|
|
113
117
|
area = DockArea()
|
|
@@ -120,7 +124,7 @@ def main(plugin_file=None, init=True):
|
|
|
120
124
|
else:
|
|
121
125
|
detector = Path(plugin_file).stem[13:]
|
|
122
126
|
det_type = f'DAQ{Path(plugin_file).stem[4:6].upper()}'
|
|
123
|
-
prog = DAQ_Viewer(area, title=
|
|
127
|
+
prog = DAQ_Viewer(area, title=title)
|
|
124
128
|
win.show()
|
|
125
129
|
prog.daq_type = det_type
|
|
126
130
|
prog.detector = detector
|
|
@@ -228,7 +232,8 @@ class DAQ_Viewer_base(QObject):
|
|
|
228
232
|
"""
|
|
229
233
|
pass
|
|
230
234
|
|
|
231
|
-
def ini_detector_init(self, old_controller=None, new_controller=None
|
|
235
|
+
def ini_detector_init(self, old_controller=None, new_controller=None,
|
|
236
|
+
slave_controller=None):
|
|
232
237
|
"""Manage the Master/Slave controller issue
|
|
233
238
|
|
|
234
239
|
First initialize the status dictionary
|
|
@@ -239,13 +244,18 @@ class DAQ_Viewer_base(QObject):
|
|
|
239
244
|
|
|
240
245
|
Parameters
|
|
241
246
|
----------
|
|
242
|
-
old_controller: object
|
|
247
|
+
old_controller: object (deprecated)
|
|
248
|
+
The particular object that allow the communication with the hardware, in general a python wrapper around the
|
|
249
|
+
hardware library. In case of Slave this one comes from a previously initialized plugin
|
|
250
|
+
slave_controller: object
|
|
243
251
|
The particular object that allow the communication with the hardware, in general a python wrapper around the
|
|
244
252
|
hardware library. In case of Slave this one comes from a previously initialized plugin
|
|
245
253
|
new_controller: object
|
|
246
254
|
The particular object that allow the communication with the hardware, in general a python wrapper around the
|
|
247
255
|
hardware library. In case of Master it is the new instance of your plugin controller
|
|
248
256
|
"""
|
|
257
|
+
if old_controller is None and slave_controller is not None:
|
|
258
|
+
old_controller = slave_controller
|
|
249
259
|
self.status.update(edict(info="", controller=None, initialized=False))
|
|
250
260
|
if self.settings['controller_status'] == "Slave":
|
|
251
261
|
if old_controller is None:
|
|
@@ -291,6 +301,33 @@ class DAQ_Viewer_base(QObject):
|
|
|
291
301
|
"""
|
|
292
302
|
pass
|
|
293
303
|
|
|
304
|
+
def roi_select(self, roi_info: RoiInfo, ind_viewer: int = 0):
|
|
305
|
+
""" Every time a ROISelect is updated on a 2D Viewer,
|
|
306
|
+
this method receive the corresponding info
|
|
307
|
+
|
|
308
|
+
To be subclassed in a plugin to use the info
|
|
309
|
+
|
|
310
|
+
Parameters
|
|
311
|
+
----------
|
|
312
|
+
roi_info: RoiInfo
|
|
313
|
+
ind_viewer: int
|
|
314
|
+
The index of the viewer (if multiple) in which the roi is declared
|
|
315
|
+
"""
|
|
316
|
+
pass
|
|
317
|
+
|
|
318
|
+
def crosshair(self, crosshair_info: Iterable[float], ind_viewer: int = 0):
|
|
319
|
+
""" Every time a crosshair is updated, this method receive the corresponding info
|
|
320
|
+
|
|
321
|
+
To be subclassed in a plugin to use the info
|
|
322
|
+
|
|
323
|
+
Parameters
|
|
324
|
+
----------
|
|
325
|
+
crosshair_info: list of float
|
|
326
|
+
ind_viewer: int
|
|
327
|
+
The index of the viewer (if multiple) in which the crosshair is declared
|
|
328
|
+
"""
|
|
329
|
+
pass
|
|
330
|
+
|
|
294
331
|
def get_axis(self):
|
|
295
332
|
"""deprecated"""
|
|
296
333
|
raise DeprecationWarning('get_axis is deprecated add the axes within the DataWithAxes, '
|