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
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created the 06/12/2022
|
|
4
|
+
|
|
5
|
+
@author: Sebastien Weber
|
|
6
|
+
"""
|
|
7
|
+
import sys
|
|
8
|
+
from typing import List, TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
from qtpy import QtWidgets, QtCore
|
|
11
|
+
from qtpy.QtCore import Signal
|
|
12
|
+
|
|
13
|
+
from pymodaq.utils.gui_utils import CustomApp
|
|
14
|
+
from pymodaq.utils.logger import set_logger, get_module_name
|
|
15
|
+
from pymodaq.utils.config import Config, get_set_preset_path
|
|
16
|
+
from pymodaq.utils.gui_utils import DockArea, Dock
|
|
17
|
+
from pymodaq.utils.gui_utils.widgets.spinbox import QSpinBox_ro
|
|
18
|
+
from pymodaq.utils.parameter.pymodaq_ptypes.led import QLED
|
|
19
|
+
from pymodaq.utils.plotting.data_viewers.viewer import ViewerDispatcher, ViewersEnum
|
|
20
|
+
from pymodaq.utils.daq_utils import ThreadCommand
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from pymodaq.utils.parameter import ParameterTree
|
|
24
|
+
|
|
25
|
+
config = Config()
|
|
26
|
+
logger = set_logger(get_module_name(__file__))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class DAQScanUI(CustomApp, ViewerDispatcher):
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
"""
|
|
33
|
+
command_sig = Signal(ThreadCommand)
|
|
34
|
+
|
|
35
|
+
def __init__(self, parent):
|
|
36
|
+
CustomApp.__init__(self, parent)
|
|
37
|
+
self.setup_docks()
|
|
38
|
+
ViewerDispatcher.__init__(self, self.dockarea, title='Scanner', next_to_dock=self.dock_command)
|
|
39
|
+
|
|
40
|
+
self.setup_menu()
|
|
41
|
+
self.setup_actions()
|
|
42
|
+
self.connect_things()
|
|
43
|
+
|
|
44
|
+
def setup_actions(self):
|
|
45
|
+
self.add_action('quit', 'Quit the module', 'close2', menu=self.file_menu)
|
|
46
|
+
self.add_action('ini_positions', 'Init Positions', '', menu=self.action_menu)
|
|
47
|
+
self.add_action('start', 'Start Scan', 'run2', "Start the scan", menu=self.action_menu)
|
|
48
|
+
self.add_action('start_batch', 'Start ScanBatches', 'run_all', "Start the batch of scans", menu=self.action_menu)
|
|
49
|
+
self.add_action('stop', 'Stop Scan', 'stop', "Stop the scan", menu=self.action_menu)
|
|
50
|
+
self.add_action('move_at', 'Move at doubleClicked', 'move_contour',
|
|
51
|
+
"Move to positions where you double clicked", checkable=True, menu=self.action_menu)
|
|
52
|
+
self.add_action('log', 'Show Log file', 'information2', menu=self.file_menu)
|
|
53
|
+
|
|
54
|
+
self.add_action('load', 'Load File', 'Open', menu=self.file_menu, auto_toolbar=False)
|
|
55
|
+
self.file_menu.addSeparator()
|
|
56
|
+
self.add_action('save', 'Save file as', 'SaveAs', menu=self.file_menu, auto_toolbar=False)
|
|
57
|
+
self.add_action('show_file', 'Show file content', '', menu=self.file_menu, auto_toolbar=False)
|
|
58
|
+
|
|
59
|
+
self.add_action('navigator', 'Show Navigator', '', menu=self.settings_menu, auto_toolbar=False)
|
|
60
|
+
self.add_action('batch', 'Show Batch Scanner', '', menu=self.settings_menu, auto_toolbar=False)
|
|
61
|
+
self.set_action_visible('start_batch', False)
|
|
62
|
+
|
|
63
|
+
def enable_start_stop(self, enable=True):
|
|
64
|
+
"""If True enable main buttons to launch/stop scan"""
|
|
65
|
+
self.set_action_enabled('start', enable)
|
|
66
|
+
self.set_action_enabled('stop', enable)
|
|
67
|
+
|
|
68
|
+
def connect_things(self):
|
|
69
|
+
self.connect_action('quit', lambda: self.command_sig.emit(ThreadCommand('quit')))
|
|
70
|
+
self.connect_action('ini_positions', lambda: self.command_sig.emit(ThreadCommand('ini_positions')))
|
|
71
|
+
self.connect_action('start', lambda: self.command_sig.emit(ThreadCommand('start')))
|
|
72
|
+
self.connect_action('start_batch', lambda: self.command_sig.emit(ThreadCommand('start_batch')))
|
|
73
|
+
self.connect_action('stop', lambda: self.command_sig.emit(ThreadCommand('stop')))
|
|
74
|
+
self.connect_action('move_at', lambda: self.command_sig.emit(ThreadCommand('move_at')))
|
|
75
|
+
self.connect_action('log', lambda: self.command_sig.emit(ThreadCommand('show_log', )))
|
|
76
|
+
|
|
77
|
+
self.connect_action('load', lambda: self.command_sig.emit(ThreadCommand('load')))
|
|
78
|
+
self.connect_action('save', lambda: self.command_sig.emit(ThreadCommand('save')))
|
|
79
|
+
self.connect_action('show_file', lambda: self.command_sig.emit(ThreadCommand('show_file')))
|
|
80
|
+
self.connect_action('navigator', lambda: self.command_sig.emit(ThreadCommand('navigator')))
|
|
81
|
+
self.connect_action('batch', lambda: self.command_sig.emit(ThreadCommand('batch')))
|
|
82
|
+
|
|
83
|
+
def setup_menu(self):
|
|
84
|
+
self.menubar = QtWidgets.QMenuBar()
|
|
85
|
+
self.menubar.setMaximumHeight(30)
|
|
86
|
+
self.mainwindow.setMenuBar(self.menubar)
|
|
87
|
+
self.file_menu = self.menubar.addMenu('File')
|
|
88
|
+
self.settings_menu = self.menubar.addMenu('Settings')
|
|
89
|
+
self.action_menu = self.menubar.addMenu('Actions')
|
|
90
|
+
|
|
91
|
+
def setup_docks(self):
|
|
92
|
+
self.dock_command = Dock('Scan Command')
|
|
93
|
+
self.dockarea.addDock(self.dock_command)
|
|
94
|
+
|
|
95
|
+
widget_command = QtWidgets.QWidget()
|
|
96
|
+
widget_command.setLayout(QtWidgets.QVBoxLayout())
|
|
97
|
+
self.dock_command.addWidget(widget_command)
|
|
98
|
+
widget_command.layout().addWidget(self._toolbar)
|
|
99
|
+
|
|
100
|
+
splitter_widget = QtWidgets.QSplitter(QtCore.Qt.Horizontal)
|
|
101
|
+
splitter_v_widget = QtWidgets.QSplitter(QtCore.Qt.Vertical)
|
|
102
|
+
widget_command.layout().addWidget(splitter_widget)
|
|
103
|
+
splitter_widget.addWidget(splitter_v_widget)
|
|
104
|
+
self.module_widget = QtWidgets.QWidget()
|
|
105
|
+
self.module_widget.setLayout(QtWidgets.QVBoxLayout())
|
|
106
|
+
self.module_widget.setMinimumWidth(220)
|
|
107
|
+
self.module_widget.setMaximumWidth(400)
|
|
108
|
+
|
|
109
|
+
self.plotting_widget = QtWidgets.QWidget()
|
|
110
|
+
self.plotting_widget.setLayout(QtWidgets.QVBoxLayout())
|
|
111
|
+
self.plotting_widget.setMinimumWidth(220)
|
|
112
|
+
self.plotting_widget.setMaximumWidth(400)
|
|
113
|
+
|
|
114
|
+
settings_widget = QtWidgets.QWidget()
|
|
115
|
+
settings_widget.setLayout(QtWidgets.QVBoxLayout())
|
|
116
|
+
settings_widget.setMinimumWidth(220)
|
|
117
|
+
|
|
118
|
+
splitter_v_widget.addWidget(self.module_widget)
|
|
119
|
+
splitter_v_widget.addWidget(self.plotting_widget)
|
|
120
|
+
|
|
121
|
+
splitter_v_widget.setSizes([400, 400])
|
|
122
|
+
splitter_widget.addWidget(settings_widget)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
self._statusbar = QtWidgets.QStatusBar()
|
|
126
|
+
self.mainwindow.setStatusBar(self._statusbar)
|
|
127
|
+
self.populate_status_bar()
|
|
128
|
+
|
|
129
|
+
self.settings_toolbox = QtWidgets.QToolBox()
|
|
130
|
+
settings_widget.layout().addWidget(self.settings_toolbox)
|
|
131
|
+
self.scanner_widget = QtWidgets.QWidget()
|
|
132
|
+
self.scanner_widget.setLayout(QtWidgets.QVBoxLayout())
|
|
133
|
+
self.settings_toolbox.addItem(self.scanner_widget, 'Scanner Settings')
|
|
134
|
+
|
|
135
|
+
def add_settings_toolbox_widget(self, widget: QtWidgets.QWidget, name: str):
|
|
136
|
+
"""Add a widget, usaually a ParameterTree to the SettingsToolbox"""
|
|
137
|
+
self.settings_toolbox.addItem(widget, name)
|
|
138
|
+
|
|
139
|
+
def add_scanner_settings(self, tree: 'ParameterTree'):
|
|
140
|
+
"""Adds a ParameterTree to the Scanner settings widget"""
|
|
141
|
+
self.scanner_widget.layout().addWidget(tree)
|
|
142
|
+
|
|
143
|
+
def populate_toolbox_widget(self, widgets: List[QtWidgets.QWidget], names: List[str]):
|
|
144
|
+
for widget, name in zip(widgets, names):
|
|
145
|
+
self.settings_toolbox.addItem(widget, name)
|
|
146
|
+
|
|
147
|
+
def set_scanner_settings(self, settings_tree: QtWidgets.QWidget):
|
|
148
|
+
while True:
|
|
149
|
+
child = self.scanner_widget.layout().takeAt(0)
|
|
150
|
+
if not child:
|
|
151
|
+
break
|
|
152
|
+
child.widget().deleteLater()
|
|
153
|
+
QtWidgets.QApplication.processEvents()
|
|
154
|
+
|
|
155
|
+
self.scanner_widget.layout().addWidget(settings_tree)
|
|
156
|
+
|
|
157
|
+
def set_modules_settings(self, settings_widget):
|
|
158
|
+
self.module_widget.layout().addWidget(settings_widget)
|
|
159
|
+
|
|
160
|
+
def set_plotting_settings(self, settings_plotting):
|
|
161
|
+
self.plotting_widget.layout().addWidget(settings_plotting)
|
|
162
|
+
|
|
163
|
+
def populate_status_bar(self):
|
|
164
|
+
self._status_message_label = QtWidgets.QLabel('Initializing')
|
|
165
|
+
self._n_scan_steps_sb = QSpinBox_ro()
|
|
166
|
+
self._n_scan_steps_sb.setToolTip('Total number of steps')
|
|
167
|
+
self._indice_scan_sb = QSpinBox_ro()
|
|
168
|
+
self._indice_scan_sb.setToolTip('Current step value')
|
|
169
|
+
self._indice_average_sb = QSpinBox_ro()
|
|
170
|
+
self._indice_average_sb.setToolTip('Current average value')
|
|
171
|
+
|
|
172
|
+
self._scan_done_LED = QLED()
|
|
173
|
+
self._scan_done_LED.set_as_false()
|
|
174
|
+
self._scan_done_LED.clickable = False
|
|
175
|
+
self._scan_done_LED.setToolTip('Scan done state')
|
|
176
|
+
self._statusbar.addPermanentWidget(self._status_message_label)
|
|
177
|
+
|
|
178
|
+
self._statusbar.addPermanentWidget(self._n_scan_steps_sb)
|
|
179
|
+
self._statusbar.addPermanentWidget(self._indice_scan_sb)
|
|
180
|
+
self._statusbar.addPermanentWidget(self._indice_average_sb)
|
|
181
|
+
self._indice_average_sb.setVisible(False)
|
|
182
|
+
self._statusbar.addPermanentWidget(self._scan_done_LED)
|
|
183
|
+
|
|
184
|
+
@property
|
|
185
|
+
def n_scan_steps(self):
|
|
186
|
+
return self._n_scan_steps_sb.value()
|
|
187
|
+
|
|
188
|
+
@n_scan_steps.setter
|
|
189
|
+
def n_scan_steps(self, nsteps: int):
|
|
190
|
+
self._n_scan_steps_sb.setValue(nsteps)
|
|
191
|
+
|
|
192
|
+
def display_status(self, status: str, wait_time=1000):
|
|
193
|
+
self._statusbar.showMessage(status, wait_time)
|
|
194
|
+
|
|
195
|
+
def set_permanent_status(self, status: str):
|
|
196
|
+
self._status_message_label.setText(status)
|
|
197
|
+
|
|
198
|
+
def set_scan_step(self, step_ind: int):
|
|
199
|
+
self._indice_scan_sb.setValue(step_ind)
|
|
200
|
+
|
|
201
|
+
def show_average_step(self, show: bool = True):
|
|
202
|
+
self._indice_average_sb.setVisible(show)
|
|
203
|
+
|
|
204
|
+
def set_scan_step_average(self, step_ind: int):
|
|
205
|
+
self._indice_average_sb.setValue(step_ind)
|
|
206
|
+
|
|
207
|
+
def set_scan_done(self, done=True):
|
|
208
|
+
self._scan_done_LED.set_as(done)
|
|
209
|
+
|
|
210
|
+
def update_viewers(self, viewers_type: List[ViewersEnum], viewers_name: List[str] = None, force=False):
|
|
211
|
+
super().update_viewers(viewers_type, viewers_name, force)
|
|
212
|
+
self.command_sig.emit(ThreadCommand('viewers_changed', attribute=dict(viewer_types=self.viewer_types,
|
|
213
|
+
viewers=self.viewers)))
|
|
214
|
+
|
|
215
|
+
def main():
|
|
216
|
+
|
|
217
|
+
app = QtWidgets.QApplication(sys.argv)
|
|
218
|
+
|
|
219
|
+
win = QtWidgets.QMainWindow()
|
|
220
|
+
dockarea = DockArea()
|
|
221
|
+
win.setCentralWidget(dockarea)
|
|
222
|
+
win.resize(1000, 500)
|
|
223
|
+
win.setWindowTitle('DAQScan Extension')
|
|
224
|
+
|
|
225
|
+
prog = DAQScanUI(dockarea)
|
|
226
|
+
win.show()
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def print_command_sig(cmd_sig):
|
|
230
|
+
print(cmd_sig)
|
|
231
|
+
prog.display_status(str(cmd_sig))
|
|
232
|
+
|
|
233
|
+
prog.command_sig.connect(print_command_sig)
|
|
234
|
+
prog.update_viewers([ViewersEnum['Viewer0D'], ViewersEnum['Viewer1D'], ViewersEnum['Viewer2D']])
|
|
235
|
+
|
|
236
|
+
sys.exit(app.exec_())
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
if __name__ == '__main__':
|
|
240
|
+
main()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from qtpy import QtWidgets
|
|
3
|
+
from pymodaq.utils.h5modules.browsing import H5Browser
|
|
4
|
+
from pymodaq.utils.config import Config
|
|
5
|
+
|
|
6
|
+
config = Config()
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def main():
|
|
10
|
+
app = QtWidgets.QApplication(sys.argv)
|
|
11
|
+
if config['style']['darkstyle']:
|
|
12
|
+
import qdarkstyle
|
|
13
|
+
app.setStyleSheet(qdarkstyle.load_stylesheet())
|
|
14
|
+
|
|
15
|
+
win = QtWidgets.QMainWindow()
|
|
16
|
+
prog = H5Browser(win)
|
|
17
|
+
win.show()
|
|
18
|
+
QtWidgets.QApplication.processEvents()
|
|
19
|
+
sys.exit(app.exec_())
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
if __name__ == '__main__':
|
|
23
|
+
main()
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import importlib
|
|
2
2
|
from pathlib import Path
|
|
3
|
-
|
|
4
|
-
logger
|
|
3
|
+
|
|
4
|
+
from pymodaq.utils.logger import set_logger, get_module_name
|
|
5
|
+
from pymodaq.utils import daq_utils as utils
|
|
6
|
+
logger = set_logger('move_plugins', add_to_console=False)
|
|
5
7
|
|
|
6
8
|
for path in Path(__file__).parent.iterdir():
|
|
7
9
|
try:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
from pymodaq.
|
|
2
|
-
from pymodaq.
|
|
1
|
+
from pymodaq.utils.daq_utils import ThreadCommand
|
|
2
|
+
from pymodaq.control_modules.move_utility_classes import DAQ_Move_base, comon_parameters_fun
|
|
3
3
|
from easydict import EasyDict as edict
|
|
4
4
|
|
|
5
5
|
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
+
import time
|
|
2
|
+
from functools import partial # needed for the button to sync setpoint with currpoint
|
|
1
3
|
|
|
4
|
+
from pyqtgraph.widgets.SpinBox import SpinBox
|
|
2
5
|
from qtpy import QtGui, QtWidgets
|
|
3
6
|
from qtpy.QtCore import QObject, Slot, QThread, Signal
|
|
4
|
-
from pyqtgraph.widgets.SpinBox import SpinBox
|
|
5
7
|
|
|
6
|
-
from pymodaq.daq_utils.parameter import utils as putils
|
|
7
|
-
from pymodaq.daq_utils.daq_utils import ThreadCommand, set_logger, get_module_name, \
|
|
8
|
-
get_models, find_dict_in_list_from_key_val
|
|
9
|
-
from pymodaq.daq_utils.managers.modules_manager import ModulesManager
|
|
10
|
-
from pyqtgraph.parametertree import Parameter, ParameterTree
|
|
11
|
-
from pymodaq.daq_utils.plotting.data_viewers.viewer0D import Viewer0D
|
|
12
|
-
from pymodaq.daq_utils.gui_utils.widgets import QLED
|
|
13
|
-
from pymodaq.pid.utils import OutputToActuator, InputFromDetector
|
|
14
|
-
from pymodaq.daq_utils.gui_utils.dock import DockArea, Dock
|
|
15
8
|
from simple_pid import PID
|
|
16
|
-
|
|
9
|
+
|
|
10
|
+
from pymodaq.utils.parameter import utils as putils
|
|
11
|
+
from pymodaq.utils.parameter import Parameter, ParameterTree
|
|
12
|
+
from pymodaq.utils.logger import set_logger, get_module_name
|
|
13
|
+
from pymodaq.utils.daq_utils import ThreadCommand, find_dict_in_list_from_key_val
|
|
14
|
+
from pymodaq.utils.managers.modules_manager import ModulesManager
|
|
15
|
+
from pymodaq.utils.plotting.data_viewers.viewer0D import Viewer0D
|
|
16
|
+
from pymodaq.utils.gui_utils.widgets import QLED
|
|
17
|
+
from pymodaq.extensions.pid.utils import OutputToActuator, InputFromDetector, get_models
|
|
18
|
+
from pymodaq.utils.gui_utils.dock import DockArea, Dock
|
|
17
19
|
|
|
18
20
|
logger = set_logger(get_module_name(__file__))
|
|
19
21
|
|
|
22
|
+
|
|
20
23
|
def convert_output_limits(lim_min=-10., min_status=False, lim_max=10., max_status=False):
|
|
21
24
|
output = [None, None]
|
|
22
25
|
if min_status:
|
|
@@ -77,7 +80,7 @@ class DAQ_PID(QObject):
|
|
|
77
80
|
]
|
|
78
81
|
|
|
79
82
|
def __init__(self, dockarea):
|
|
80
|
-
|
|
83
|
+
|
|
81
84
|
super().__init__()
|
|
82
85
|
|
|
83
86
|
self.settings = Parameter.create(title='PID settings', name='pid_settings', type='group', children=self.params)
|
|
@@ -160,7 +163,7 @@ class DAQ_PID(QObject):
|
|
|
160
163
|
|
|
161
164
|
def enable_controls_pid(self, enable=False):
|
|
162
165
|
self.ini_PID_action.setEnabled(enable)
|
|
163
|
-
#self.setpoint_sb.setOpts(enabled=enable)
|
|
166
|
+
# self.setpoint_sb.setOpts(enabled=enable)
|
|
164
167
|
|
|
165
168
|
def enable_controls_pid_run(self, enable=False):
|
|
166
169
|
self.run_action.setEnabled(enable)
|
|
@@ -228,10 +231,11 @@ class DAQ_PID(QObject):
|
|
|
228
231
|
lab = QtWidgets.QLabel('Target Value:')
|
|
229
232
|
self.toolbar_layout.addWidget(lab, 3, 0, 1, 2)
|
|
230
233
|
|
|
231
|
-
|
|
232
234
|
lab1 = QtWidgets.QLabel('Current Value:')
|
|
233
235
|
self.toolbar_layout.addWidget(lab1, 4, 0, 1, 2)
|
|
234
236
|
|
|
237
|
+
labmaj = QtWidgets.QLabel('Sync Value:')
|
|
238
|
+
self.toolbar_layout.addWidget(labmaj, 5, 0, 1, 2)
|
|
235
239
|
|
|
236
240
|
# create main parameter tree
|
|
237
241
|
self.settings_tree = ParameterTree()
|
|
@@ -288,7 +292,6 @@ class DAQ_PID(QObject):
|
|
|
288
292
|
setp.setEnabled(not self.pause_action.isChecked())
|
|
289
293
|
self.command_pid.emit(ThreadCommand('pause_PID', [self.pause_action.isChecked()]))
|
|
290
294
|
|
|
291
|
-
|
|
292
295
|
def stop_moves(self, overshoot):
|
|
293
296
|
"""
|
|
294
297
|
Foreach module of the move module object list, stop motion.
|
|
@@ -353,15 +356,15 @@ class DAQ_PID(QObject):
|
|
|
353
356
|
def set_setpoints_buttons(self):
|
|
354
357
|
self.setpoints_sb = []
|
|
355
358
|
self.currpoints_sb = []
|
|
359
|
+
self.syncvalue_pb = []
|
|
356
360
|
for ind_set in range(self.model_class.Nsetpoints):
|
|
357
|
-
|
|
358
361
|
self.setpoints_sb.append(SpinBox())
|
|
359
362
|
self.setpoints_sb[-1].setMinimumHeight(40)
|
|
360
363
|
font = self.setpoints_sb[-1].font()
|
|
361
364
|
font.setPointSizeF(20)
|
|
362
365
|
self.setpoints_sb[-1].setFont(font)
|
|
363
366
|
self.setpoints_sb[-1].setDecimals(6)
|
|
364
|
-
self.toolbar_layout.addWidget(self.setpoints_sb[-1], 3, 2+ind_set, 1, 1)
|
|
367
|
+
self.toolbar_layout.addWidget(self.setpoints_sb[-1], 3, 2 + ind_set, 1, 1)
|
|
365
368
|
self.setpoints_sb[-1].valueChanged.connect(self.update_runner_setpoints)
|
|
366
369
|
|
|
367
370
|
self.currpoints_sb.append(SpinBox())
|
|
@@ -372,10 +375,20 @@ class DAQ_PID(QObject):
|
|
|
372
375
|
font = self.currpoints_sb[-1].font()
|
|
373
376
|
font.setPointSizeF(20)
|
|
374
377
|
self.currpoints_sb[-1].setFont(font)
|
|
375
|
-
self.toolbar_layout.addWidget(self.currpoints_sb[-1], 4, 2+ind_set, 1, 1)
|
|
378
|
+
self.toolbar_layout.addWidget(self.currpoints_sb[-1], 4, 2 + ind_set, 1, 1)
|
|
376
379
|
|
|
380
|
+
self.syncvalue_pb.append(QtWidgets.QPushButton('Synchro {}'.format(ind_set)))
|
|
381
|
+
self.syncvalue_pb[ind_set].clicked.connect(partial(self.currpoint_as_setpoint, ind_set))
|
|
382
|
+
self.toolbar_layout.addWidget(self.syncvalue_pb[-1], 5, 2 + ind_set)
|
|
377
383
|
self.setpoints_signal.connect(self.setpoints_external)
|
|
378
384
|
|
|
385
|
+
def currpoint_as_setpoint(self, i=0):
|
|
386
|
+
'''
|
|
387
|
+
Function used by the sync buttons. The button i will attribute the value of the i-th currpoint to the i-th setpoint.
|
|
388
|
+
'''
|
|
389
|
+
self.setpoints_sb[i].setValue(self.curr_points[i])
|
|
390
|
+
self.update_runner_setpoints
|
|
391
|
+
|
|
379
392
|
def quit_fun(self):
|
|
380
393
|
"""
|
|
381
394
|
"""
|
|
@@ -432,16 +445,15 @@ class DAQ_PID(QObject):
|
|
|
432
445
|
elif param.name() in putils.iter_children(
|
|
433
446
|
self.settings.child('main_settings', 'pid_controls', 'output_limits'), []):
|
|
434
447
|
|
|
435
|
-
|
|
436
448
|
output_limits = convert_output_limits(
|
|
437
449
|
self.settings.child('main_settings', 'pid_controls', 'output_limits',
|
|
438
450
|
'output_limit_min').value(),
|
|
439
451
|
self.settings.child('main_settings', 'pid_controls', 'output_limits',
|
|
440
|
-
|
|
452
|
+
'output_limit_min_enabled').value(),
|
|
441
453
|
self.settings.child('main_settings', 'pid_controls', 'output_limits',
|
|
442
|
-
|
|
454
|
+
'output_limit_max').value(),
|
|
443
455
|
self.settings.child('main_settings', 'pid_controls', 'output_limits',
|
|
444
|
-
|
|
456
|
+
'output_limit_max_enabled').value())
|
|
445
457
|
|
|
446
458
|
self.command_pid.emit(ThreadCommand('update_options', dict(output_limits=output_limits)))
|
|
447
459
|
|
|
@@ -493,8 +505,8 @@ class PIDRunner(QObject):
|
|
|
493
505
|
Nsetpoints = model_class.Nsetpoints
|
|
494
506
|
self.current_time = 0
|
|
495
507
|
self.inputs_from_dets = InputFromDetector(values=setpoints)
|
|
496
|
-
self.outputs =
|
|
497
|
-
self.outputs_to_actuators = OutputToActuator(values=[0. for
|
|
508
|
+
self.outputs = [0. for _ in range(Nsetpoints)]
|
|
509
|
+
self.outputs_to_actuators = OutputToActuator(values=[0. for _ in range(Nsetpoints)])
|
|
498
510
|
|
|
499
511
|
if 'sample_time' in params:
|
|
500
512
|
self.sample_time = params['sample_time']
|
|
@@ -516,11 +528,11 @@ class PIDRunner(QObject):
|
|
|
516
528
|
# self.timeout_timer.timeout.connect(self.timeout)
|
|
517
529
|
#
|
|
518
530
|
def timerEvent(self, event):
|
|
519
|
-
|
|
520
|
-
|
|
531
|
+
self.pid_output_signal.emit(dict(output=self.outputs_to_actuators.values,
|
|
532
|
+
input=self.inputs_from_dets.values))
|
|
521
533
|
|
|
522
534
|
@Slot(ThreadCommand)
|
|
523
|
-
def queue_command(self, command
|
|
535
|
+
def queue_command(self, command: ThreadCommand):
|
|
524
536
|
"""
|
|
525
537
|
"""
|
|
526
538
|
if command.command == "start_PID":
|
|
@@ -617,11 +629,11 @@ class PIDRunner(QObject):
|
|
|
617
629
|
def set_option(self, **option):
|
|
618
630
|
for pid in self.pids:
|
|
619
631
|
for key in option:
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
632
|
+
if hasattr(pid, key):
|
|
633
|
+
if key == 'sample_time':
|
|
634
|
+
setattr(pid, key, option[key] / 1000)
|
|
635
|
+
else:
|
|
636
|
+
setattr(pid, key, option[key])
|
|
625
637
|
|
|
626
638
|
def run_PID(self, last_values):
|
|
627
639
|
logger.info('Stabilization started')
|
|
@@ -632,10 +644,10 @@ class PIDRunner(QObject):
|
|
|
632
644
|
for ind, pid in enumerate(self.pids):
|
|
633
645
|
if pause_state:
|
|
634
646
|
pid.set_auto_mode(False)
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
647
|
+
logger.info('Stabilization paused')
|
|
648
|
+
else:
|
|
649
|
+
pid.set_auto_mode(True, self.outputs[ind])
|
|
650
|
+
logger.info('Stabilization restarted from pause')
|
|
639
651
|
self.paused = pause_state
|
|
640
652
|
|
|
641
653
|
def stop_PID(self):
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import importlib
|
|
2
|
+
import inspect
|
|
3
|
+
import pkgutil
|
|
4
|
+
from importlib import metadata
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from pymodaq.utils.gui_utils.dock import DockArea
|
|
8
|
+
from pymodaq.utils.daq_utils import get_plugins
|
|
9
|
+
from pymodaq.utils.logger import get_module_name, set_logger
|
|
10
|
+
from pymodaq.utils.daq_utils import find_dict_in_list_from_key_val
|
|
11
|
+
|
|
3
12
|
logger = set_logger(get_module_name(__file__))
|
|
4
13
|
|
|
5
14
|
DAQ_Move_Stage_type = get_plugins('daq_move')
|
|
@@ -9,7 +18,6 @@ DAQ_2DViewer_Det_types = get_plugins('daq_2Dviewer')
|
|
|
9
18
|
DAQ_NDViewer_Det_types = get_plugins('daq_NDviewer')
|
|
10
19
|
|
|
11
20
|
|
|
12
|
-
|
|
13
21
|
class InputFromDetector:
|
|
14
22
|
def __init__(self, values=[]):
|
|
15
23
|
super().__init__()
|
|
@@ -136,11 +144,10 @@ class PIDModelGeneric:
|
|
|
136
144
|
|
|
137
145
|
def main(xmlfile):
|
|
138
146
|
from pymodaq.dashboard import DashBoard
|
|
139
|
-
from pymodaq.
|
|
140
|
-
from pymodaq.daq_utils import gui_utils as gutils
|
|
147
|
+
from pymodaq.utils.config import get_set_preset_path
|
|
141
148
|
from pathlib import Path
|
|
142
149
|
from qtpy import QtWidgets
|
|
143
|
-
from
|
|
150
|
+
from extensions.pid.pid_controller import DAQ_PID
|
|
144
151
|
|
|
145
152
|
import sys
|
|
146
153
|
app = QtWidgets.QApplication(sys.argv)
|
|
@@ -175,3 +182,42 @@ def main(xmlfile):
|
|
|
175
182
|
ret = msgBox.exec()
|
|
176
183
|
|
|
177
184
|
sys.exit(app.exec_())
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def get_models(model_name=None):
|
|
188
|
+
"""
|
|
189
|
+
Get PID Models as a list to instantiate Control Actuators per degree of liberty in the model
|
|
190
|
+
|
|
191
|
+
Returns
|
|
192
|
+
-------
|
|
193
|
+
list: list of disct containting the name and python module of the found models
|
|
194
|
+
"""
|
|
195
|
+
from pymodaq.extensions.pid.utils import PIDModelGeneric
|
|
196
|
+
models_import = []
|
|
197
|
+
entry_points = metadata.entry_points()
|
|
198
|
+
if 'pymodaq.pid_models' in entry_points:
|
|
199
|
+
discovered_models = entry_points['pymodaq.pid_models']
|
|
200
|
+
for pkg in discovered_models:
|
|
201
|
+
try:
|
|
202
|
+
module = importlib.import_module(pkg.value)
|
|
203
|
+
module_name = pkg.value
|
|
204
|
+
|
|
205
|
+
for mod in pkgutil.iter_modules([str(Path(module.__file__).parent.joinpath('models'))]):
|
|
206
|
+
try:
|
|
207
|
+
model_module = importlib.import_module(f'{module_name}.models.{mod.name}', module)
|
|
208
|
+
classes = inspect.getmembers(model_module, inspect.isclass)
|
|
209
|
+
for name, klass in classes:
|
|
210
|
+
if klass.__base__ is PIDModelGeneric:
|
|
211
|
+
models_import.append({'name': mod.name, 'module': model_module, 'class': klass})
|
|
212
|
+
break
|
|
213
|
+
|
|
214
|
+
except Exception as e: # pragma: no cover
|
|
215
|
+
logger.warning(str(e))
|
|
216
|
+
|
|
217
|
+
except Exception as e: # pragma: no cover
|
|
218
|
+
logger.warning(f'Impossible to import the {pkg.value} extension: {str(e)}')
|
|
219
|
+
|
|
220
|
+
if model_name is None:
|
|
221
|
+
return models_import
|
|
222
|
+
else:
|
|
223
|
+
return find_dict_in_list_from_key_val(models_import, 'name', model_name)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created the 27/10/2022
|
|
4
|
+
|
|
5
|
+
@author: Sebastien Weber
|
|
6
|
+
"""
|
|
7
|
+
import importlib
|
|
8
|
+
from importlib import metadata
|
|
9
|
+
from pymodaq.utils import logger as logger_module
|
|
10
|
+
|
|
11
|
+
logger = logger_module.set_logger(logger_module.get_module_name(__file__))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def get_extensions():
|
|
15
|
+
"""
|
|
16
|
+
Get pymodaq extensions as a list
|
|
17
|
+
|
|
18
|
+
Returns
|
|
19
|
+
-------
|
|
20
|
+
list: list of disct containting the name and module of the found extension
|
|
21
|
+
"""
|
|
22
|
+
extension_import = []
|
|
23
|
+
entry_points = metadata.entry_points()
|
|
24
|
+
if 'pymodaq.extensions' in entry_points:
|
|
25
|
+
discovered_extension = entry_points['pymodaq.extensions']
|
|
26
|
+
|
|
27
|
+
for pkg in discovered_extension:
|
|
28
|
+
try:
|
|
29
|
+
module = importlib.import_module(pkg.value)
|
|
30
|
+
if hasattr(module, 'NICE_NAME'):
|
|
31
|
+
name = module.NICE_NAME
|
|
32
|
+
else:
|
|
33
|
+
name = pkg.value
|
|
34
|
+
extension = {'name': name, 'module': module}
|
|
35
|
+
extension_import.append(extension)
|
|
36
|
+
|
|
37
|
+
except Exception as e: # pragma: no cover
|
|
38
|
+
logger.warning(f'Impossible to import the {pkg.value} extension: {str(e)}')
|
|
39
|
+
|
|
40
|
+
return extension_import
|