pymodaq 3.6.12__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.12.dist-info → pymodaq-4.0.1.dist-info}/RECORD +167 -170
  139. {pymodaq-3.6.12.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 -671
  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.12.dist-info/METADATA +0 -39
  205. pymodaq-3.6.12.dist-info/entry_points.txt +0 -8
  206. pymodaq-3.6.12.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.12.dist-info → pymodaq-4.0.1.dist-info/licenses}/LICENSE +0 -0
@@ -1,85 +0,0 @@
1
- from qtpy import QtWidgets, QtGui
2
- from qtpy.QtCore import QByteArray
3
- from pyqtgraph.parametertree.parameterTypes.basetypes import WidgetParameterItem
4
-
5
-
6
- class PixmapCheckWidget(QtWidgets.QWidget):
7
- """ value of this parameter is a dict with checked, data for the pixmap and optionally path in h5 node
8
- """
9
-
10
- # valuechanged=Signal(dict)
11
-
12
- def __init__(self):
13
-
14
- super().__init__()
15
- self.path = ''
16
- self.data = None
17
- self.checked = False
18
- self.initUI()
19
-
20
- def initUI(self):
21
- """
22
- Init the User Interface.
23
- """
24
- self.ver_layout = QtWidgets.QVBoxLayout()
25
- self.label = QtWidgets.QLabel()
26
- self.checkbox = QtWidgets.QCheckBox('Show/Hide')
27
- self.info = QtWidgets.QLineEdit()
28
- self.info.setReadOnly(True)
29
- self.checkbox.setChecked(False)
30
- self.ver_layout.addWidget(self.label)
31
- self.ver_layout.addWidget(self.info)
32
- self.ver_layout.addWidget(self.checkbox)
33
- self.ver_layout.setSpacing(0)
34
- self.ver_layout.setContentsMargins(0, 0, 0, 0)
35
- self.setLayout(self.ver_layout)
36
-
37
- def setValue(self, dic):
38
- if 'data' in dic:
39
- if not isinstance(dic['data'], QtGui.QPixmap):
40
- self.data = QByteArray(dic['data'])
41
- im = QtGui.QImage.fromData(self.data)
42
- a = QtGui.QPixmap.fromImage(im)
43
- else:
44
- a = dic['data']
45
- else:
46
- a = dic['pixmap']
47
- if 'path' in dic:
48
- self.path = dic['path']
49
- else:
50
- self.path = ''
51
- if 'info' in dic:
52
- info = dic['info']
53
- else:
54
- info = ''
55
- self.label.setPixmap(a)
56
- self.checkbox.setChecked(dic['checked'])
57
- self.info.setText(info)
58
- # self.valuechanged.emit(dic)
59
-
60
- def value(self):
61
- return dict(pixmap=self.label.pixmap(), checked=self.checkbox.isChecked(), path=self.path)
62
-
63
-
64
- class PixmapParameterItem(WidgetParameterItem):
65
- """Registered parameter type which displays a QLineEdit"""
66
-
67
- def makeWidget(self):
68
- w = QtWidgets.QLabel()
69
- w.sigChanged = None
70
- w.value = w.pixmap
71
- w.setValue = w.setPixmap
72
- return w
73
-
74
-
75
- class PixmapCheckParameterItem(WidgetParameterItem):
76
- """Registered parameter type which displays a QLineEdit"""
77
-
78
- def makeWidget(self):
79
- w = PixmapCheckWidget()
80
- w.sigChanged = w.checkbox.toggled
81
- w.value = w.value
82
- w.setValue = w.setValue
83
- return w
84
-
85
-
@@ -1,136 +0,0 @@
1
- def get_widget_from_tree(parameter_tree, widget_instance):
2
- widgets = []
3
- for item in parameter_tree.listAllItems():
4
- if hasattr(item, 'widget'):
5
- if isinstance(item.widget, widget_instance):
6
- widgets.append(item.widget)
7
- return widgets
8
-
9
-
10
- def get_param_path(param):
11
- """
12
-
13
- Parameters
14
- ----------
15
- param
16
-
17
- Returns
18
- -------
19
-
20
- """
21
- path = [param.name()]
22
- while param.parent() is not None:
23
- path.append(param.parent().name())
24
- param = param.parent()
25
- return path[::-1]
26
-
27
-
28
-
29
- def iter_children(param, childlist=[]):
30
- """Get a list of parameters name under a given Parameter
31
- | Returns all childrens names.
32
-
33
- =============== ================================= ====================================
34
- **Parameters** **Type** **Description**
35
- *param* instance of pyqtgraph parameter the root node to be coursed
36
- *childlist* list the child list recetion structure
37
- =============== ================================= ====================================
38
-
39
- Returns
40
- -------
41
- childlist : parameter list
42
- The list of the children from the given node.
43
- """
44
- for child in param.children():
45
- childlist.append(child.name())
46
- if 'group' in child.type():
47
- childlist.extend(iter_children(child, []))
48
- return childlist
49
-
50
-
51
- def iter_children_params(param, childlist=[]):
52
- """Get a list of parameters under a given Parameter
53
-
54
- """
55
- for child in param.children():
56
- childlist.append(child)
57
- if 'group' in child.type():
58
- childlist.extend(iter_children_params(child, []))
59
- return childlist
60
-
61
-
62
- def get_param_from_name(parent, name):
63
- """Get Parameter under parent whose name is name
64
-
65
- Parameters
66
- ----------
67
- parent: Parameter
68
- name: str
69
-
70
- Returns
71
- -------
72
- Parameter
73
- """
74
- for child in parent.children():
75
- if child.name() == name:
76
- return child
77
- if 'group' in child.type():
78
- ch = get_param_from_name(child, name)
79
- if ch is not None:
80
- return ch
81
-
82
-
83
- def is_name_in_dict(dict_tmp, name):
84
- if 'name' in dict_tmp:
85
- if dict_tmp['name'] == name:
86
- return True
87
- return False
88
-
89
-
90
- def get_param_dict_from_name(parent_list, name, pop=False):
91
- """Get dict under parent whose name is name. The parent_list structure is the one used to init a Parameter object
92
-
93
- Parameters
94
- ----------
95
- parent_list: (list of dicts) as defined to init Parameter object
96
- name: (str) value to find for the key: name
97
- pop: (bool) if True remove the matched dict from parent
98
-
99
- Returns
100
- -------
101
- dict the matched dict
102
- """
103
- for index, parent_dict in enumerate(parent_list):
104
- if is_name_in_dict(parent_dict, name):
105
- if pop:
106
- return parent_list.pop(index)
107
- else:
108
- return parent_dict
109
-
110
- elif 'children' in parent_dict:
111
- ch = get_param_dict_from_name(parent_dict['children'], name, pop)
112
- if ch is not None:
113
- return ch
114
-
115
-
116
-
117
- if __name__ == '__main__': # pragma: no cover
118
- parent = [
119
- {'title': 'Spectro Settings:', 'name': 'spectro_settings', 'type': 'group', 'expanded': True,
120
- 'children': [
121
- {'title': 'Home Wavelength (nm):', 'name': 'spectro_wl_home', 'type': 'float', 'value': 600, 'min': 0,
122
- 'readonly': False},
123
- {'title': 'Grating Settings:', 'name': 'grating_settings', 'type': 'group', 'expanded': True,
124
- 'children': [
125
- {'title': 'Grating:', 'name': 'grating', 'type': 'list'},
126
- {'title': 'Lines (/mm):', 'name': 'lines', 'type': 'int', 'readonly': True},
127
- {'title': 'Blaze WL (nm):', 'name': 'blaze', 'type': 'str', 'readonly': True},
128
- ]},
129
- ]
130
- },
131
- ]
132
-
133
- d = get_param_dict_from_name(parent, 'lines')
134
-
135
- d['readonly'] = False
136
- print(parent[0]['children'][1]['children'])
File without changes
@@ -1,2 +0,0 @@
1
- cd "C:\Users\Weber\Labo\Programmes Python\DAQ\DAQ_Utils\plotting\viewer0D"
2
- C:\WPy-3710\python-3.7.1.amd64\Scripts\pyuic5.bat -x viewer0D_GUI.ui -o viewer0D_GUI.py
@@ -1,204 +0,0 @@
1
- from qtpy import QtWidgets
2
- from qtpy.QtCore import QObject, Slot, Signal
3
- import sys
4
- import pymodaq.daq_utils.daq_utils as utils
5
- from pymodaq.daq_utils.plotting.data_viewers.viewer0D_GUI import Ui_Form
6
-
7
- import numpy as np
8
- from collections import OrderedDict
9
- import datetime
10
-
11
- logger = utils.set_logger(utils.get_module_name(__file__))
12
-
13
-
14
- class Viewer0D(QtWidgets.QWidget, QObject):
15
- data_to_export_signal = Signal(OrderedDict) # edict(name=self.DAQ_type,data0D=None,data1D=None,data2D=None)
16
-
17
- def __init__(self, parent=None, dock=None):
18
- """
19
-
20
- """
21
-
22
- super(Viewer0D, self).__init__()
23
- if parent is None:
24
- parent = QtWidgets.QWidget()
25
- self.parent = parent
26
- self.title = 'viewer0D' # is changed when used from DAQ_Viewer
27
- self.ui = Ui_Form()
28
- self.ui.setupUi(parent)
29
-
30
- # self.ui.statusbar = QtWidgets.QStatusBar(parent)
31
- # self.ui.statusbar.setMaximumHeight(15)
32
- # self.ui.StatusBarLayout.addWidget(self.ui.statusbar)
33
- # self.ui.status_message = QtWidgets.QLabel()
34
- # self.ui.status_message.setMaximumHeight(15)
35
- # self.ui.statusbar.addWidget(self.ui.status_message)
36
-
37
- self.ui.xaxis_item = self.ui.Graph1D.plotItem.getAxis('bottom')
38
-
39
- self._labels = []
40
- self.viewer_type = 'Data0D'
41
- self.wait_time = 1000
42
-
43
- self.plot_channels = None
44
- self.plot_colors = utils.plot_colors
45
-
46
- self.Nsamples = self.ui.Nhistory_sb.value()
47
-
48
- self.x_axis = np.linspace(0, self.Nsamples - 1, self.Nsamples)
49
- self.datas = [] # datas on each channel. list of 1D arrays
50
- self.legend = self.ui.Graph1D.plotItem.addLegend()
51
- self.data_to_export = None
52
- self.list_items = None
53
-
54
- # #Connecting buttons:
55
- self.ui.clear_pb.clicked.connect(self.clear_data)
56
- self.ui.Nhistory_sb.valueChanged.connect(self.update_x_axis)
57
- self.ui.show_datalist_pb.clicked.connect(self.show_data_list)
58
-
59
- self.show_data_list(False)
60
-
61
- def clear_data(self):
62
- N = len(self.datas)
63
- self.datas = []
64
- for ind in range(N):
65
- self.datas.append(np.array([]))
66
- self.x_axis = np.array([])
67
- for ind_plot, data in enumerate(self.datas):
68
- self.plot_channels[ind_plot].setData(x=self.x_axis, y=data)
69
-
70
- @Slot(list)
71
- def show_data(self, datas):
72
- """
73
-
74
- Parameters
75
- ----------
76
- datas: list of list of one float
77
-
78
- """
79
- try:
80
- self.data_to_export = OrderedDict(name=self.title, data0D=OrderedDict(), data1D=None, data2D=None)
81
- if self.plot_channels is None or len(self.plot_channels) != len(datas):
82
- # if self.plot_channels!=None:
83
- # if len(self.plot_channels) != len(datas):
84
- # for channel in self.plot_channels:
85
- # self.ui.Graph1D.removeItem(channel)
86
- self.update_channels()
87
-
88
- if self.labels == [] or len(self.labels) != len(datas):
89
- self._labels = ["CH{}".format(ind) for ind in range(len(datas))]
90
-
91
- self.plot_channels = []
92
- self.datas = []
93
- self.ui.values_list.clear()
94
- self.ui.values_list.addItems(['{:.06e}'.format(data[0]) for data in datas])
95
- self.list_items = [self.ui.values_list.item(ind) for ind in range(self.ui.values_list.count())]
96
- for ind in range(len(datas)):
97
- self.datas.append(np.array([]))
98
- # channel=self.ui.Graph1D.plot(np.array([]))
99
- # channel=self.ui.Graph1D.plot(y=np.array([]), name=self._labels[ind])
100
- channel = self.ui.Graph1D.plot(y=np.array([]))
101
- channel.setPen(self.plot_colors[ind])
102
- # self.legend.addItem(channel,"CH{}".format(ind))
103
- self.plot_channels.append(channel)
104
- self.update_labels(self._labels)
105
-
106
- for ind, data in enumerate(datas):
107
- self.list_items[ind].setText('{:.06e}'.format(data[0]))
108
-
109
- self.update_Graph1D(datas)
110
- except Exception as e:
111
- logger.exception(str(e))
112
-
113
- def show_data_list(self, state=None):
114
- if state is None:
115
- state = self.ui.show_datalist_pb.isChecked()
116
- self.ui.values_list.setVisible(state)
117
-
118
- @Slot(list)
119
- def show_data_temp(self, datas):
120
- """
121
- to plot temporary data, for instance when all pixels are not yet populated...
122
- """
123
- pass
124
-
125
- def update_Graph1D(self, datas):
126
- try:
127
- data_tot = []
128
- L = len(self.datas[0]) + 1
129
- if L > self.Nsamples:
130
- self.x_axis += 1
131
- else:
132
- self.x_axis = np.linspace(0, L - 1, L)
133
- for ind_plot, data in enumerate(datas):
134
- data_tmp = self.datas[ind_plot]
135
- data_tmp = np.append(data_tmp, data)
136
-
137
- if len(data_tmp) > self.Nsamples:
138
- data_tmp = data_tmp[L - self.Nsamples:]
139
-
140
- data_tot.append(data_tmp)
141
-
142
- self.plot_channels[ind_plot].setData(x=self.x_axis, y=data_tmp)
143
- self.data_to_export['data0D']['CH{:03d}'.format(ind_plot)] = utils.DataToExport(name=self.title,
144
- data=data[0],
145
- source='raw')
146
- self.datas = data_tot
147
-
148
- self.data_to_export['acq_time_s'] = datetime.datetime.now().timestamp()
149
- self.data_to_export_signal.emit(self.data_to_export)
150
-
151
- except Exception as e:
152
- logger.exception(str(e))
153
-
154
- def update_channels(self):
155
- if self.plot_channels is not None:
156
- for ind, item in enumerate(self.plot_channels):
157
- self.legend.removeItem(item.name())
158
- self.ui.Graph1D.removeItem(item)
159
- self.plot_channels = None
160
-
161
- def update_labels(self, labels):
162
- try:
163
- items = [item[1].text for item in self.legend.items]
164
- for item in items:
165
- self.legend.removeItem(item)
166
-
167
- if len(labels) == len(self.plot_channels):
168
- for ind, channel in enumerate(self.plot_channels):
169
- self.legend.addItem(channel, self._labels[ind])
170
- except Exception as e:
171
- logger.warning(str(e) + 'plot channels not yet declared')
172
-
173
- def update_status(self, txt, wait_time=0):
174
- logger.info(txt)
175
-
176
- def update_x_axis(self, Nhistory):
177
- self.Nsamples = Nhistory
178
- self.x_axis = np.linspace(0, self.Nsamples - 1, self.Nsamples)
179
-
180
- @property
181
- def labels(self):
182
- return self._labels
183
-
184
- @labels.setter
185
- def labels(self, labels):
186
- self._labels = labels
187
- self.update_labels(labels)
188
-
189
-
190
- if __name__ == '__main__': # pragma: no cover
191
- app = QtWidgets.QApplication(sys.argv)
192
- Form = QtWidgets.QWidget()
193
- prog = Viewer0D(Form)
194
- from pymodaq.daq_utils.daq_utils import gauss1D
195
-
196
- x = np.linspace(0, 200, 201)
197
- y1 = gauss1D(x, 75, 25)
198
- y2 = gauss1D(x, 120, 50, 2)
199
- Form.show()
200
- for ind, data in enumerate(y1):
201
- prog.show_data([[data], [y2[ind]]])
202
- QtWidgets.QApplication.processEvents()
203
-
204
- sys.exit(app.exec_())
@@ -1,89 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Form implementation generated from reading ui file 'viewer0D_GUI.ui'
4
- #
5
- # Created by: qtpy UI code generator 5.9.2
6
- #
7
- # WARNING! All changes made in this file will be lost!
8
-
9
- from qtpy import QtCore, QtGui, QtWidgets
10
- from pyqtgraph import PlotWidget
11
- from pymodaq.resources.QtDesigner_Ressources import QtDesigner_ressources_rc
12
-
13
-
14
- class Ui_Form(object):
15
- def setupUi(self, Form):
16
- Form.setObjectName("Form")
17
- Form.resize(598, 336)
18
- self.gridLayout = QtWidgets.QGridLayout(Form)
19
- self.gridLayout.setObjectName("gridLayout")
20
- self.splitter = QtWidgets.QSplitter(Form)
21
- self.splitter.setOrientation(QtCore.Qt.Horizontal)
22
- self.splitter.setObjectName("splitter")
23
- self.verticalLayoutWidget = QtWidgets.QWidget(self.splitter)
24
- self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
25
- self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
26
- self.verticalLayout.setContentsMargins(0, 0, 0, 0)
27
- self.verticalLayout.setObjectName("verticalLayout")
28
- self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
29
- self.horizontalLayout_2.setSpacing(0)
30
- self.horizontalLayout_2.setObjectName("horizontalLayout_2")
31
- self.Nhistory_sb = QtWidgets.QSpinBox(self.verticalLayoutWidget)
32
- self.Nhistory_sb.setReadOnly(False)
33
- self.Nhistory_sb.setMinimum(1)
34
- self.Nhistory_sb.setMaximum(1000000)
35
- self.Nhistory_sb.setSingleStep(100)
36
- self.Nhistory_sb.setProperty("value", 200)
37
- self.Nhistory_sb.setObjectName("Nhistory_sb")
38
- self.horizontalLayout_2.addWidget(self.Nhistory_sb)
39
- self.clear_pb = QtWidgets.QPushButton(self.verticalLayoutWidget)
40
- self.clear_pb.setText("")
41
- icon = QtGui.QIcon()
42
- icon.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/clear2.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
43
- self.clear_pb.setIcon(icon)
44
- self.clear_pb.setCheckable(False)
45
- self.clear_pb.setObjectName("clear_pb")
46
- self.horizontalLayout_2.addWidget(self.clear_pb)
47
- self.show_datalist_pb = QtWidgets.QPushButton(self.verticalLayoutWidget)
48
- self.show_datalist_pb.setText("")
49
- icon1 = QtGui.QIcon()
50
- icon1.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/ChnNum.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
51
- self.show_datalist_pb.setIcon(icon1)
52
- self.show_datalist_pb.setCheckable(True)
53
- self.show_datalist_pb.setObjectName("show_datalist_pb")
54
- self.horizontalLayout_2.addWidget(self.show_datalist_pb)
55
- spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
56
- self.horizontalLayout_2.addItem(spacerItem)
57
- self.verticalLayout.addLayout(self.horizontalLayout_2)
58
- self.Graph1D = PlotWidget(self.verticalLayoutWidget)
59
- self.Graph1D.setObjectName("Graph1D")
60
- self.verticalLayout.addWidget(self.Graph1D)
61
- self.values_list = QtWidgets.QListWidget(self.splitter)
62
- font = QtGui.QFont()
63
- font.setPointSize(20)
64
- self.values_list.setFont(font)
65
- self.values_list.setObjectName("values_list")
66
- self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
67
- self.StatusBarLayout = QtWidgets.QHBoxLayout()
68
- self.StatusBarLayout.setObjectName("StatusBarLayout")
69
- self.gridLayout.addLayout(self.StatusBarLayout, 1, 0, 1, 1)
70
-
71
- self.retranslateUi(Form)
72
- QtCore.QMetaObject.connectSlotsByName(Form)
73
-
74
- def retranslateUi(self, Form):
75
- _translate = QtCore.QCoreApplication.translate
76
- Form.setWindowTitle(_translate("Form", "Form"))
77
- self.Nhistory_sb.setToolTip(_translate("Form", "N samples in plot"))
78
- self.clear_pb.setToolTip(_translate("Form", "Clear plot"))
79
- self.show_datalist_pb.setToolTip(_translate("Form", "Show current data in a list"))
80
-
81
-
82
- if __name__ == "__main__": # pragma: no cover
83
- import sys
84
- app = QtWidgets.QApplication(sys.argv)
85
- Form = QtWidgets.QWidget()
86
- ui = Ui_Form()
87
- ui.setupUi(Form)
88
- Form.show()
89
- sys.exit(app.exec_())
@@ -1,131 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <ui version="4.0">
3
- <class>Form</class>
4
- <widget class="QWidget" name="Form">
5
- <property name="geometry">
6
- <rect>
7
- <x>0</x>
8
- <y>0</y>
9
- <width>598</width>
10
- <height>336</height>
11
- </rect>
12
- </property>
13
- <property name="windowTitle">
14
- <string>Form</string>
15
- </property>
16
- <layout class="QGridLayout" name="gridLayout">
17
- <item row="0" column="0">
18
- <widget class="QSplitter" name="splitter">
19
- <property name="orientation">
20
- <enum>Qt::Horizontal</enum>
21
- </property>
22
- <widget class="QWidget" name="verticalLayoutWidget">
23
- <layout class="QVBoxLayout" name="verticalLayout">
24
- <item>
25
- <layout class="QHBoxLayout" name="horizontalLayout_2">
26
- <property name="spacing">
27
- <number>0</number>
28
- </property>
29
- <item>
30
- <widget class="QSpinBox" name="Nhistory_sb">
31
- <property name="toolTip">
32
- <string>N samples in plot</string>
33
- </property>
34
- <property name="readOnly">
35
- <bool>false</bool>
36
- </property>
37
- <property name="minimum">
38
- <number>1</number>
39
- </property>
40
- <property name="maximum">
41
- <number>1000000</number>
42
- </property>
43
- <property name="singleStep">
44
- <number>100</number>
45
- </property>
46
- <property name="value">
47
- <number>200</number>
48
- </property>
49
- </widget>
50
- </item>
51
- <item>
52
- <widget class="QPushButton" name="clear_pb">
53
- <property name="toolTip">
54
- <string>Clear plot</string>
55
- </property>
56
- <property name="text">
57
- <string/>
58
- </property>
59
- <property name="icon">
60
- <iconset resource="../../../QtDesigner_Ressources/QtDesigner_ressources.qrc">
61
- <normaloff>:/icons/Icon_Library/clear2.png</normaloff>:/icons/Icon_Library/clear2.png</iconset>
62
- </property>
63
- <property name="checkable">
64
- <bool>false</bool>
65
- </property>
66
- </widget>
67
- </item>
68
- <item>
69
- <widget class="QPushButton" name="show_datalist_pb">
70
- <property name="toolTip">
71
- <string>Show current data in a list</string>
72
- </property>
73
- <property name="text">
74
- <string/>
75
- </property>
76
- <property name="icon">
77
- <iconset resource="../../../QtDesigner_Ressources/QtDesigner_ressources.qrc">
78
- <normaloff>:/icons/Icon_Library/ChnNum.png</normaloff>:/icons/Icon_Library/ChnNum.png</iconset>
79
- </property>
80
- <property name="checkable">
81
- <bool>true</bool>
82
- </property>
83
- </widget>
84
- </item>
85
- <item>
86
- <spacer name="horizontalSpacer_2">
87
- <property name="orientation">
88
- <enum>Qt::Horizontal</enum>
89
- </property>
90
- <property name="sizeHint" stdset="0">
91
- <size>
92
- <width>40</width>
93
- <height>20</height>
94
- </size>
95
- </property>
96
- </spacer>
97
- </item>
98
- </layout>
99
- </item>
100
- <item>
101
- <widget class="PlotWidget" name="Graph1D"/>
102
- </item>
103
- </layout>
104
- </widget>
105
- <widget class="QListWidget" name="values_list">
106
- <property name="font">
107
- <font>
108
- <pointsize>20</pointsize>
109
- </font>
110
- </property>
111
- </widget>
112
- </widget>
113
- </item>
114
- <item row="1" column="0">
115
- <layout class="QHBoxLayout" name="StatusBarLayout"/>
116
- </item>
117
- </layout>
118
- </widget>
119
- <customwidgets>
120
- <customwidget>
121
- <class>PlotWidget</class>
122
- <extends>QGraphicsView</extends>
123
- <header>pyqtgraph</header>
124
- <container>1</container>
125
- </customwidget>
126
- </customwidgets>
127
- <resources>
128
- <include location="../../../QtDesigner_Ressources/QtDesigner_ressources.qrc"/>
129
- </resources>
130
- <connections/>
131
- </ui>