pymodaq 5.1.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. pymodaq/__init__.py +98 -0
  2. pymodaq/control_modules/__init__.py +1 -0
  3. pymodaq/control_modules/daq_move.py +1238 -0
  4. pymodaq/control_modules/daq_move_ui/__init__.py +0 -0
  5. pymodaq/control_modules/daq_move_ui/factory.py +48 -0
  6. pymodaq/control_modules/daq_move_ui/ui_base.py +359 -0
  7. pymodaq/control_modules/daq_move_ui/uis/__init__.py +0 -0
  8. pymodaq/control_modules/daq_move_ui/uis/binary.py +139 -0
  9. pymodaq/control_modules/daq_move_ui/uis/original.py +120 -0
  10. pymodaq/control_modules/daq_move_ui/uis/relative.py +124 -0
  11. pymodaq/control_modules/daq_move_ui/uis/simple.py +126 -0
  12. pymodaq/control_modules/daq_viewer.py +1517 -0
  13. pymodaq/control_modules/daq_viewer_ui.py +407 -0
  14. pymodaq/control_modules/mocks.py +57 -0
  15. pymodaq/control_modules/move_utility_classes.py +1141 -0
  16. pymodaq/control_modules/thread_commands.py +137 -0
  17. pymodaq/control_modules/ui_utils.py +72 -0
  18. pymodaq/control_modules/utils.py +591 -0
  19. pymodaq/control_modules/viewer_utility_classes.py +670 -0
  20. pymodaq/daq_utils/__init__.py +0 -0
  21. pymodaq/daq_utils/daq_utils.py +6 -0
  22. pymodaq/dashboard.py +2396 -0
  23. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_Client.aliases +3 -0
  24. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_Client.lvlps +3 -0
  25. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_Client.lvproj +32 -0
  26. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_Client.vi +0 -0
  27. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_Server_1Dgaussian.vi +0 -0
  28. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_Server_2Dgaussian.vi +0 -0
  29. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_read_cmd.vi +0 -0
  30. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_read_float.vi +0 -0
  31. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_read_int.vi +0 -0
  32. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_send_data.vi +0 -0
  33. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_send_int.vi +0 -0
  34. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_send_scalar.vi +0 -0
  35. pymodaq/examples/Labview_TCP_Client/DAQ_TCP_send_string.vi +0 -0
  36. pymodaq/examples/Labview_TCP_Client/client_state.ctl +0 -0
  37. pymodaq/examples/Labview_TCP_Client/cmd_types.ctl +0 -0
  38. pymodaq/examples/__init__.py +0 -0
  39. pymodaq/examples/function_plotter.py +160 -0
  40. pymodaq/examples/nonlinearscanner.py +126 -0
  41. pymodaq/examples/qt_less_standalone_module.py +165 -0
  42. pymodaq/examples/tcp_client.py +97 -0
  43. pymodaq/extensions/__init__.py +25 -0
  44. pymodaq/extensions/adaptive/__init__.py +2 -0
  45. pymodaq/extensions/adaptive/adaptive_optimization.py +179 -0
  46. pymodaq/extensions/adaptive/loss_function/_1d_loss_functions.py +73 -0
  47. pymodaq/extensions/adaptive/loss_function/_2d_loss_functions.py +73 -0
  48. pymodaq/extensions/adaptive/loss_function/__init__.py +3 -0
  49. pymodaq/extensions/adaptive/loss_function/loss_factory.py +110 -0
  50. pymodaq/extensions/adaptive/utils.py +123 -0
  51. pymodaq/extensions/bayesian/__init__.py +2 -0
  52. pymodaq/extensions/bayesian/acquisition/__init__.py +2 -0
  53. pymodaq/extensions/bayesian/acquisition/acquisition_function_factory.py +80 -0
  54. pymodaq/extensions/bayesian/acquisition/base_acquisition_function.py +105 -0
  55. pymodaq/extensions/bayesian/bayesian_optimization.py +143 -0
  56. pymodaq/extensions/bayesian/utils.py +180 -0
  57. pymodaq/extensions/console.py +73 -0
  58. pymodaq/extensions/daq_logger/__init__.py +1 -0
  59. pymodaq/extensions/daq_logger/abstract.py +52 -0
  60. pymodaq/extensions/daq_logger/daq_logger.py +519 -0
  61. pymodaq/extensions/daq_logger/db/__init__.py +0 -0
  62. pymodaq/extensions/daq_logger/db/db_logger.py +300 -0
  63. pymodaq/extensions/daq_logger/db/db_logger_models.py +100 -0
  64. pymodaq/extensions/daq_logger/h5logging.py +84 -0
  65. pymodaq/extensions/daq_scan.py +1218 -0
  66. pymodaq/extensions/daq_scan_ui.py +241 -0
  67. pymodaq/extensions/data_mixer/__init__.py +0 -0
  68. pymodaq/extensions/data_mixer/daq_0Dviewer_DataMixer.py +97 -0
  69. pymodaq/extensions/data_mixer/data_mixer.py +262 -0
  70. pymodaq/extensions/data_mixer/model.py +108 -0
  71. pymodaq/extensions/data_mixer/models/__init__.py +0 -0
  72. pymodaq/extensions/data_mixer/models/equation_model.py +91 -0
  73. pymodaq/extensions/data_mixer/models/gaussian_fit_model.py +65 -0
  74. pymodaq/extensions/data_mixer/parser.py +53 -0
  75. pymodaq/extensions/data_mixer/utils.py +23 -0
  76. pymodaq/extensions/h5browser.py +9 -0
  77. pymodaq/extensions/optimizers_base/__init__.py +0 -0
  78. pymodaq/extensions/optimizers_base/optimizer.py +1016 -0
  79. pymodaq/extensions/optimizers_base/thread_commands.py +22 -0
  80. pymodaq/extensions/optimizers_base/utils.py +427 -0
  81. pymodaq/extensions/pid/__init__.py +16 -0
  82. pymodaq/extensions/pid/actuator_controller.py +14 -0
  83. pymodaq/extensions/pid/daq_move_PID.py +154 -0
  84. pymodaq/extensions/pid/pid_controller.py +1016 -0
  85. pymodaq/extensions/pid/utils.py +189 -0
  86. pymodaq/extensions/utils.py +111 -0
  87. pymodaq/icon.ico +0 -0
  88. pymodaq/post_treatment/__init__.py +6 -0
  89. pymodaq/post_treatment/load_and_plot.py +352 -0
  90. pymodaq/resources/__init__.py +0 -0
  91. pymodaq/resources/config_template.toml +57 -0
  92. pymodaq/resources/preset_default.xml +1 -0
  93. pymodaq/resources/setup_plugin.py +73 -0
  94. pymodaq/splash.png +0 -0
  95. pymodaq/utils/__init__.py +0 -0
  96. pymodaq/utils/array_manipulation.py +6 -0
  97. pymodaq/utils/calibration_camera.py +180 -0
  98. pymodaq/utils/chrono_timer.py +203 -0
  99. pymodaq/utils/config.py +53 -0
  100. pymodaq/utils/conftests.py +5 -0
  101. pymodaq/utils/daq_utils.py +158 -0
  102. pymodaq/utils/data.py +128 -0
  103. pymodaq/utils/enums.py +6 -0
  104. pymodaq/utils/exceptions.py +38 -0
  105. pymodaq/utils/gui_utils/__init__.py +10 -0
  106. pymodaq/utils/gui_utils/loader_utils.py +75 -0
  107. pymodaq/utils/gui_utils/utils.py +18 -0
  108. pymodaq/utils/gui_utils/widgets/lcd.py +8 -0
  109. pymodaq/utils/h5modules/__init__.py +2 -0
  110. pymodaq/utils/h5modules/module_saving.py +526 -0
  111. pymodaq/utils/leco/__init__.py +25 -0
  112. pymodaq/utils/leco/daq_move_LECODirector.py +217 -0
  113. pymodaq/utils/leco/daq_xDviewer_LECODirector.py +163 -0
  114. pymodaq/utils/leco/director_utils.py +74 -0
  115. pymodaq/utils/leco/leco_director.py +166 -0
  116. pymodaq/utils/leco/pymodaq_listener.py +364 -0
  117. pymodaq/utils/leco/rpc_method_definitions.py +43 -0
  118. pymodaq/utils/leco/utils.py +74 -0
  119. pymodaq/utils/logger.py +6 -0
  120. pymodaq/utils/managers/__init__.py +0 -0
  121. pymodaq/utils/managers/batchscan_manager.py +346 -0
  122. pymodaq/utils/managers/modules_manager.py +589 -0
  123. pymodaq/utils/managers/overshoot_manager.py +242 -0
  124. pymodaq/utils/managers/preset_manager.py +229 -0
  125. pymodaq/utils/managers/preset_manager_utils.py +262 -0
  126. pymodaq/utils/managers/remote_manager.py +484 -0
  127. pymodaq/utils/math_utils.py +6 -0
  128. pymodaq/utils/messenger.py +6 -0
  129. pymodaq/utils/parameter/__init__.py +10 -0
  130. pymodaq/utils/parameter/utils.py +6 -0
  131. pymodaq/utils/scanner/__init__.py +5 -0
  132. pymodaq/utils/scanner/scan_config.py +16 -0
  133. pymodaq/utils/scanner/scan_factory.py +259 -0
  134. pymodaq/utils/scanner/scan_selector.py +477 -0
  135. pymodaq/utils/scanner/scanner.py +324 -0
  136. pymodaq/utils/scanner/scanners/_1d_scanners.py +174 -0
  137. pymodaq/utils/scanner/scanners/_2d_scanners.py +299 -0
  138. pymodaq/utils/scanner/scanners/__init__.py +1 -0
  139. pymodaq/utils/scanner/scanners/sequential.py +224 -0
  140. pymodaq/utils/scanner/scanners/tabular.py +319 -0
  141. pymodaq/utils/scanner/utils.py +110 -0
  142. pymodaq/utils/svg/__init__.py +6 -0
  143. pymodaq/utils/svg/svg_renderer.py +20 -0
  144. pymodaq/utils/svg/svg_view.py +35 -0
  145. pymodaq/utils/svg/svg_viewer2D.py +50 -0
  146. pymodaq/utils/tcp_ip/__init__.py +6 -0
  147. pymodaq/utils/tcp_ip/mysocket.py +12 -0
  148. pymodaq/utils/tcp_ip/serializer.py +13 -0
  149. pymodaq/utils/tcp_ip/tcp_server_client.py +772 -0
  150. pymodaq-5.1.6.dist-info/METADATA +238 -0
  151. pymodaq-5.1.6.dist-info/RECORD +154 -0
  152. pymodaq-5.1.6.dist-info/WHEEL +4 -0
  153. pymodaq-5.1.6.dist-info/entry_points.txt +7 -0
  154. pymodaq-5.1.6.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,346 @@
1
+ from collections import OrderedDict
2
+ from pathlib import Path
3
+ import sys
4
+ from typing import List
5
+
6
+ from qtpy import QtWidgets, QtCore
7
+ from qtpy.QtWidgets import QMessageBox, QDialog, QDialogButtonBox
8
+
9
+ from pymodaq_utils.logger import set_logger, get_module_name
10
+ from pymodaq_utils import config as config_mod
11
+
12
+ from pymodaq_gui.managers.parameter_manager import ParameterManager
13
+ from pymodaq_gui.utils import Dock, file_io, DockArea
14
+ from pymodaq_gui.parameter import ioxml
15
+ from pymodaq_gui.messenger import messagebox
16
+
17
+ from pymodaq.utils.managers.modules_manager import ModulesManager
18
+ from pymodaq.utils.scanner import Scanner
19
+ from pymodaq.utils.scanner.scan_factory import ScannerBase
20
+ from pymodaq.utils.config import get_set_batch_path
21
+
22
+ logger = set_logger(get_module_name(__file__))
23
+
24
+ batch_path = get_set_batch_path()
25
+
26
+ params = [
27
+ {'title': 'Actuators/Detectors Selection', 'name': 'modules', 'type': 'group', 'children': [
28
+ {'title': 'detectors', 'name': 'detectors', 'type': 'itemselect'},
29
+ {'title': 'Actuators', 'name': 'actuators', 'type': 'itemselect'},
30
+ ]},
31
+ ]
32
+
33
+
34
+ class BatchManager(ParameterManager):
35
+ settings_name = 'batch_settings'
36
+ params = [{'title': 'Filename:', 'name': 'filename', 'type': 'str', 'value': 'batch_default'},
37
+ {'title': 'Scans', 'name': 'scans', 'type': 'group', 'children': []}]
38
+
39
+ def __init__(self, msgbox=False, actuators=[], detectors=[], path=None):
40
+ super().__init__()
41
+
42
+ self.modules_manager: ModulesManager = ModulesManager(detectors, actuators)
43
+ self.modules_manager.show_only_control_modules(True)
44
+ self.modules_manager.actuators_changed[list].connect(self.update_actuators)
45
+ self.modules_manager.settings_tree.setMinimumHeight(200)
46
+ self.modules_manager.settings_tree.setMaximumHeight(200)
47
+
48
+ self._scans = OrderedDict([])
49
+
50
+ self.scanner = Scanner(actuators=self.modules_manager.actuators_all)
51
+
52
+ self.settings_tree.setMinimumWidth(400)
53
+ self.settings_tree.setMaximumWidth(500)
54
+ self.settings_tree.setMinimumHeight(500)
55
+
56
+ if path is None:
57
+ path = batch_path
58
+ else:
59
+ assert isinstance(path, Path)
60
+ self.batch_path = path
61
+
62
+ if msgbox:
63
+ msgBox = QMessageBox()
64
+ msgBox.setText("Scan Batch Manager?")
65
+ msgBox.setInformativeText("What do you want to do?")
66
+ cancel_button = msgBox.addButton(QMessageBox.StandardButton.Cancel)
67
+ new_button = msgBox.addButton("New", QMessageBox.ButtonRole.AcceptRole)
68
+ modify_button = msgBox.addButton('Modify', QMessageBox.ButtonRole.AcceptRole)
69
+ msgBox.setDefaultButton(QMessageBox.StandardButton.Cancel)
70
+ ret = msgBox.exec()
71
+
72
+ if msgBox.clickedButton() == new_button:
73
+ self.set_new_batch()
74
+
75
+ elif msgBox.clickedButton() == modify_button:
76
+ self.set_file_batch()
77
+ else: # cancel
78
+ pass
79
+
80
+ def get_act_dets(self):
81
+ acts = dict([])
82
+ dets = dict([])
83
+ for name in [child.name() for child in self.settings.child('scans').children()]:
84
+ acts[name] = self.settings.child('scans', name, 'modules', 'actuators').value()['selected']
85
+ dets[name] = self.settings.child('scans', name, 'modules', 'detectors').value()['selected']
86
+ return acts, dets
87
+
88
+ def set_file_batch(self, filename=None, show=True):
89
+ """
90
+
91
+ """
92
+ if filename is None or filename is False:
93
+ filename = file_io.select_file(start_path=self.batch_path, save=False, ext='xml')
94
+ if filename == '':
95
+ return
96
+
97
+ status = False
98
+ settings_tmp = self.create_parameter(filename)
99
+ children = settings_tmp.child('scans').children()
100
+
101
+ #self.settings = self.create_parameter(self.params)
102
+ actuators = children[0].child('modules', 'actuators').value()['all_items']
103
+ if actuators != self.modules_manager.actuators_name:
104
+ messagebox(text='The loaded actuators from the batch file do not corresponds to the dashboard actuators')
105
+ return
106
+
107
+ detectors = children[0].child('modules', 'detectors').value()['all_items']
108
+ if detectors != self.modules_manager.detectors_name:
109
+ messagebox(text='The loaded detectors from the batch file do not corresponds to the dashboard detectors')
110
+ return
111
+
112
+ self.settings = settings_tmp
113
+
114
+ # for child in children:
115
+ # self.add_scan(name=child.name(), title=child.opts['title'])
116
+ #
117
+ # self.settings.child('scans', child.name()).restoreState(child.saveState())
118
+
119
+ if show:
120
+ status = self.show_tree()
121
+ else:
122
+ self.settings_tree.setParameters(self.settings, showTop=False)
123
+ return status
124
+
125
+ def set_scans(self):
126
+ infos = []
127
+ acts, dets = self.get_act_dets()
128
+ self._scans = OrderedDict([])
129
+ for name in [child.name() for child in self.settings.child('scans').children()]:
130
+ self._scans[name] = Scanner(actuators=self.modules_manager.get_mods_from_names(acts[name], 'act'))
131
+ self._scans[name].set_scan_from_settings(self.settings.child('scans', name, Scanner.settings_name),
132
+ self.settings.child('scans', name, ScannerBase.settings_name))
133
+ infos.append(f'{name}: {acts[name]} / {dets[name]}')
134
+ infos.append(f'{name}: {self._scans[name].get_scan_info()}')
135
+ return infos
136
+
137
+ def get_scan(self, name: str):
138
+ """Get a Scanner object from name"""
139
+ if len(self._scans) == 0:
140
+ self.set_scans()
141
+ return self._scans.get(name)
142
+
143
+ @property
144
+ def scans(self):
145
+ return self._scans
146
+
147
+ def get_scan_names(self) -> List[str]:
148
+ return list(self._scans.keys())
149
+
150
+ def set_new_batch(self):
151
+ self.settings = self.create_parameter(self.params)
152
+ status = self.show_tree()
153
+ return status
154
+
155
+ def show_tree(self):
156
+
157
+
158
+ dialog = QDialog()
159
+ dialog.setLayout(QtWidgets.QVBoxLayout())
160
+
161
+ widget_all_settings = QtWidgets.QWidget()
162
+
163
+ dialog.layout().addWidget(widget_all_settings)
164
+ buttonBox = QDialogButtonBox(parent=dialog)
165
+ buttonBox.addButton("Save", QDialogButtonBox.ButtonRole.AcceptRole)
166
+ buttonBox.accepted.connect(dialog.accept)
167
+ buttonBox.addButton("Cancel", QDialogButtonBox.ButtonRole.RejectRole)
168
+ buttonBox.rejected.connect(dialog.reject)
169
+
170
+ dialog.layout().addWidget(buttonBox)
171
+ dialog.setWindowTitle('Fill in information about this Scan batch')
172
+
173
+ widget_all_settings.setLayout(QtWidgets.QHBoxLayout())
174
+ widget_all_settings.layout().addWidget(self.settings_tree)
175
+
176
+ widget_vertical = QtWidgets.QWidget()
177
+ widget_vertical.setLayout(QtWidgets.QVBoxLayout())
178
+ widget_all_settings.layout().addWidget(widget_vertical)
179
+
180
+ self.scanner_widget = self.scanner.parent_widget
181
+ add_scan = QtWidgets.QPushButton('Add Scan')
182
+ add_scan.clicked.connect(self.add_scan)
183
+
184
+ widget_vertical.layout().addWidget(self.modules_manager.settings_tree)
185
+ widget_vertical.layout().addWidget(self.scanner_widget)
186
+ widget_vertical.layout().addWidget(add_scan)
187
+
188
+ res = dialog.exec()
189
+
190
+ if res == QDialog.DialogCode.Accepted:
191
+ ioxml.parameter_to_xml_file(
192
+ self.settings, self.batch_path.joinpath(self.settings.child('filename').value()))
193
+
194
+ return res == QDialog.DialogCode.Accepted
195
+
196
+ def set_scanner_settings(self, settings_tree: QtWidgets.QWidget):
197
+ while True:
198
+ child = self.scanner_widget.layout().takeAt(0)
199
+ if not child:
200
+ break
201
+ child.widget().deleteLater()
202
+ QtWidgets.QApplication.processEvents()
203
+
204
+ self.scanner_widget.layout().addWidget(settings_tree)
205
+
206
+ def update_actuators(self, actuators: List[str]):
207
+ self.scanner.actuators = self.modules_manager.actuators
208
+
209
+ def add_scan(self, name=None, title=None):
210
+ if name is None or name is False:
211
+ name_prefix = 'scan'
212
+ child_indexes = [int(par.name()[len(name_prefix) + 1:]) for par in self.settings.child('scans').children()]
213
+ if child_indexes == []:
214
+ newindex = 0
215
+ else:
216
+ newindex = max(child_indexes) + 1
217
+ name = f'{name_prefix}{newindex:02.0f}'
218
+ title = f'Scan {newindex:02.0f}'
219
+
220
+ child = {'title': title, 'name': name, 'type': 'group', 'removable': True, 'children': params}
221
+
222
+ # self._scans[name] = Scanner(actuators=self.modules_manager.actuators)
223
+
224
+ self.settings.child('scans').addChild(child)
225
+ self.settings.child('scans', name, 'modules',
226
+ 'actuators').setValue(dict(all_items=self.modules_manager.actuators_name,
227
+ selected=self.modules_manager.selected_actuators_name))
228
+ self.settings.child('scans', name, 'modules',
229
+ 'detectors').setValue(dict(all_items=self.modules_manager.detectors_name,
230
+ selected=self.modules_manager.selected_detectors_name))
231
+
232
+ self.settings.child('scans', name).addChild(self.create_parameter(self.scanner.settings))
233
+ self.settings.child('scans', name).addChild(self.create_parameter(self.scanner.get_scanner_sub_settings()))
234
+
235
+
236
+ class BatchScanner(QtCore.QObject):
237
+ def __init__(self, area, actuators=[], detectors=[]):
238
+ super().__init__()
239
+ self.dockarea = area
240
+ self.batchmanager = BatchManager(actuators=actuators, detectors=detectors, path=batch_path)
241
+
242
+ @property
243
+ def scans(self):
244
+ return self.batchmanager.scans
245
+
246
+ @property
247
+ def scans_names(self):
248
+ return self.batchmanager.get_scan_names()
249
+
250
+ def get_scan(self, name: str):
251
+ return self.batchmanager.get_scan(name)
252
+
253
+ def get_act_dets(self):
254
+ return self.batchmanager.get_act_dets()
255
+
256
+ def setupUI(self):
257
+ # %% create scan dock and make it a floating window
258
+ self.batch_dock = Dock("BatchScanner", size=(1, 1), autoOrientation=False) # give this dock the minimum possible size
259
+ self.dockarea.addDock(self.batch_dock, 'left')
260
+ self.batch_dock.float()
261
+
262
+ self.widget = QtWidgets.QWidget()
263
+ self.widget.setLayout(QtWidgets.QVBoxLayout())
264
+
265
+ widget_infos = QtWidgets.QWidget()
266
+ self.widget_infos_list = QtWidgets.QListWidget()
267
+ widget_infos.setLayout(QtWidgets.QHBoxLayout())
268
+ splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal)
269
+ widget_infos.layout().addWidget(splitter)
270
+ splitter.addWidget(self.batchmanager.settings_tree)
271
+ splitter.addWidget(self.widget_infos_list)
272
+ self.batch_dock.addWidget(self.widget)
273
+ self.widget.layout().addWidget(widget_infos)
274
+ #self.create_menu()
275
+
276
+ def create_menu(self, menubar=None):
277
+ """
278
+ """
279
+ # %% create Settings menu
280
+ if menubar is None:
281
+ menubar = QtWidgets.QMenuBar()
282
+ self.widget.layout().insertWidget(0, menubar)
283
+
284
+ self.batch_menu = menubar.addMenu('Batch Configs')
285
+ action_new = self.batch_menu.addAction('New Batch')
286
+ action_new.triggered.connect(self.batchmanager.set_new_batch)
287
+ action_modify = self.batch_menu.addAction('Modify Batch')
288
+ action_modify.triggered.connect(self.batchmanager.set_file_batch)
289
+ self.batch_menu.addSeparator()
290
+ self.load_batch = self.batch_menu.addMenu('Load Batchs')
291
+
292
+ slots = dict([])
293
+ for ind_file, file in enumerate(batch_path.iterdir()):
294
+ if file.suffix == '.xml':
295
+ filestem = file.stem
296
+ slots[filestem] = self.load_batch.addAction(filestem)
297
+ slots[filestem].triggered.connect(
298
+ self.create_menu_slot(batch_path.joinpath(file)))
299
+
300
+ def load_file(self, filepath=None):
301
+ if filepath is None:
302
+ path = file_io.select_file(start_path=batch_path, save=False, ext='xml')
303
+ if path != '':
304
+ filepath = path
305
+ else:
306
+ return
307
+ self.batchmanager.set_file_batch(str(filepath), show=False)
308
+
309
+ infos = self.batchmanager.set_scans()
310
+ self.widget_infos_list.addItems(infos)
311
+
312
+ def create_menu_slot(self, filename):
313
+ return lambda: self.load_file(filename)
314
+
315
+
316
+ def main_batch_scanner():
317
+ from pymodaq.control_modules.mocks import MockDAQMove, MockDAQViewer
318
+ app = QtWidgets.QApplication(sys.argv)
319
+ win = QtWidgets.QMainWindow()
320
+ area = DockArea()
321
+ win.setCentralWidget(area)
322
+
323
+ # prog = BatchManager(msgbox=False, actuators=['Xaxis', 'Yaxis'], detectors=['Det0D', 'Det1D'])
324
+ # prog.set_file_batch('C:\\Users\\weber\\pymodaq_local\\batch_configs\\batch_default.xml', show=False)
325
+ # prog.set_scans()
326
+ actuators = [MockDAQMove(title='Xaxis'), MockDAQMove(title='Yaxis')]
327
+ detectors = [MockDAQViewer(title='Det0D'), MockDAQViewer(title='Det1D')]
328
+ main = BatchScanner(area, actuators=actuators, detectors=detectors)
329
+ main.setupUI()
330
+ main.create_menu()
331
+ win.show()
332
+ sys.exit(app.exec_())
333
+
334
+
335
+ def main_batch_manager():
336
+ from pymodaq.control_modules.mocks import MockDAQMove, MockDAQViewer
337
+ app = QtWidgets.QApplication(sys.argv)
338
+ actuators = [MockDAQMove(title='Xaxis'), MockDAQMove(title='Yaxis')]
339
+ detectors = [MockDAQViewer(title='Det0D'), MockDAQViewer(title='Det1D')]
340
+ prog = BatchManager(msgbox=True, actuators=actuators, detectors=detectors)
341
+ sys.exit(app.exec_())
342
+
343
+
344
+ if __name__ == '__main__':
345
+ #main_batch_manager()
346
+ main_batch_scanner()