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.
- pymodaq/__init__.py +13 -6
- pymodaq/control_modules/__init__.py +0 -7
- pymodaq/control_modules/daq_move.py +965 -2
- pymodaq/control_modules/daq_move_ui.py +319 -0
- pymodaq/control_modules/daq_viewer.py +1573 -3
- pymodaq/control_modules/daq_viewer_ui.py +393 -0
- pymodaq/control_modules/mocks.py +51 -0
- pymodaq/control_modules/move_utility_classes.py +709 -8
- pymodaq/control_modules/utils.py +256 -0
- pymodaq/control_modules/viewer_utility_classes.py +663 -6
- pymodaq/daq_utils.py +89 -0
- pymodaq/dashboard.py +91 -72
- pymodaq/examples/custom_app.py +12 -11
- pymodaq/examples/custom_viewer.py +10 -10
- pymodaq/examples/function_plotter.py +16 -13
- pymodaq/examples/nonlinearscanner.py +8 -6
- pymodaq/examples/parameter_ex.py +7 -7
- pymodaq/examples/preset_MockCamera.xml +1 -0
- pymodaq/extensions/__init__.py +16 -0
- pymodaq/extensions/console.py +76 -0
- pymodaq/{daq_logger.py → extensions/daq_logger.py} +115 -65
- pymodaq/extensions/daq_scan.py +1339 -0
- pymodaq/extensions/daq_scan_ui.py +240 -0
- pymodaq/extensions/h5browser.py +23 -0
- pymodaq/{pid → extensions/pid}/__init__.py +4 -2
- pymodaq/{pid → extensions/pid}/daq_move_PID.py +2 -2
- pymodaq/{pid → extensions/pid}/pid_controller.py +48 -36
- pymodaq/{pid → extensions/pid}/utils.py +52 -6
- pymodaq/extensions/utils.py +40 -0
- pymodaq/post_treatment/__init__.py +6 -0
- pymodaq/{daq_analysis → post_treatment/daq_analysis}/daq_analysis_main.py +17 -17
- pymodaq/{daq_measurement → post_treatment/daq_measurement}/daq_measurement_main.py +8 -14
- pymodaq/post_treatment/load_and_plot.py +219 -0
- pymodaq/post_treatment/process_to_scalar.py +263 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/run_all.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/Icon_Library/stop_all.png +0 -0
- pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.bat +1 -1
- pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources.qrc +1 -0
- pymodaq/resources/QtDesigner_Ressources/QtDesigner_ressources_rc.py +109784 -109173
- pymodaq/resources/QtDesigner_Ressources/icons.svg +142 -0
- pymodaq/resources/VERSION +1 -1
- pymodaq/resources/config_template.toml +32 -13
- pymodaq/resources/preset_default.xml +1 -1
- pymodaq/{daq_utils → utils}/Tuto innosetup/script_full_setup.iss +1 -1
- pymodaq/utils/__init__.py +0 -29
- pymodaq/utils/abstract/__init__.py +48 -0
- pymodaq/{daq_utils → utils}/abstract/logger.py +7 -3
- pymodaq/utils/array_manipulation.py +379 -8
- pymodaq/{daq_utils → utils}/calibration_camera.py +6 -6
- pymodaq/{daq_utils → utils}/chrono_timer.py +1 -1
- pymodaq/utils/config.py +448 -0
- pymodaq/utils/conftests.py +5 -0
- pymodaq/utils/daq_utils.py +828 -8
- pymodaq/utils/data.py +1873 -7
- pymodaq/{daq_utils → utils}/db/db_logger/db_logger.py +86 -47
- pymodaq/{daq_utils → utils}/db/db_logger/db_logger_models.py +31 -10
- pymodaq/{daq_utils → utils}/enums.py +12 -7
- pymodaq/utils/exceptions.py +37 -0
- pymodaq/utils/factory.py +82 -0
- pymodaq/{daq_utils → utils}/gui_utils/__init__.py +1 -1
- pymodaq/utils/gui_utils/custom_app.py +129 -0
- pymodaq/utils/gui_utils/file_io.py +66 -0
- pymodaq/{daq_utils → utils}/gui_utils/layout.py +2 -2
- pymodaq/{daq_utils → utils}/gui_utils/utils.py +13 -3
- pymodaq/{daq_utils → utils}/gui_utils/widgets/__init__.py +2 -2
- pymodaq/utils/gui_utils/widgets/label.py +24 -0
- pymodaq/{daq_utils → utils}/gui_utils/widgets/lcd.py +12 -7
- pymodaq/{daq_utils → utils}/gui_utils/widgets/push.py +66 -2
- pymodaq/{daq_utils → utils}/gui_utils/widgets/qled.py +6 -4
- pymodaq/utils/gui_utils/widgets/spinbox.py +24 -0
- pymodaq/{daq_utils → utils}/gui_utils/widgets/table.py +2 -2
- pymodaq/utils/h5modules/__init__.py +1 -0
- pymodaq/{daq_utils/h5backend.py → utils/h5modules/backends.py} +200 -112
- pymodaq/utils/h5modules/browsing.py +683 -0
- pymodaq/utils/h5modules/data_saving.py +839 -0
- pymodaq/utils/h5modules/h5logging.py +110 -0
- pymodaq/utils/h5modules/module_saving.py +350 -0
- pymodaq/utils/h5modules/saving.py +914 -0
- pymodaq/utils/h5modules/utils.py +85 -0
- pymodaq/utils/logger.py +64 -6
- pymodaq/utils/managers/action_manager.py +460 -0
- pymodaq/{daq_utils → utils}/managers/batchscan_manager.py +144 -112
- pymodaq/{daq_utils → utils}/managers/modules_manager.py +188 -114
- pymodaq/{daq_utils → utils}/managers/overshoot_manager.py +3 -3
- pymodaq/utils/managers/parameter_manager.py +110 -0
- pymodaq/{daq_utils → utils}/managers/preset_manager.py +17 -13
- pymodaq/{daq_utils → utils}/managers/preset_manager_utils.py +8 -7
- pymodaq/{daq_utils → utils}/managers/remote_manager.py +7 -6
- pymodaq/{daq_utils → utils}/managers/roi_manager.py +148 -57
- pymodaq/utils/math_utils.py +546 -10
- pymodaq/{daq_utils → utils}/messenger.py +5 -1
- pymodaq/utils/parameter/__init__.py +2 -15
- pymodaq/{daq_utils → utils}/parameter/ioxml.py +12 -6
- pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/__init__.py +1 -3
- pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/filedir.py +1 -1
- pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/itemselect.py +3 -0
- pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/led.py +1 -1
- pymodaq/utils/parameter/pymodaq_ptypes/pixmap.py +161 -0
- pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/slide.py +1 -1
- pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/table.py +1 -1
- pymodaq/utils/parameter/utils.py +206 -11
- pymodaq/utils/plotting/data_viewers/__init__.py +6 -0
- pymodaq/utils/plotting/data_viewers/viewer.py +393 -0
- pymodaq/utils/plotting/data_viewers/viewer0D.py +251 -0
- pymodaq/utils/plotting/data_viewers/viewer1D.py +574 -0
- pymodaq/{daq_utils → utils}/plotting/data_viewers/viewer1Dbasic.py +8 -3
- pymodaq/{daq_utils → utils}/plotting/data_viewers/viewer2D.py +292 -357
- pymodaq/{daq_utils → utils}/plotting/data_viewers/viewer2D_basic.py +58 -75
- pymodaq/utils/plotting/data_viewers/viewerND.py +738 -0
- pymodaq/{daq_utils → utils}/plotting/gant_chart.py +2 -2
- pymodaq/{daq_utils → utils}/plotting/items/axis_scaled.py +4 -2
- pymodaq/{daq_utils → utils}/plotting/items/image.py +8 -6
- pymodaq/utils/plotting/navigator.py +355 -0
- pymodaq/utils/plotting/scan_selector.py +480 -0
- pymodaq/utils/plotting/utils/axes_viewer.py +88 -0
- pymodaq/utils/plotting/utils/filter.py +538 -0
- pymodaq/utils/plotting/utils/lineout.py +224 -0
- pymodaq/{daq_utils → utils}/plotting/utils/plot_utils.py +196 -84
- pymodaq/{daq_utils → utils}/plotting/utils/signalND.py +21 -13
- pymodaq/utils/plotting/widgets.py +76 -0
- pymodaq/utils/scanner/__init__.py +10 -0
- pymodaq/utils/scanner/scan_factory.py +204 -0
- pymodaq/utils/scanner/scanner.py +271 -0
- pymodaq/utils/scanner/scanners/_1d_scanners.py +117 -0
- pymodaq/utils/scanner/scanners/_2d_scanners.py +293 -0
- pymodaq/utils/scanner/scanners/sequential.py +192 -0
- pymodaq/utils/scanner/scanners/tabular.py +294 -0
- pymodaq/utils/scanner/utils.py +83 -0
- pymodaq/utils/slicing.py +47 -0
- pymodaq/utils/svg/__init__.py +6 -0
- pymodaq/utils/svg/svg_renderer.py +20 -0
- pymodaq/utils/svg/svg_view.py +35 -0
- pymodaq/utils/svg/svg_viewer2D.py +51 -0
- pymodaq/{daq_utils → utils}/tcp_server_client.py +36 -37
- pymodaq/{daq_utils → utils}/tree_layout/tree_layout_main.py +50 -35
- pymodaq/utils/units.py +216 -0
- pymodaq-4.0.1.dist-info/METADATA +159 -0
- {pymodaq-3.6.12.dist-info → pymodaq-4.0.1.dist-info}/RECORD +167 -170
- {pymodaq-3.6.12.dist-info → pymodaq-4.0.1.dist-info}/WHEEL +1 -2
- pymodaq-4.0.1.dist-info/entry_points.txt +8 -0
- pymodaq/daq_move/daq_move_gui.py +0 -279
- pymodaq/daq_move/daq_move_gui.ui +0 -534
- pymodaq/daq_move/daq_move_main.py +0 -1042
- pymodaq/daq_move/process_from_QtDesigner_DAQ_Move_GUI.bat +0 -2
- pymodaq/daq_move/utility_classes.py +0 -671
- pymodaq/daq_scan.py +0 -2160
- pymodaq/daq_utils/array_manipulation.py +0 -386
- pymodaq/daq_utils/config.py +0 -273
- pymodaq/daq_utils/conftests.py +0 -7
- pymodaq/daq_utils/custom_parameter_tree.py +0 -9
- pymodaq/daq_utils/daq_enums.py +0 -133
- pymodaq/daq_utils/daq_utils.py +0 -1402
- pymodaq/daq_utils/exceptions.py +0 -71
- pymodaq/daq_utils/gui_utils/custom_app.py +0 -103
- pymodaq/daq_utils/gui_utils/file_io.py +0 -75
- pymodaq/daq_utils/gui_utils/widgets/spinbox.py +0 -9
- pymodaq/daq_utils/h5exporter_hyperspy.py +0 -115
- pymodaq/daq_utils/h5exporters.py +0 -242
- pymodaq/daq_utils/h5modules.py +0 -1559
- pymodaq/daq_utils/h5utils.py +0 -241
- pymodaq/daq_utils/managers/action_manager.py +0 -236
- pymodaq/daq_utils/managers/parameter_manager.py +0 -57
- pymodaq/daq_utils/math_utils.py +0 -705
- pymodaq/daq_utils/parameter/__init__.py +0 -1
- pymodaq/daq_utils/parameter/oldpymodaq_ptypes.py +0 -1626
- pymodaq/daq_utils/parameter/pymodaq_ptypes/pixmap.py +0 -85
- pymodaq/daq_utils/parameter/utils.py +0 -136
- pymodaq/daq_utils/plotting/data_viewers/__init__.py +0 -0
- pymodaq/daq_utils/plotting/data_viewers/process_from_QtDesigner_0DViewer_GUI.bat +0 -2
- pymodaq/daq_utils/plotting/data_viewers/viewer0D.py +0 -204
- pymodaq/daq_utils/plotting/data_viewers/viewer0D_GUI.py +0 -89
- pymodaq/daq_utils/plotting/data_viewers/viewer0D_GUI.ui +0 -131
- pymodaq/daq_utils/plotting/data_viewers/viewer1D.py +0 -781
- pymodaq/daq_utils/plotting/data_viewers/viewerND.py +0 -894
- pymodaq/daq_utils/plotting/data_viewers/viewerbase.py +0 -64
- pymodaq/daq_utils/plotting/items/__init__.py +0 -0
- pymodaq/daq_utils/plotting/navigator.py +0 -500
- pymodaq/daq_utils/plotting/scan_selector.py +0 -289
- pymodaq/daq_utils/plotting/utils/__init__.py +0 -0
- pymodaq/daq_utils/plotting/utils/filter.py +0 -236
- pymodaq/daq_utils/plotting/viewer0D/__init__.py +0 -0
- pymodaq/daq_utils/plotting/viewer0D/viewer0D_main.py +0 -4
- pymodaq/daq_utils/plotting/viewer1D/__init__.py +0 -0
- pymodaq/daq_utils/plotting/viewer1D/viewer1D_main.py +0 -4
- pymodaq/daq_utils/plotting/viewer1D/viewer1Dbasic.py +0 -4
- pymodaq/daq_utils/plotting/viewer2D/viewer_2D_basic.py +0 -4
- pymodaq/daq_utils/plotting/viewer2D/viewer_2D_main.py +0 -4
- pymodaq/daq_utils/plotting/viewerND/__init__.py +0 -0
- pymodaq/daq_utils/plotting/viewerND/viewerND_main.py +0 -4
- pymodaq/daq_utils/scanner.py +0 -1289
- pymodaq/daq_utils/tree_layout/__init__.py +0 -0
- pymodaq/daq_viewer/__init__.py +0 -0
- pymodaq/daq_viewer/daq_gui_settings.py +0 -237
- pymodaq/daq_viewer/daq_gui_settings.ui +0 -441
- pymodaq/daq_viewer/daq_viewer_main.py +0 -2225
- pymodaq/daq_viewer/process_from_QtDesigner_DAQ_GUI_settings.bat +0 -2
- pymodaq/daq_viewer/utility_classes.py +0 -673
- pymodaq/examples/logger_image/__init__.py +0 -0
- pymodaq/examples/logger_image/logger_displayer.py +0 -121
- pymodaq/examples/logger_image/setup.svg +0 -3119
- pymodaq/examples/logger_image/setup_svg.py +0 -114
- pymodaq/h5browser.py +0 -39
- pymodaq/utils/scanner.py +0 -15
- pymodaq-3.6.12.dist-info/METADATA +0 -39
- pymodaq-3.6.12.dist-info/entry_points.txt +0 -8
- pymodaq-3.6.12.dist-info/top_level.txt +0 -1
- /pymodaq/{daq_analysis → post_treatment/daq_analysis}/__init__.py +0 -0
- /pymodaq/{daq_measurement → post_treatment/daq_measurement}/__init__.py +0 -0
- /pymodaq/{daq_measurement → post_treatment/daq_measurement}/daq_measurement_GUI.py +0 -0
- /pymodaq/{daq_measurement → post_treatment/daq_measurement}/daq_measurement_GUI.ui +0 -0
- /pymodaq/{daq_measurement → post_treatment/daq_measurement}/process_from_QtDesigner_DAQ_Measurement_GUI.bat +0 -0
- /pymodaq/{daq_utils → utils}/Tuto innosetup/Tuto innosetup.odt +0 -0
- /pymodaq/{daq_utils → utils}/Tuto innosetup/Tuto innosetup.pdf +0 -0
- /pymodaq/{daq_move → utils/db}/__init__.py +0 -0
- /pymodaq/{daq_utils → utils/db/db_logger}/__init__.py +0 -0
- /pymodaq/{daq_utils → utils}/gui_utils/dock.py +0 -0
- /pymodaq/{daq_utils → utils}/gui_utils/list_picker.py +0 -0
- /pymodaq/{daq_utils/abstract → utils/managers}/__init__.py +0 -0
- /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/bool.py +0 -0
- /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/date.py +0 -0
- /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/list.py +0 -0
- /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/numeric.py +0 -0
- /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/tableview.py +0 -0
- /pymodaq/{daq_utils → utils}/parameter/pymodaq_ptypes/text.py +0 -0
- /pymodaq/{daq_utils/db → utils/plotting}/__init__.py +0 -0
- /pymodaq/{daq_utils → utils}/plotting/image_viewer.py +0 -0
- /pymodaq/{daq_utils/db/db_logger → utils/plotting/items}/__init__.py +0 -0
- /pymodaq/{daq_utils → utils}/plotting/items/crosshair.py +0 -0
- /pymodaq/{daq_utils/managers → utils/plotting/utils}/__init__.py +0 -0
- /pymodaq/{daq_utils → utils}/qvariant.py +0 -0
- /pymodaq/{daq_utils/plotting/viewer2D → utils/scanner/scanners}/__init__.py +0 -0
- /pymodaq/{daq_utils/plotting → utils/tree_layout}/__init__.py +0 -0
- {pymodaq-3.6.12.dist-info → pymodaq-4.0.1.dist-info/licenses}/LICENSE +0 -0
|
@@ -1,24 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import pymodaq.
|
|
4
|
-
import pymodaq.
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
import pymodaq.utils.config
|
|
4
|
+
import pymodaq.utils.gui_utils.dock
|
|
5
|
+
import pymodaq.utils.gui_utils.file_io
|
|
6
|
+
import pymodaq.utils.messenger
|
|
5
7
|
from qtpy import QtWidgets, QtCore
|
|
6
8
|
import sys
|
|
7
9
|
import os
|
|
8
|
-
|
|
9
|
-
from pymodaq.
|
|
10
|
-
from pymodaq.
|
|
11
|
-
from pymodaq.
|
|
12
|
-
from pymodaq.
|
|
13
|
-
from pymodaq.
|
|
14
|
-
from pymodaq.
|
|
15
|
-
from pymodaq.
|
|
10
|
+
|
|
11
|
+
from pymodaq.utils.managers.parameter_manager import ParameterManager
|
|
12
|
+
from pymodaq.utils.managers.modules_manager import ModulesManager
|
|
13
|
+
from pymodaq.utils.gui_utils import Dock
|
|
14
|
+
from pymodaq.utils.logger import set_logger, get_module_name
|
|
15
|
+
from pymodaq.utils import config as config_mod
|
|
16
|
+
from pymodaq.utils.parameter import ioxml
|
|
17
|
+
from pymodaq.utils.scanner import Scanner
|
|
18
|
+
from pymodaq.utils.scanner.scan_factory import ScannerBase
|
|
19
|
+
from pymodaq.utils.scanner.utils import ScanType #, adaptive_losses
|
|
16
20
|
from pathlib import Path
|
|
17
21
|
from collections import OrderedDict
|
|
22
|
+
from pymodaq.utils.messenger import messagebox
|
|
18
23
|
|
|
19
|
-
logger =
|
|
24
|
+
logger = set_logger(get_module_name(__file__))
|
|
20
25
|
|
|
21
|
-
batch_path =
|
|
26
|
+
batch_path = config_mod.get_set_batch_path()
|
|
22
27
|
|
|
23
28
|
params = [
|
|
24
29
|
{'title': 'Actuators/Detectors Selection', 'name': 'modules', 'type': 'group', 'children': [
|
|
@@ -28,21 +33,27 @@ params = [
|
|
|
28
33
|
]
|
|
29
34
|
|
|
30
35
|
|
|
31
|
-
class BatchManager:
|
|
32
|
-
|
|
36
|
+
class BatchManager(ParameterManager):
|
|
37
|
+
settings_name = 'batch_settings'
|
|
33
38
|
params = [{'title': 'Filename:', 'name': 'filename', 'type': 'str', 'value': 'batch_default'},
|
|
34
39
|
{'title': 'Scans', 'name': 'scans', 'type': 'group', 'children': []}]
|
|
35
40
|
|
|
36
41
|
def __init__(self, msgbox=False, actuators=[], detectors=[], path=None):
|
|
37
|
-
|
|
38
|
-
self.detectors = detectors
|
|
42
|
+
super().__init__()
|
|
39
43
|
|
|
40
|
-
self.
|
|
44
|
+
self.modules_manager: ModulesManager = ModulesManager(detectors, actuators)
|
|
45
|
+
self.modules_manager.show_only_control_modules(True)
|
|
46
|
+
self.modules_manager.actuators_changed[list].connect(self.update_actuators)
|
|
47
|
+
self.modules_manager.settings_tree.setMinimumHeight(200)
|
|
48
|
+
self.modules_manager.settings_tree.setMaximumHeight(200)
|
|
41
49
|
|
|
42
|
-
self.
|
|
43
|
-
|
|
44
|
-
self.
|
|
45
|
-
|
|
50
|
+
self._scans = OrderedDict([])
|
|
51
|
+
|
|
52
|
+
self.scanner = Scanner(actuators=self.modules_manager.actuators_all)
|
|
53
|
+
|
|
54
|
+
self.settings_tree.setMinimumWidth(400)
|
|
55
|
+
self.settings_tree.setMaximumWidth(500)
|
|
56
|
+
self.settings_tree.setMinimumHeight(500)
|
|
46
57
|
|
|
47
58
|
if path is None:
|
|
48
59
|
path = batch_path
|
|
@@ -50,9 +61,6 @@ class BatchManager:
|
|
|
50
61
|
assert isinstance(path, Path)
|
|
51
62
|
self.batch_path = path
|
|
52
63
|
|
|
53
|
-
self.settings = None
|
|
54
|
-
|
|
55
|
-
|
|
56
64
|
if msgbox:
|
|
57
65
|
msgBox = QtWidgets.QMessageBox()
|
|
58
66
|
msgBox.setText("Scan Batch Manager?")
|
|
@@ -71,126 +79,135 @@ class BatchManager:
|
|
|
71
79
|
else: # cancel
|
|
72
80
|
pass
|
|
73
81
|
|
|
74
|
-
|
|
75
82
|
def get_act_dets(self):
|
|
76
83
|
acts = dict([])
|
|
77
84
|
dets = dict([])
|
|
78
|
-
for name in self.scans:
|
|
79
|
-
acts[name] = self.settings.child('scans', name, 'modules',
|
|
80
|
-
|
|
81
|
-
dets[name] = self.settings.child('scans', name, 'modules',
|
|
82
|
-
'detectors').value()['selected']
|
|
85
|
+
for name in [child.name() for child in self.settings.child('scans').children()]:
|
|
86
|
+
acts[name] = self.settings.child('scans', name, 'modules', 'actuators').value()['selected']
|
|
87
|
+
dets[name] = self.settings.child('scans', name, 'modules', 'detectors').value()['selected']
|
|
83
88
|
return acts, dets
|
|
84
89
|
|
|
85
90
|
def set_file_batch(self, filename=None, show=True):
|
|
86
91
|
"""
|
|
87
92
|
|
|
88
93
|
"""
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
filename = pymodaq.daq_utils.gui_utils.file_io.select_file(start_path=self.batch_path, save=False, ext='xml')
|
|
94
|
+
if filename is None or filename is False:
|
|
95
|
+
filename = pymodaq.utils.gui_utils.file_io.select_file(start_path=self.batch_path, save=False, ext='xml')
|
|
92
96
|
if filename == '':
|
|
93
97
|
return
|
|
94
98
|
|
|
95
99
|
status = False
|
|
96
|
-
settings_tmp =
|
|
97
|
-
type='group', children=ioxml.XML_file_to_parameter(str(filename)))
|
|
98
|
-
|
|
100
|
+
settings_tmp = self.create_parameter(filename)
|
|
99
101
|
children = settings_tmp.child('scans').children()
|
|
100
|
-
|
|
102
|
+
|
|
103
|
+
#self.settings = self.create_parameter(self.params)
|
|
101
104
|
actuators = children[0].child('modules', 'actuators').value()['all_items']
|
|
102
|
-
if actuators != self.
|
|
103
|
-
|
|
104
|
-
' dashboard actuators')
|
|
105
|
+
if actuators != self.modules_manager.actuators_name:
|
|
106
|
+
messagebox(text='The loaded actuators from the batch file do not corresponds to the dashboard actuators')
|
|
105
107
|
return
|
|
106
|
-
else:
|
|
107
|
-
self.actuators = actuators
|
|
108
108
|
|
|
109
109
|
detectors = children[0].child('modules', 'detectors').value()['all_items']
|
|
110
|
-
if detectors != self.
|
|
111
|
-
|
|
112
|
-
' dashboard detectors')
|
|
110
|
+
if detectors != self.modules_manager.detectors_name:
|
|
111
|
+
messagebox(text='The loaded detectors from the batch file do not corresponds to the dashboard detectors')
|
|
113
112
|
return
|
|
114
|
-
else:
|
|
115
|
-
self.detectors = detectors
|
|
116
113
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
self.settings = settings_tmp
|
|
115
|
+
|
|
116
|
+
# for child in children:
|
|
117
|
+
# self.add_scan(name=child.name(), title=child.opts['title'])
|
|
118
|
+
#
|
|
119
|
+
# self.settings.child('scans', child.name()).restoreState(child.saveState())
|
|
120
120
|
|
|
121
121
|
if show:
|
|
122
122
|
status = self.show_tree()
|
|
123
123
|
else:
|
|
124
|
-
self.
|
|
124
|
+
self.settings_tree.setParameters(self.settings, showTop=False)
|
|
125
125
|
return status
|
|
126
126
|
|
|
127
127
|
def set_scans(self):
|
|
128
128
|
infos = []
|
|
129
129
|
acts, dets = self.get_act_dets()
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
self._scans = OrderedDict([])
|
|
131
|
+
for name in [child.name() for child in self.settings.child('scans').children()]:
|
|
132
|
+
self._scans[name] = Scanner(actuators=self.modules_manager.get_mods_from_names(acts[name], 'act'))
|
|
133
|
+
self._scans[name].set_scan_from_settings(self.settings.child('scans', name, Scanner.settings_name),
|
|
134
|
+
self.settings.child('scans', name, ScannerBase.settings_name))
|
|
135
|
+
infos.append(f'{name}: {acts[name]} / {dets[name]}')
|
|
136
|
+
infos.append(f'{name}: {self._scans[name].get_scan_info()}')
|
|
133
137
|
return infos
|
|
134
138
|
|
|
135
|
-
def
|
|
136
|
-
|
|
137
|
-
|
|
139
|
+
def get_scan(self, name: str):
|
|
140
|
+
"""Get a Scanner object from name"""
|
|
141
|
+
if len(self._scans) == 0:
|
|
142
|
+
self.set_scans()
|
|
143
|
+
return self._scans.get(name)
|
|
138
144
|
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
@property
|
|
146
|
+
def scans(self):
|
|
147
|
+
return self._scans
|
|
141
148
|
|
|
142
|
-
def
|
|
143
|
-
|
|
144
|
-
Check for changes in the given (parameter,change,information) tuple list.
|
|
145
|
-
In case of value changed, update the DAQscan_settings tree consequently.
|
|
146
|
-
|
|
147
|
-
=============== ============================================ ==============================
|
|
148
|
-
**Parameters** **Type** **Description**
|
|
149
|
-
*param* instance of pyqtgraph parameter the parameter to be checked
|
|
150
|
-
*changes* (parameter,change,information) tuple list the current changes state
|
|
151
|
-
=============== ============================================ ==============================
|
|
152
|
-
"""
|
|
153
|
-
for param, change, data in changes:
|
|
154
|
-
path = self.settings.childPath(param)
|
|
155
|
-
if change == 'childAdded':
|
|
156
|
-
pass
|
|
149
|
+
def get_scan_names(self) -> List[str]:
|
|
150
|
+
return list(self._scans.keys())
|
|
157
151
|
|
|
158
|
-
|
|
152
|
+
def set_new_batch(self):
|
|
153
|
+
self.settings = self.create_parameter(self.params)
|
|
154
|
+
status = self.show_tree()
|
|
155
|
+
return status
|
|
159
156
|
|
|
160
|
-
|
|
157
|
+
def show_tree(self):
|
|
161
158
|
|
|
162
|
-
elif change == 'parent':
|
|
163
|
-
pass
|
|
164
159
|
|
|
165
|
-
def show_tree(self):
|
|
166
160
|
dialog = QtWidgets.QDialog()
|
|
167
|
-
|
|
168
|
-
add_scan = QtWidgets.QPushButton('Add Scan')
|
|
169
|
-
add_scan.clicked.connect(self.add_scan)
|
|
170
|
-
self.tree.setParameters(self.settings, showTop=False)
|
|
171
|
-
vlayout.addWidget(add_scan)
|
|
172
|
-
vlayout.addWidget(self.tree)
|
|
173
|
-
dialog.setLayout(vlayout)
|
|
161
|
+
dialog.setLayout(QtWidgets.QVBoxLayout())
|
|
174
162
|
|
|
163
|
+
widget_all_settings = QtWidgets.QWidget()
|
|
164
|
+
|
|
165
|
+
dialog.layout().addWidget(widget_all_settings)
|
|
175
166
|
buttonBox = QtWidgets.QDialogButtonBox(parent=dialog)
|
|
176
167
|
buttonBox.addButton('Save', buttonBox.AcceptRole)
|
|
177
168
|
buttonBox.accepted.connect(dialog.accept)
|
|
178
169
|
buttonBox.addButton('Cancel', buttonBox.RejectRole)
|
|
179
170
|
buttonBox.rejected.connect(dialog.reject)
|
|
180
171
|
|
|
181
|
-
|
|
172
|
+
dialog.layout().addWidget(buttonBox)
|
|
182
173
|
dialog.setWindowTitle('Fill in information about this Scan batch')
|
|
174
|
+
|
|
175
|
+
widget_all_settings.setLayout(QtWidgets.QHBoxLayout())
|
|
176
|
+
widget_all_settings.layout().addWidget(self.settings_tree)
|
|
177
|
+
|
|
178
|
+
widget_vertical = QtWidgets.QWidget()
|
|
179
|
+
widget_vertical.setLayout(QtWidgets.QVBoxLayout())
|
|
180
|
+
widget_all_settings.layout().addWidget(widget_vertical)
|
|
181
|
+
|
|
182
|
+
self.scanner_widget = self.scanner.parent_widget
|
|
183
|
+
add_scan = QtWidgets.QPushButton('Add Scan')
|
|
184
|
+
add_scan.clicked.connect(self.add_scan)
|
|
185
|
+
|
|
186
|
+
widget_vertical.layout().addWidget(self.modules_manager.settings_tree)
|
|
187
|
+
widget_vertical.layout().addWidget(self.scanner_widget)
|
|
188
|
+
widget_vertical.layout().addWidget(add_scan)
|
|
189
|
+
|
|
183
190
|
res = dialog.exec()
|
|
184
191
|
|
|
185
192
|
if res == dialog.Accepted:
|
|
186
|
-
# save managers parameters in a xml file
|
|
187
|
-
# start = os.path.split(os.path.split(os.path.realpath(__file__))[0])[0]
|
|
188
|
-
# start = os.path.join("..",'daq_scan')
|
|
189
193
|
ioxml.parameter_to_xml_file(
|
|
190
|
-
self.settings,
|
|
194
|
+
self.settings, self.batch_path.joinpath(self.settings.child('filename').value()))
|
|
191
195
|
|
|
192
196
|
return res == dialog.Accepted
|
|
193
197
|
|
|
198
|
+
def set_scanner_settings(self, settings_tree: QtWidgets.QWidget):
|
|
199
|
+
while True:
|
|
200
|
+
child = self.scanner_widget.layout().takeAt(0)
|
|
201
|
+
if not child:
|
|
202
|
+
break
|
|
203
|
+
child.widget().deleteLater()
|
|
204
|
+
QtWidgets.QApplication.processEvents()
|
|
205
|
+
|
|
206
|
+
self.scanner_widget.layout().addWidget(settings_tree)
|
|
207
|
+
|
|
208
|
+
def update_actuators(self, actuators: List[str]):
|
|
209
|
+
self.scanner.actuators = self.modules_manager.actuators
|
|
210
|
+
|
|
194
211
|
def add_scan(self, name=None, title=None):
|
|
195
212
|
if name is None or name is False:
|
|
196
213
|
name_prefix = 'scan'
|
|
@@ -204,17 +221,18 @@ class BatchManager:
|
|
|
204
221
|
|
|
205
222
|
child = {'title': title, 'name': name, 'type': 'group', 'removable': True, 'children': params}
|
|
206
223
|
|
|
207
|
-
self.
|
|
224
|
+
# self._scans[name] = Scanner(actuators=self.modules_manager.actuators)
|
|
225
|
+
|
|
208
226
|
self.settings.child('scans').addChild(child)
|
|
209
227
|
self.settings.child('scans', name, 'modules',
|
|
210
|
-
'actuators').setValue(dict(all_items=self.
|
|
211
|
-
selected=
|
|
228
|
+
'actuators').setValue(dict(all_items=self.modules_manager.actuators_name,
|
|
229
|
+
selected=self.modules_manager.selected_actuators_name))
|
|
212
230
|
self.settings.child('scans', name, 'modules',
|
|
213
|
-
'detectors').setValue(dict(all_items=self.
|
|
214
|
-
selected=
|
|
231
|
+
'detectors').setValue(dict(all_items=self.modules_manager.detectors_name,
|
|
232
|
+
selected=self.modules_manager.selected_detectors_name))
|
|
215
233
|
|
|
216
|
-
self.settings.child('scans', name).addChild(
|
|
217
|
-
|
|
234
|
+
self.settings.child('scans', name).addChild(self.create_parameter(self.scanner.settings))
|
|
235
|
+
self.settings.child('scans', name).addChild(self.create_parameter(self.scanner.get_scanner_sub_settings()))
|
|
218
236
|
|
|
219
237
|
|
|
220
238
|
class BatchScanner(QtCore.QObject):
|
|
@@ -229,27 +247,29 @@ class BatchScanner(QtCore.QObject):
|
|
|
229
247
|
|
|
230
248
|
@property
|
|
231
249
|
def scans_names(self):
|
|
232
|
-
return
|
|
250
|
+
return self.batchmanager.get_scan_names()
|
|
251
|
+
|
|
252
|
+
def get_scan(self, name: str):
|
|
253
|
+
return self.batchmanager.get_scan(name)
|
|
233
254
|
|
|
234
255
|
def get_act_dets(self):
|
|
235
256
|
return self.batchmanager.get_act_dets()
|
|
236
257
|
|
|
237
258
|
def setupUI(self):
|
|
238
259
|
# %% create scan dock and make it a floating window
|
|
239
|
-
self.batch_dock =
|
|
260
|
+
self.batch_dock = Dock("BatchScanner", size=(1, 1), autoOrientation=False) # give this dock the minimum possible size
|
|
240
261
|
self.dockarea.addDock(self.batch_dock, 'left')
|
|
241
262
|
self.batch_dock.float()
|
|
242
263
|
|
|
243
264
|
self.widget = QtWidgets.QWidget()
|
|
244
265
|
self.widget.setLayout(QtWidgets.QVBoxLayout())
|
|
245
266
|
|
|
246
|
-
|
|
247
267
|
widget_infos = QtWidgets.QWidget()
|
|
248
268
|
self.widget_infos_list = QtWidgets.QListWidget()
|
|
249
269
|
widget_infos.setLayout(QtWidgets.QHBoxLayout())
|
|
250
270
|
splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal)
|
|
251
271
|
widget_infos.layout().addWidget(splitter)
|
|
252
|
-
splitter.addWidget(self.batchmanager.
|
|
272
|
+
splitter.addWidget(self.batchmanager.settings_tree)
|
|
253
273
|
splitter.addWidget(self.widget_infos_list)
|
|
254
274
|
self.batch_dock.addWidget(self.widget)
|
|
255
275
|
self.widget.layout().addWidget(widget_infos)
|
|
@@ -279,17 +299,15 @@ class BatchScanner(QtCore.QObject):
|
|
|
279
299
|
slots[filestem].triggered.connect(
|
|
280
300
|
self.create_menu_slot(batch_path.joinpath(file)))
|
|
281
301
|
|
|
282
|
-
|
|
283
302
|
def load_file(self, filepath=None):
|
|
284
303
|
if filepath is None:
|
|
285
|
-
path = pymodaq.
|
|
304
|
+
path = pymodaq.utils.gui_utils.file_io.select_file(start_path=batch_path, save=False, ext='xml')
|
|
286
305
|
if path != '':
|
|
287
306
|
filepath = path
|
|
288
307
|
else:
|
|
289
308
|
return
|
|
290
309
|
self.batchmanager.set_file_batch(str(filepath), show=False)
|
|
291
310
|
|
|
292
|
-
|
|
293
311
|
infos = self.batchmanager.set_scans()
|
|
294
312
|
self.widget_infos_list.addItems(infos)
|
|
295
313
|
|
|
@@ -297,20 +315,34 @@ class BatchScanner(QtCore.QObject):
|
|
|
297
315
|
return lambda: self.load_file(filename)
|
|
298
316
|
|
|
299
317
|
|
|
300
|
-
|
|
318
|
+
def main_batch_scanner():
|
|
319
|
+
from pymodaq.control_modules.mocks import MockDAQMove, MockDAQViewer
|
|
301
320
|
app = QtWidgets.QApplication(sys.argv)
|
|
302
321
|
win = QtWidgets.QMainWindow()
|
|
303
|
-
area = pymodaq.
|
|
322
|
+
area = pymodaq.utils.gui_utils.dock.DockArea()
|
|
304
323
|
win.setCentralWidget(area)
|
|
305
324
|
|
|
306
325
|
# prog = BatchManager(msgbox=False, actuators=['Xaxis', 'Yaxis'], detectors=['Det0D', 'Det1D'])
|
|
307
326
|
# prog.set_file_batch('C:\\Users\\weber\\pymodaq_local\\batch_configs\\batch_default.xml', show=False)
|
|
308
327
|
# prog.set_scans()
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
328
|
+
actuators = [MockDAQMove(title='Xaxis'), MockDAQMove(title='Yaxis')]
|
|
329
|
+
detectors = [MockDAQViewer(title='Det0D'), MockDAQViewer(title='Det1D')]
|
|
330
|
+
main = BatchScanner(area, actuators=actuators, detectors=detectors)
|
|
312
331
|
main.setupUI()
|
|
313
332
|
main.create_menu()
|
|
314
333
|
win.show()
|
|
315
334
|
sys.exit(app.exec_())
|
|
316
335
|
|
|
336
|
+
|
|
337
|
+
def main_batch_manager():
|
|
338
|
+
from pymodaq.control_modules.mocks import MockDAQMove, MockDAQViewer
|
|
339
|
+
app = QtWidgets.QApplication(sys.argv)
|
|
340
|
+
actuators = [MockDAQMove(title='Xaxis'), MockDAQMove(title='Yaxis')]
|
|
341
|
+
detectors = [MockDAQViewer(title='Det0D'), MockDAQViewer(title='Det1D')]
|
|
342
|
+
prog = BatchManager(msgbox=True, actuators=actuators, detectors=detectors)
|
|
343
|
+
sys.exit(app.exec_())
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
if __name__ == '__main__':
|
|
347
|
+
#main_batch_manager()
|
|
348
|
+
main_batch_scanner()
|