pymodaq 3.6.13__py3-none-any.whl → 4.0.1__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.

Files changed (233) hide show
  1. pymodaq/__init__.py +13 -6
  2. pymodaq/control_modules/__init__.py +0 -7
  3. pymodaq/control_modules/daq_move.py +965 -2
  4. pymodaq/control_modules/daq_move_ui.py +319 -0
  5. pymodaq/control_modules/daq_viewer.py +1573 -3
  6. pymodaq/control_modules/daq_viewer_ui.py +393 -0
  7. pymodaq/control_modules/mocks.py +51 -0
  8. pymodaq/control_modules/move_utility_classes.py +709 -8
  9. pymodaq/control_modules/utils.py +256 -0
  10. pymodaq/control_modules/viewer_utility_classes.py +663 -6
  11. pymodaq/daq_utils.py +89 -0
  12. pymodaq/dashboard.py +91 -72
  13. pymodaq/examples/custom_app.py +12 -11
  14. pymodaq/examples/custom_viewer.py +10 -10
  15. pymodaq/examples/function_plotter.py +16 -13
  16. pymodaq/examples/nonlinearscanner.py +8 -6
  17. pymodaq/examples/parameter_ex.py +7 -7
  18. pymodaq/examples/preset_MockCamera.xml +1 -0
  19. pymodaq/extensions/__init__.py +16 -0
  20. pymodaq/extensions/console.py +76 -0
  21. pymodaq/{daq_logger.py → extensions/daq_logger.py} +115 -65
  22. pymodaq/extensions/daq_scan.py +1339 -0
  23. pymodaq/extensions/daq_scan_ui.py +240 -0
  24. pymodaq/extensions/h5browser.py +23 -0
  25. pymodaq/{pid → extensions/pid}/__init__.py +4 -2
  26. pymodaq/{pid → extensions/pid}/daq_move_PID.py +2 -2
  27. pymodaq/{pid → extensions/pid}/pid_controller.py +48 -36
  28. pymodaq/{pid → extensions/pid}/utils.py +52 -6
  29. pymodaq/extensions/utils.py +40 -0
  30. pymodaq/post_treatment/__init__.py +6 -0
  31. pymodaq/{daq_analysis → post_treatment/daq_analysis}/daq_analysis_main.py +17 -17
  32. pymodaq/{daq_measurement → post_treatment/daq_measurement}/daq_measurement_main.py +8 -14
  33. pymodaq/post_treatment/load_and_plot.py +219 -0
  34. pymodaq/post_treatment/process_to_scalar.py +263 -0
  35. pymodaq/resources/QtDesigner_Ressources/Icon_Library/run_all.png +0 -0
  36. pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop_all.png +0 -0
  37. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.bat +1 -1
  38. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.qrc +1 -0
  39. pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources_rc.py +109784 -109173
  40. pymodaq/resources/QtDesigner_Ressources/icons.svg +142 -0
  41. pymodaq/resources/VERSION +1 -1
  42. pymodaq/resources/config_template.toml +32 -13
  43. pymodaq/resources/preset_default.xml +1 -1
  44. pymodaq/{daq_utils → utils}/Tuto innosetup/script_full_setup.iss +1 -1
  45. pymodaq/utils/__init__.py +0 -29
  46. pymodaq/utils/abstract/__init__.py +48 -0
  47. pymodaq/{daq_utils → utils}/abstract/logger.py +7 -3
  48. pymodaq/utils/array_manipulation.py +379 -8
  49. pymodaq/{daq_utils → utils}/calibration_camera.py +6 -6
  50. pymodaq/{daq_utils → utils}/chrono_timer.py +1 -1
  51. pymodaq/utils/config.py +448 -0
  52. pymodaq/utils/conftests.py +5 -0
  53. pymodaq/utils/daq_utils.py +828 -8
  54. pymodaq/utils/data.py +1873 -7
  55. pymodaq/{daq_utils → utils}/db/db_logger/db_logger.py +86 -47
  56. pymodaq/{daq_utils → utils}/db/db_logger/db_logger_models.py +31 -10
  57. pymodaq/{daq_utils → utils}/enums.py +12 -7
  58. pymodaq/utils/exceptions.py +37 -0
  59. pymodaq/utils/factory.py +82 -0
  60. pymodaq/{daq_utils → utils}/gui_utils/__init__.py +1 -1
  61. pymodaq/utils/gui_utils/custom_app.py +129 -0
  62. pymodaq/utils/gui_utils/file_io.py +66 -0
  63. pymodaq/{daq_utils → utils}/gui_utils/layout.py +2 -2
  64. pymodaq/{daq_utils → utils}/gui_utils/utils.py +13 -3
  65. pymodaq/{daq_utils → utils}/gui_utils/widgets/__init__.py +2 -2
  66. pymodaq/utils/gui_utils/widgets/label.py +24 -0
  67. pymodaq/{daq_utils → utils}/gui_utils/widgets/lcd.py +12 -7
  68. pymodaq/{daq_utils → utils}/gui_utils/widgets/push.py +66 -2
  69. pymodaq/{daq_utils → utils}/gui_utils/widgets/qled.py +6 -4
  70. pymodaq/utils/gui_utils/widgets/spinbox.py +24 -0
  71. pymodaq/{daq_utils → utils}/gui_utils/widgets/table.py +2 -2
  72. pymodaq/utils/h5modules/__init__.py +1 -0
  73. pymodaq/{daq_utils/h5backend.py → utils/h5modules/backends.py} +200 -112
  74. pymodaq/utils/h5modules/browsing.py +683 -0
  75. pymodaq/utils/h5modules/data_saving.py +839 -0
  76. pymodaq/utils/h5modules/h5logging.py +110 -0
  77. pymodaq/utils/h5modules/module_saving.py +350 -0
  78. pymodaq/utils/h5modules/saving.py +914 -0
  79. pymodaq/utils/h5modules/utils.py +85 -0
  80. pymodaq/utils/logger.py +64 -6
  81. pymodaq/utils/managers/action_manager.py +460 -0
  82. pymodaq/{daq_utils → utils}/managers/batchscan_manager.py +144 -112
  83. pymodaq/{daq_utils → utils}/managers/modules_manager.py +188 -114
  84. pymodaq/{daq_utils → utils}/managers/overshoot_manager.py +3 -3
  85. pymodaq/utils/managers/parameter_manager.py +110 -0
  86. pymodaq/{daq_utils → utils}/managers/preset_manager.py +17 -13
  87. pymodaq/{daq_utils → utils}/managers/preset_manager_utils.py +8 -7
  88. pymodaq/{daq_utils → utils}/managers/remote_manager.py +7 -6
  89. pymodaq/{daq_utils → utils}/managers/roi_manager.py +148 -57
  90. pymodaq/utils/math_utils.py +546 -10
  91. pymodaq/{daq_utils → utils}/messenger.py +5 -1
  92. pymodaq/utils/parameter/__init__.py +2 -15
  93. pymodaq/{daq_utils → utils}/parameter/ioxml.py +12 -6
  94. pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/__init__.py +1 -3
  95. pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/filedir.py +1 -1
  96. pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/itemselect.py +3 -0
  97. pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/led.py +1 -1
  98. pymodaq/utils/parameter/pymodaq_ptypes/pixmap.py +161 -0
  99. pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/slide.py +1 -1
  100. pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/table.py +1 -1
  101. pymodaq/utils/parameter/utils.py +206 -11
  102. pymodaq/utils/plotting/data_viewers/__init__.py +6 -0
  103. pymodaq/utils/plotting/data_viewers/viewer.py +393 -0
  104. pymodaq/utils/plotting/data_viewers/viewer0D.py +251 -0
  105. pymodaq/utils/plotting/data_viewers/viewer1D.py +574 -0
  106. pymodaq/{daq_utils → utils}/plotting/data_viewers/viewer1Dbasic.py +8 -3
  107. pymodaq/{daq_utils → utils}/plotting/data_viewers/viewer2D.py +292 -357
  108. pymodaq/{daq_utils → utils}/plotting/data_viewers/viewer2D_basic.py +58 -75
  109. pymodaq/utils/plotting/data_viewers/viewerND.py +738 -0
  110. pymodaq/{daq_utils → utils}/plotting/gant_chart.py +2 -2
  111. pymodaq/{daq_utils → utils}/plotting/items/axis_scaled.py +4 -2
  112. pymodaq/{daq_utils → utils}/plotting/items/image.py +8 -6
  113. pymodaq/utils/plotting/navigator.py +355 -0
  114. pymodaq/utils/plotting/scan_selector.py +480 -0
  115. pymodaq/utils/plotting/utils/axes_viewer.py +88 -0
  116. pymodaq/utils/plotting/utils/filter.py +538 -0
  117. pymodaq/utils/plotting/utils/lineout.py +224 -0
  118. pymodaq/{daq_utils → utils}/plotting/utils/plot_utils.py +196 -84
  119. pymodaq/{daq_utils → utils}/plotting/utils/signalND.py +21 -13
  120. pymodaq/utils/plotting/widgets.py +76 -0
  121. pymodaq/utils/scanner/__init__.py +10 -0
  122. pymodaq/utils/scanner/scan_factory.py +204 -0
  123. pymodaq/utils/scanner/scanner.py +271 -0
  124. pymodaq/utils/scanner/scanners/_1d_scanners.py +117 -0
  125. pymodaq/utils/scanner/scanners/_2d_scanners.py +293 -0
  126. pymodaq/utils/scanner/scanners/sequential.py +192 -0
  127. pymodaq/utils/scanner/scanners/tabular.py +294 -0
  128. pymodaq/utils/scanner/utils.py +83 -0
  129. pymodaq/utils/slicing.py +47 -0
  130. pymodaq/utils/svg/__init__.py +6 -0
  131. pymodaq/utils/svg/svg_renderer.py +20 -0
  132. pymodaq/utils/svg/svg_view.py +35 -0
  133. pymodaq/utils/svg/svg_viewer2D.py +51 -0
  134. pymodaq/{daq_utils → utils}/tcp_server_client.py +36 -37
  135. pymodaq/{daq_utils → utils}/tree_layout/tree_layout_main.py +50 -35
  136. pymodaq/utils/units.py +216 -0
  137. pymodaq-4.0.1.dist-info/METADATA +159 -0
  138. {pymodaq-3.6.13.dist-info → pymodaq-4.0.1.dist-info}/RECORD +167 -170
  139. {pymodaq-3.6.13.dist-info → pymodaq-4.0.1.dist-info}/WHEEL +1 -2
  140. pymodaq-4.0.1.dist-info/entry_points.txt +8 -0
  141. pymodaq/daq_move/daq_move_gui.py +0 -279
  142. pymodaq/daq_move/daq_move_gui.ui +0 -534
  143. pymodaq/daq_move/daq_move_main.py +0 -1042
  144. pymodaq/daq_move/process_from_QtDesigner_DAQ_Move_GUI.bat +0 -2
  145. pymodaq/daq_move/utility_classes.py +0 -686
  146. pymodaq/daq_scan.py +0 -2160
  147. pymodaq/daq_utils/array_manipulation.py +0 -386
  148. pymodaq/daq_utils/config.py +0 -273
  149. pymodaq/daq_utils/conftests.py +0 -7
  150. pymodaq/daq_utils/custom_parameter_tree.py +0 -9
  151. pymodaq/daq_utils/daq_enums.py +0 -133
  152. pymodaq/daq_utils/daq_utils.py +0 -1402
  153. pymodaq/daq_utils/exceptions.py +0 -71
  154. pymodaq/daq_utils/gui_utils/custom_app.py +0 -103
  155. pymodaq/daq_utils/gui_utils/file_io.py +0 -75
  156. pymodaq/daq_utils/gui_utils/widgets/spinbox.py +0 -9
  157. pymodaq/daq_utils/h5exporter_hyperspy.py +0 -115
  158. pymodaq/daq_utils/h5exporters.py +0 -242
  159. pymodaq/daq_utils/h5modules.py +0 -1559
  160. pymodaq/daq_utils/h5utils.py +0 -241
  161. pymodaq/daq_utils/managers/action_manager.py +0 -236
  162. pymodaq/daq_utils/managers/parameter_manager.py +0 -57
  163. pymodaq/daq_utils/math_utils.py +0 -705
  164. pymodaq/daq_utils/parameter/__init__.py +0 -1
  165. pymodaq/daq_utils/parameter/oldpymodaq_ptypes.py +0 -1626
  166. pymodaq/daq_utils/parameter/pymodaq_ptypes/pixmap.py +0 -85
  167. pymodaq/daq_utils/parameter/utils.py +0 -136
  168. pymodaq/daq_utils/plotting/data_viewers/__init__.py +0 -0
  169. pymodaq/daq_utils/plotting/data_viewers/process_from_QtDesigner_0DViewer_GUI.bat +0 -2
  170. pymodaq/daq_utils/plotting/data_viewers/viewer0D.py +0 -204
  171. pymodaq/daq_utils/plotting/data_viewers/viewer0D_GUI.py +0 -89
  172. pymodaq/daq_utils/plotting/data_viewers/viewer0D_GUI.ui +0 -131
  173. pymodaq/daq_utils/plotting/data_viewers/viewer1D.py +0 -781
  174. pymodaq/daq_utils/plotting/data_viewers/viewerND.py +0 -894
  175. pymodaq/daq_utils/plotting/data_viewers/viewerbase.py +0 -64
  176. pymodaq/daq_utils/plotting/items/__init__.py +0 -0
  177. pymodaq/daq_utils/plotting/navigator.py +0 -500
  178. pymodaq/daq_utils/plotting/scan_selector.py +0 -289
  179. pymodaq/daq_utils/plotting/utils/__init__.py +0 -0
  180. pymodaq/daq_utils/plotting/utils/filter.py +0 -236
  181. pymodaq/daq_utils/plotting/viewer0D/__init__.py +0 -0
  182. pymodaq/daq_utils/plotting/viewer0D/viewer0D_main.py +0 -4
  183. pymodaq/daq_utils/plotting/viewer1D/__init__.py +0 -0
  184. pymodaq/daq_utils/plotting/viewer1D/viewer1D_main.py +0 -4
  185. pymodaq/daq_utils/plotting/viewer1D/viewer1Dbasic.py +0 -4
  186. pymodaq/daq_utils/plotting/viewer2D/viewer_2D_basic.py +0 -4
  187. pymodaq/daq_utils/plotting/viewer2D/viewer_2D_main.py +0 -4
  188. pymodaq/daq_utils/plotting/viewerND/__init__.py +0 -0
  189. pymodaq/daq_utils/plotting/viewerND/viewerND_main.py +0 -4
  190. pymodaq/daq_utils/scanner.py +0 -1289
  191. pymodaq/daq_utils/tree_layout/__init__.py +0 -0
  192. pymodaq/daq_viewer/__init__.py +0 -0
  193. pymodaq/daq_viewer/daq_gui_settings.py +0 -237
  194. pymodaq/daq_viewer/daq_gui_settings.ui +0 -441
  195. pymodaq/daq_viewer/daq_viewer_main.py +0 -2225
  196. pymodaq/daq_viewer/process_from_QtDesigner_DAQ_GUI_settings.bat +0 -2
  197. pymodaq/daq_viewer/utility_classes.py +0 -673
  198. pymodaq/examples/logger_image/__init__.py +0 -0
  199. pymodaq/examples/logger_image/logger_displayer.py +0 -121
  200. pymodaq/examples/logger_image/setup.svg +0 -3119
  201. pymodaq/examples/logger_image/setup_svg.py +0 -114
  202. pymodaq/h5browser.py +0 -39
  203. pymodaq/utils/scanner.py +0 -15
  204. pymodaq-3.6.13.dist-info/METADATA +0 -39
  205. pymodaq-3.6.13.dist-info/entry_points.txt +0 -8
  206. pymodaq-3.6.13.dist-info/top_level.txt +0 -1
  207. /pymodaq/{daq_analysis → post_treatment/daq_analysis}/__init__.py +0 -0
  208. /pymodaq/{daq_measurement → post_treatment/daq_measurement}/__init__.py +0 -0
  209. /pymodaq/{daq_measurement → post_treatment/daq_measurement}/daq_measurement_GUI.py +0 -0
  210. /pymodaq/{daq_measurement → post_treatment/daq_measurement}/daq_measurement_GUI.ui +0 -0
  211. /pymodaq/{daq_measurement → post_treatment/daq_measurement}/process_from_QtDesigner_DAQ_Measurement_GUI.bat +0 -0
  212. /pymodaq/{daq_utils → utils}/Tuto innosetup/Tuto innosetup.odt +0 -0
  213. /pymodaq/{daq_utils → utils}/Tuto innosetup/Tuto innosetup.pdf +0 -0
  214. /pymodaq/{daq_move → utils/db}/__init__.py +0 -0
  215. /pymodaq/{daq_utils → utils/db/db_logger}/__init__.py +0 -0
  216. /pymodaq/{daq_utils → utils}/gui_utils/dock.py +0 -0
  217. /pymodaq/{daq_utils → utils}/gui_utils/list_picker.py +0 -0
  218. /pymodaq/{daq_utils/abstract → utils/managers}/__init__.py +0 -0
  219. /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/bool.py +0 -0
  220. /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/date.py +0 -0
  221. /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/list.py +0 -0
  222. /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/numeric.py +0 -0
  223. /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/tableview.py +0 -0
  224. /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/text.py +0 -0
  225. /pymodaq/{daq_utils/db → utils/plotting}/__init__.py +0 -0
  226. /pymodaq/{daq_utils → utils}/plotting/image_viewer.py +0 -0
  227. /pymodaq/{daq_utils/db/db_logger → utils/plotting/items}/__init__.py +0 -0
  228. /pymodaq/{daq_utils → utils}/plotting/items/crosshair.py +0 -0
  229. /pymodaq/{daq_utils/managers → utils/plotting/utils}/__init__.py +0 -0
  230. /pymodaq/{daq_utils → utils}/qvariant.py +0 -0
  231. /pymodaq/{daq_utils/plotting/viewer2D → utils/scanner/scanners}/__init__.py +0 -0
  232. /pymodaq/{daq_utils/plotting → utils/tree_layout}/__init__.py +0 -0
  233. {pymodaq-3.6.13.dist-info → pymodaq-4.0.1.dist-info/licenses}/LICENSE +0 -0
@@ -1,19 +1,38 @@
1
- from typing import List
1
+ from typing import List, Union
2
+
2
3
  from collections import OrderedDict
3
4
  from qtpy.QtCore import QObject, Signal, Slot, QThread
4
5
  from qtpy import QtWidgets
5
6
  import time
6
- from pymodaq.daq_utils import daq_utils as utils
7
7
 
8
+ from pymodaq.utils.logger import set_logger, get_module_name, get_module_name
9
+ from pymodaq.utils import daq_utils as utils
10
+ from pymodaq.utils.config import Config
11
+ from pymodaq.utils.data import DataToExport, DataFromPlugins
8
12
  from pyqtgraph.parametertree import Parameter, ParameterTree
13
+ from pymodaq.utils.managers.parameter_manager import ParameterManager
14
+
15
+ logger = set_logger(get_module_name(__file__))
16
+ config = Config()
9
17
 
10
- logger = utils.set_logger(utils.get_module_name(__file__))
11
18
 
19
+ class ModulesManager(QObject, ParameterManager):
20
+ """Class to manage DAQ_Viewers and DAQ_Moves with UI to select some
12
21
 
13
- class ModulesManager(QObject):
22
+ Easier to connect control modules signals to slots, test, ...
23
+
24
+ Parameters
25
+ ----------
26
+ detectors: list of DAQ_Viewer
27
+ actuators: list of DAQ_Move
28
+ selected_detectors: list of DAQ_Viewer
29
+ sublist of detectors
30
+ selected_actuators: list of DAQ_Move
31
+ sublist of actuators
32
+ """
14
33
  detectors_changed = Signal(list)
15
34
  actuators_changed = Signal(list)
16
- det_done_signal = Signal(OrderedDict)
35
+ det_done_signal = Signal(DataToExport)
17
36
  move_done_signal = Signal(OrderedDict)
18
37
  timeout_signal = Signal(bool)
19
38
 
@@ -39,28 +58,23 @@ class ModulesManager(QObject):
39
58
  ]},
40
59
  ]
41
60
 
42
- def __init__(self, detectors=[], actuators=[], selected_detectors=[], selected_actuators=[], timeout=10000):
43
- super().__init__()
61
+ def __init__(self, detectors=[], actuators=[], selected_detectors=[], selected_actuators=[], **kwargs):
62
+ QObject.__init__(self)
63
+ ParameterManager.__init__(self)
44
64
 
45
65
  for mod in selected_actuators:
46
66
  assert mod in actuators
47
67
  for mod in selected_detectors:
48
68
  assert mod in detectors
49
69
 
50
- self.timeout = timeout # in ms
70
+ self.actuator_timeout = config('actuator', 'timeout')
71
+ self.detector_timeout = config('viewer', 'timeout')
51
72
 
52
- self.det_done_datas = OrderedDict()
73
+ self.det_done_datas: DataToExport = None
53
74
  self.det_done_flag = False
54
75
  self.move_done_positions = OrderedDict()
55
76
  self.move_done_flag = False
56
77
 
57
- self.settings = Parameter.create(name='Settings', type='group', children=self.params)
58
- self.settings_tree = ParameterTree()
59
- self.settings_tree.setMinimumWidth(300)
60
- self.settings_tree.setParameters(self.settings, showTop=False)
61
-
62
- self.settings.sigTreeStateChanged.connect(self.parameter_tree_changed)
63
-
64
78
  self.settings.child('data_dimensions', 'probe_data').sigActivated.connect(self.get_det_data_list)
65
79
  self.settings.child('actuators_positions', 'test_actuator').sigActivated.connect(self.test_move_actuators)
66
80
 
@@ -76,13 +90,33 @@ class ModulesManager(QObject):
76
90
  self.set_actuators(actuators, selected_actuators)
77
91
  self.set_detectors(detectors, selected_detectors)
78
92
 
93
+ def show_only_control_modules(self, show: True):
94
+ self.settings.child('move_done').show(not show)
95
+ self.settings.child('det_done').show(not show)
96
+ self.settings.child('data_dimensions').show(not show)
97
+ self.settings.child('actuators_positions').show(not show)
98
+
79
99
  @classmethod
80
100
  def get_names(cls, modules):
101
+ """Get the titles of a list of Control Modules
102
+
103
+ Parameters
104
+ ----------
105
+ modules: list of DAQ_Move and/or DAQ_Viewer
106
+ """
81
107
  if not hasattr(modules, '__iter__'):
82
108
  modules = [modules]
83
109
  return [mod.title for mod in modules]
84
110
 
85
111
  def get_mods_from_names(self, names, mod='det'):
112
+ """Getter of a list of given modules from their name (title)
113
+
114
+ Parameters
115
+ ----------
116
+ names: list of str
117
+ mod: str
118
+ either 'det' for DAQ_Viewer modules or 'act' for DAQ_Move modules
119
+ """
86
120
  mods = []
87
121
  for name in names:
88
122
  d = self.get_mod_from_name(name, mod)
@@ -90,7 +124,15 @@ class ModulesManager(QObject):
90
124
  mods.append(d)
91
125
  return mods
92
126
 
93
- def get_mod_from_name(self, name, mod='det'):
127
+ def get_mod_from_name(self, name, mod='det') -> Union['DAQ_Move', 'DAQ_Viewer']:
128
+ """Getter of a given module from its name (title)
129
+
130
+ Parameters
131
+ ----------
132
+ name: str
133
+ mod: str
134
+ either 'det' for DAQ_Viewer modules or 'act' for DAQ_Move modules
135
+ """
94
136
  if mod == 'det':
95
137
  modules = self._detectors
96
138
  else:
@@ -103,45 +145,65 @@ class ModulesManager(QObject):
103
145
  return None
104
146
 
105
147
  def set_actuators(self, actuators, selected_actuators):
148
+ """Populates actuators and the subset to be selected in the UI"""
106
149
  self._actuators = actuators
107
150
  self.settings.child('modules', 'actuators').setValue(dict(all_items=self.get_names(actuators),
108
151
  selected=self.get_names(selected_actuators)))
109
152
 
110
153
  def set_detectors(self, detectors, selected_detectors):
154
+ """Populates detectors and the subset to be selected in the UI"""
111
155
  self._detectors = detectors
112
156
  self.settings.child('modules', 'detectors').setValue(dict(all_items=self.get_names(detectors),
113
157
  selected=self.get_names(selected_detectors)))
114
158
 
115
159
  @property
116
- def detectors(self):
160
+ def detectors(self) -> List['DAQ_Viewer']:
161
+ """Get the list of selected detectors"""
117
162
  return self.get_mods_from_names(self.selected_detectors_name)
118
163
 
119
164
  @property
120
165
  def detectors_all(self):
166
+ """Get the list of all detectors"""
121
167
  return self._detectors
122
168
 
123
169
  @property
124
170
  def actuators(self) -> List['DAQ_Move']:
171
+ """Get the list of selected actuators"""
125
172
  return self.get_mods_from_names(self.selected_actuators_name, mod='act')
126
173
 
127
174
  @property
128
175
  def actuators_all(self):
176
+ """Get the list of all actuators"""
129
177
  return self._actuators
130
178
 
179
+ @property
180
+ def modules(self):
181
+ """Get the list of all detectors and actuators"""
182
+ return self.detectors + self.actuators
183
+
184
+ @property
185
+ def modules_all(self):
186
+ """Get the list of all detectors and actuators"""
187
+ return self.detectors_all + self.actuators_all
188
+
131
189
  @property
132
190
  def Ndetectors(self):
191
+ """Get the number of selected detectors"""
133
192
  return len(self.detectors)
134
193
 
135
194
  @property
136
195
  def Nactuators(self):
196
+ """Get the number of selected actuators"""
137
197
  return len(self.actuators)
138
198
 
139
199
  @property
140
200
  def detectors_name(self):
201
+ """Get all the names of the detectors"""
141
202
  return self.settings.child('modules', 'detectors').value()['all_items']
142
203
 
143
204
  @property
144
205
  def selected_detectors_name(self):
206
+ """Get/Set the names of the selected detectors"""
145
207
  return self.settings.child('modules', 'detectors').value()['selected']
146
208
 
147
209
  @selected_detectors_name.setter
@@ -152,10 +214,12 @@ class ModulesManager(QObject):
152
214
 
153
215
  @property
154
216
  def actuators_name(self):
217
+ """Get all the names of the actuators"""
155
218
  return self.settings.child('modules', 'actuators').value()['all_items']
156
219
 
157
220
  @property
158
- def selected_actuators_name(self):
221
+ def selected_actuators_name(self) -> List[str]:
222
+ """Get/Set the names of the selected actuators"""
159
223
  return self.settings.child('modules', 'actuators').value()['selected']
160
224
 
161
225
  @selected_actuators_name.setter
@@ -164,53 +228,23 @@ class ModulesManager(QObject):
164
228
  self.settings.child('modules', 'actuators').setValue(dict(all_items=self.actuators_name,
165
229
  selected=actuators))
166
230
 
231
+ def value_changed(self, param):
232
+ if param.name() == 'detectors':
233
+ self.detectors_changed.emit(param.value()['selected'])
167
234
 
168
- def parameter_tree_changed(self, param, changes):
169
- """
170
- Check for changes in the given (parameter,change,information) tuple list.
171
- In case of value changed, update the DAQscan_settings tree consequently.
172
-
173
- =============== ============================================ ==============================
174
- **Parameters** **Type** **Description**
175
- *param* instance of pyqtgraph parameter the parameter to be checked
176
- *changes* (parameter,change,information) tuple list the current changes state
177
- =============== ============================================ ==============================
178
- """
179
- for param, change, data in changes:
180
- path = self.settings.childPath(param)
181
- if change == 'childAdded':
182
- pass
183
-
184
- elif change == 'value':
185
-
186
- if param.name() == 'detectors':
187
- self.detectors_changed.emit(data['selected'])
188
-
189
- elif param.name() == 'actuators':
190
- self.actuators_changed.emit(data['selected'])
191
-
192
- elif change == 'parent':
193
- pass
235
+ elif param.name() == 'actuators':
236
+ self.actuators_changed.emit(param.value()['selected'])
194
237
 
195
238
  def get_det_data_list(self):
196
- self.connect_detectors()
239
+ """Do a snap of selected detectors, to get the list of all the data and processed data"""
197
240
 
198
- datas = self.grab_datas()
199
-
200
- data_list0D = []
201
- data_list1D = []
202
- data_list2D = []
203
- data_listND = []
241
+ self.connect_detectors()
242
+ datas: DataToExport = self.grab_datas()
204
243
 
205
- for k in datas.keys():
206
- if 'data0D' in datas[k].keys():
207
- data_list0D.extend([f'{k}/{name}' for name in datas[k]['data0D'].keys()])
208
- if 'data1D' in datas[k].keys():
209
- data_list1D.extend([f'{k}/{name}' for name in datas[k]['data1D'].keys()])
210
- if 'data2D' in datas[k].keys():
211
- data_list2D.extend([f'{k}/{name}' for name in datas[k]['data2D'].keys()])
212
- if 'dataND' in datas[k].keys():
213
- data_listND.extend([f'{k}/{name}' for name in datas[k]['dataND'].keys()])
244
+ data_list0D = datas.get_full_names('data0D')
245
+ data_list1D = datas.get_full_names('data1D')
246
+ data_list2D = datas.get_full_names('data2D')
247
+ data_listND = datas.get_full_names('dataND')
214
248
 
215
249
  self.settings.child('data_dimensions', 'det_data_list0D').setValue(
216
250
  dict(all_items=data_list0D, selected=[]))
@@ -224,22 +258,31 @@ class ModulesManager(QObject):
224
258
  self.connect_detectors(False)
225
259
 
226
260
  def get_selected_probed_data(self, dim='0D'):
261
+ """Get the name of selected data names of a given dimensionality
262
+
263
+ Parameters
264
+ ----------
265
+ dim: str
266
+ either '0D', '1D', '2D' or 'ND'
267
+ """
227
268
  return self.settings.child('data_dimensions', f'det_data_list{dim.upper()}').value()['selected']
228
269
 
229
270
  def grab_datas(self, **kwargs):
230
- self.det_done_datas = OrderedDict()
271
+ """Do a single grab of connected and selected detectors"""
272
+ self.det_done_datas = DataToExport(name=__class__.__name__, control_module='DAQ_Viewer')
273
+ self._received_data = 0
231
274
  self.det_done_flag = False
232
- self.settings.child(('det_done')).setValue(self.det_done_flag)
275
+ self.settings.child('det_done').setValue(self.det_done_flag)
233
276
  tzero = time.perf_counter()
234
277
 
235
- for sig in [mod.command_detector for mod in self.detectors]:
278
+ for sig in [mod.command_hardware for mod in self.detectors]:
236
279
  sig.emit(utils.ThreadCommand("single", [1, kwargs]))
237
280
 
238
281
  while not self.det_done_flag:
239
282
  # wait for grab done signals to end
240
283
 
241
284
  QtWidgets.QApplication.processEvents()
242
- if time.perf_counter() - tzero > self.timeout:
285
+ if time.perf_counter() - tzero > self.detector_timeout:
243
286
  self.timeout_signal.emit(True)
244
287
  logger.error('Timeout Fired during waiting for data to be acquired')
245
288
  break
@@ -247,16 +290,36 @@ class ModulesManager(QObject):
247
290
  self.det_done_signal.emit(self.det_done_datas)
248
291
  return self.det_done_datas
249
292
 
250
- def connect_actuators(self, connect=True, slot=None):
293
+ def connect_actuators(self, connect=True, slot=None, signal='move_done'):
294
+ """Connect the selected actuators signal to a given or default slot
295
+
296
+ Parameters
297
+ ----------
298
+ connect: bool
299
+ slot: builtin_function_or_method
300
+ method or function the chosen signal will be connected to
301
+ if None, then the default move_done slot is used
302
+ signal: str
303
+ What kind of signal is to be used:
304
+
305
+ * 'move_done' will connect the `move_done signal` to the slot
306
+ * 'current_value' will connect the 'current_signal' to the slot
307
+
308
+ See Also
309
+ --------
310
+ :meth:`move_done`
311
+ """
251
312
  if slot is None:
252
313
  slot = self.move_done
253
314
  if connect:
254
- for sig in [mod.move_done_signal for mod in self.actuators]:
315
+ for sig in [mod.move_done_signal if signal == 'move_done' else mod.current_value_signal
316
+ for mod in self.actuators]:
255
317
  sig.connect(slot)
256
318
 
257
319
  else:
258
320
  try:
259
- for sig in [mod.move_done_signal for mod in self.actuators]:
321
+ for sig in [mod.move_done_signal if signal == 'move_done' else mod.current_value_signal
322
+ for mod in self.actuators]:
260
323
  sig.disconnect(slot)
261
324
  except Exception as e:
262
325
  logger.error(str(e))
@@ -266,15 +329,18 @@ class ModulesManager(QObject):
266
329
  def connect_detectors(self, connect=True, slot=None):
267
330
  """
268
331
  Connect selected DAQ_Viewers's grab_done_signal to the given slot
332
+
269
333
  Parameters
270
334
  ----------
271
- connect: (bool) if True, connect to the given slot (or default slot)
272
- if False, disconnect all detectors (not only the currently selected ones.
273
- This is made because when selected detectors changed if you only disconnect those ones,
274
- the previously connected ones will stay connected)
275
-
276
- slot: (method) A method that should be connected
335
+ connect: bool
336
+ if True, connect to the given slot (or default slot)
337
+ if False, disconnect all detectors (not only the currently selected ones.
338
+ This is made because when selected detectors changed if you only disconnect those one,
339
+ the previously connected ones will stay connected)
340
+ slot: method
341
+ A method that should be connected, if None self.det_done is connected by default
277
342
  """
343
+
278
344
  if slot is None:
279
345
  slot = self.det_done
280
346
 
@@ -293,6 +359,7 @@ class ModulesManager(QObject):
293
359
  self.detectors_connected = connect
294
360
 
295
361
  def test_move_actuators(self):
362
+ """Do a move of selected actuator"""
296
363
  positions = dict()
297
364
  for act in self.get_names(self.actuators):
298
365
  pos, done = QtWidgets.QInputDialog.getDouble(None, f'Enter a target position for actuator {act}',
@@ -316,28 +383,27 @@ class ModulesManager(QObject):
316
383
 
317
384
  Parameters
318
385
  ----------
319
- positions: (list) the list of position to apply. Its length must be equal to the number of selected actutors
320
- mode: (str) either 'abs' for absolute positionning or 'rel' for relative
321
- poll: (bool) if True will wait for the selected actuators to reach their target positions (they have to be
322
- connected to a method checking for the position and letting the programm know the move is done (default
323
- connection is this object `move_done` method)
386
+ positions: list
387
+ the list of position to apply. Its length must be equal to the number of selected actutors
388
+ mode: str
389
+ either 'abs' for absolute positionning or 'rel' for relative
390
+ polling: bool
391
+ if True will wait for the selected actuators to reach their target positions (they have to be
392
+ connected to a method checking for the position and letting the programm know the move is done (default
393
+ connection is this object `move_done` method)
324
394
 
325
395
  Returns
326
396
  -------
327
397
  (OrderedDict) with the selected actuators's name as key and current actuators's value as value
328
-
329
- See Also
330
- --------
331
- move_done
332
398
  """
333
399
  self.move_done_positions = OrderedDict()
334
400
  self.move_done_flag = False
335
- self.settings.child(('move_done')).setValue(self.move_done_flag)
401
+ self.settings.child('move_done').setValue(self.move_done_flag)
336
402
 
337
403
  if mode == 'abs':
338
- command = 'move_Abs'
404
+ command = 'move_abs'
339
405
  elif mode == 'rel':
340
- command = 'move_Rel'
406
+ command = 'move_rel'
341
407
  else:
342
408
  logger.error(f'Invalid positioning mode: {mode}')
343
409
  return self.move_done_positions
@@ -350,10 +416,13 @@ class ModulesManager(QObject):
350
416
  for k in positions:
351
417
  act = self.get_mod_from_name(k, 'act')
352
418
  if act is not None:
353
- act.command_stage.emit(utils.ThreadCommand(command=command, attributes=[positions[k], polling]))
419
+ #getattr(act, command)(positions[k])
420
+ act.command_hardware.emit(
421
+ utils.ThreadCommand(command=command, attribute=[positions[k], polling]))
354
422
  else:
355
423
  for ind, act in enumerate(self.actuators):
356
- act.command_stage.emit(utils.ThreadCommand(command=command, attributes=[positions[ind], polling]))
424
+ #getattr(act, command)(positions[ind])
425
+ act.command_hardware.emit(utils.ThreadCommand(command=command, attribute=[positions[ind], polling]))
357
426
 
358
427
  else:
359
428
  logger.error('Invalid number of positions compared to selected actuators')
@@ -364,15 +433,19 @@ class ModulesManager(QObject):
364
433
  while not self.move_done_flag: # polling move done
365
434
 
366
435
  QtWidgets.QApplication.processEvents()
367
- if time.perf_counter() - tzero > self.timeout:
436
+ if time.perf_counter() - tzero > self.actuator_timeout / 1000: # timeout in seconds
368
437
  self.timeout_signal.emit(True)
369
- logger.error('Timeout Fired during waiting for data to be acquired')
438
+ logger.error('Timeout Fired during waiting for actuators to be moved')
370
439
  break
371
440
  QThread.msleep(20)
372
441
 
373
442
  self.move_done_signal.emit(self.move_done_positions)
374
443
  return self.move_done_positions
375
444
 
445
+ def reset_signals(self):
446
+ self.move_done_flag = True
447
+ self.det_done_flag = True
448
+
376
449
  def order_positions(self, positions_as_dict):
377
450
  actuators = self.selected_actuators_name
378
451
  pos = []
@@ -380,11 +453,8 @@ class ModulesManager(QObject):
380
453
  pos.append(positions_as_dict[act])
381
454
  return pos
382
455
 
383
- Slot(str, float)
384
-
456
+ @Slot(str, float)
385
457
  def move_done(self, name, position):
386
- """
387
- """
388
458
  try:
389
459
  if name not in list(self.move_done_positions.keys()):
390
460
  self.move_done_positions[name] = position
@@ -395,16 +465,20 @@ class ModulesManager(QObject):
395
465
  except Exception as e:
396
466
  logger.exception(str(e))
397
467
 
398
- @Slot(OrderedDict)
399
- def det_done(self, data):
400
- try:
401
- if data['name'] not in list(self.det_done_datas.keys()):
402
- self.det_done_datas[data['name']] = data
403
- if len(self.det_done_datas.items()) == len(self.detectors):
468
+ def det_done(self, data: DataToExport):
469
+ if self.det_done_datas is not None: # means that somehow data are not initialized so no further processing
470
+ self._received_data += 1
471
+ if len(data) != 0:
472
+ self.det_done_datas.append(data)
473
+
474
+ if self._received_data == len(self.detectors):
404
475
  self.det_done_flag = True
405
- self.settings.child(('det_done')).setValue(self.det_done_flag)
406
- except Exception as e:
407
- logger.exception(str(e))
476
+ self.settings.child('det_done').setValue(self.det_done_flag)
477
+
478
+ # if data.name not in list(self.det_done_datas.keys()):
479
+ # self.det_done_datas[data['name']] = data
480
+ # if len(self.det_done_datas.items()) == len(self.detectors):
481
+ # self.det_done_flag = True
408
482
 
409
483
 
410
484
  if __name__ == '__main__':
@@ -412,10 +486,10 @@ if __name__ == '__main__':
412
486
 
413
487
  app = QtWidgets.QApplication(sys.argv)
414
488
  from qtpy.QtCore import QThread
415
- from pymodaq.daq_utils.gui_utils import DockArea
489
+ from pymodaq.utils.gui_utils import DockArea
416
490
  from pyqtgraph.dockarea import Dock
417
- from pymodaq.daq_viewer.daq_viewer_main import DAQ_Viewer
418
- from pymodaq.daq_move.daq_move_main import DAQ_Move
491
+ from pymodaq.control_modules.daq_viewer import DAQ_Viewer
492
+ from pymodaq.control_modules.daq_move import DAQ_Move
419
493
 
420
494
  win = QtWidgets.QMainWindow()
421
495
  area = DockArea()
@@ -423,9 +497,9 @@ if __name__ == '__main__':
423
497
  win.resize(1000, 500)
424
498
  win.setWindowTitle('pymodaq main')
425
499
 
426
- prog = DAQ_Viewer(area, title="Testing2D", DAQ_type='DAQ2D')
427
- prog2 = DAQ_Viewer(area, title="Testing1D", DAQ_type='DAQ1D')
428
- prog3 = DAQ_Viewer(area, title="Testing0D", DAQ_type='DAQ0D')
500
+ prog = DAQ_Viewer(area, title="Testing2D", daq_type='DAQ2D')
501
+ prog2 = DAQ_Viewer(area, title="Testing1D", daq_type='DAQ1D')
502
+ prog3 = DAQ_Viewer(area, title="Testing0D", daq_type='DAQ0D')
429
503
 
430
504
  act1_widget = QtWidgets.QWidget()
431
505
  act2_widget = QtWidgets.QWidget()
@@ -433,9 +507,9 @@ if __name__ == '__main__':
433
507
  act2 = DAQ_Move(act2_widget, title='Y_axis')
434
508
 
435
509
  QThread.msleep(1000)
436
- prog.ui.IniDet_pb.click()
437
- prog2.ui.IniDet_pb.click()
438
- prog3.ui.IniDet_pb.click()
510
+ prog.init_hardware_ui()
511
+ prog2.init_hardware_ui()
512
+ prog3.init_hardware_ui()
439
513
 
440
514
  dock1 = Dock('actuator 1')
441
515
  dock1.addWidget(act1_widget)
@@ -445,8 +519,8 @@ if __name__ == '__main__':
445
519
  dock2.addWidget(act2_widget)
446
520
  area.addDock(dock2)
447
521
 
448
- act1.ui.IniStage_pb.click()
449
- act2.ui.IniStage_pb.click()
522
+ act1.init_hardware_ui()
523
+ act2.init_hardware_ui()
450
524
 
451
525
  QtWidgets.QApplication.processEvents()
452
526
  win.show()
@@ -2,14 +2,14 @@ from qtpy import QtWidgets
2
2
  import sys
3
3
  import os
4
4
 
5
- from pymodaq.daq_utils.parameter import ioxml
5
+ from pymodaq.utils.parameter import ioxml
6
6
  from pyqtgraph.parametertree import Parameter, ParameterTree
7
7
  from pyqtgraph.parametertree.Parameter import registerParameterType
8
8
  from pyqtgraph.parametertree.parameterTypes.basetypes import GroupParameter
9
- from pymodaq.daq_utils.gui_utils import select_file
9
+ from pymodaq.utils.gui_utils import select_file
10
10
 
11
11
  # check if overshoot_configurations directory exists on the drive
12
- from pymodaq.daq_utils.config import get_set_overshoot_path
12
+ from pymodaq.utils.config import get_set_overshoot_path
13
13
 
14
14
  overshoot_path = get_set_overshoot_path()
15
15