pymodaq 4.1.5__py3-none-any.whl → 4.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pymodaq might be problematic. Click here for more details.

Files changed (79) hide show
  1. pymodaq/__init__.py +41 -4
  2. pymodaq/control_modules/daq_move.py +32 -73
  3. pymodaq/control_modules/daq_viewer.py +73 -98
  4. pymodaq/control_modules/daq_viewer_ui.py +2 -1
  5. pymodaq/control_modules/move_utility_classes.py +17 -7
  6. pymodaq/control_modules/utils.py +153 -5
  7. pymodaq/control_modules/viewer_utility_classes.py +31 -20
  8. pymodaq/dashboard.py +23 -5
  9. pymodaq/examples/tcp_client.py +97 -0
  10. pymodaq/extensions/__init__.py +4 -0
  11. pymodaq/extensions/bayesian/__init__.py +2 -0
  12. pymodaq/extensions/bayesian/bayesian_optimisation.py +673 -0
  13. pymodaq/extensions/bayesian/utils.py +403 -0
  14. pymodaq/extensions/daq_scan.py +4 -4
  15. pymodaq/extensions/daq_scan_ui.py +2 -1
  16. pymodaq/extensions/pid/pid_controller.py +12 -7
  17. pymodaq/extensions/pid/utils.py +9 -26
  18. pymodaq/extensions/utils.py +3 -0
  19. pymodaq/post_treatment/load_and_plot.py +42 -19
  20. pymodaq/resources/VERSION +1 -1
  21. pymodaq/resources/config_template.toml +9 -24
  22. pymodaq/resources/setup_plugin.py +1 -1
  23. pymodaq/utils/config.py +103 -5
  24. pymodaq/utils/daq_utils.py +35 -134
  25. pymodaq/utils/data.py +614 -95
  26. pymodaq/utils/enums.py +17 -1
  27. pymodaq/utils/factory.py +2 -2
  28. pymodaq/utils/gui_utils/custom_app.py +5 -2
  29. pymodaq/utils/gui_utils/dock.py +33 -4
  30. pymodaq/utils/gui_utils/utils.py +14 -1
  31. pymodaq/utils/h5modules/backends.py +9 -1
  32. pymodaq/utils/h5modules/data_saving.py +254 -57
  33. pymodaq/utils/h5modules/saving.py +1 -0
  34. pymodaq/utils/leco/daq_move_LECODirector.py +172 -0
  35. pymodaq/utils/leco/daq_xDviewer_LECODirector.py +170 -0
  36. pymodaq/utils/leco/desktop.ini +2 -0
  37. pymodaq/utils/leco/director_utils.py +58 -0
  38. pymodaq/utils/leco/leco_director.py +88 -0
  39. pymodaq/utils/leco/pymodaq_listener.py +279 -0
  40. pymodaq/utils/leco/utils.py +41 -0
  41. pymodaq/utils/managers/action_manager.py +20 -6
  42. pymodaq/utils/managers/parameter_manager.py +6 -4
  43. pymodaq/utils/managers/roi_manager.py +63 -54
  44. pymodaq/utils/math_utils.py +1 -1
  45. pymodaq/utils/plotting/data_viewers/__init__.py +3 -1
  46. pymodaq/utils/plotting/data_viewers/base.py +286 -0
  47. pymodaq/utils/plotting/data_viewers/viewer.py +29 -202
  48. pymodaq/utils/plotting/data_viewers/viewer0D.py +94 -47
  49. pymodaq/utils/plotting/data_viewers/viewer1D.py +341 -174
  50. pymodaq/utils/plotting/data_viewers/viewer1Dbasic.py +1 -1
  51. pymodaq/utils/plotting/data_viewers/viewer2D.py +271 -181
  52. pymodaq/utils/plotting/data_viewers/viewerND.py +26 -22
  53. pymodaq/utils/plotting/items/crosshair.py +3 -3
  54. pymodaq/utils/plotting/items/image.py +2 -1
  55. pymodaq/utils/plotting/plotter/plotter.py +94 -0
  56. pymodaq/utils/plotting/plotter/plotters/__init__.py +0 -0
  57. pymodaq/utils/plotting/plotter/plotters/matplotlib_plotters.py +134 -0
  58. pymodaq/utils/plotting/plotter/plotters/qt_plotters.py +78 -0
  59. pymodaq/utils/plotting/utils/axes_viewer.py +1 -1
  60. pymodaq/utils/plotting/utils/filter.py +194 -147
  61. pymodaq/utils/plotting/utils/lineout.py +13 -11
  62. pymodaq/utils/plotting/utils/plot_utils.py +89 -12
  63. pymodaq/utils/scanner/__init__.py +0 -3
  64. pymodaq/utils/scanner/scan_config.py +1 -9
  65. pymodaq/utils/scanner/scan_factory.py +10 -36
  66. pymodaq/utils/scanner/scanner.py +3 -2
  67. pymodaq/utils/scanner/scanners/_1d_scanners.py +7 -5
  68. pymodaq/utils/scanner/scanners/_2d_scanners.py +36 -49
  69. pymodaq/utils/scanner/scanners/sequential.py +10 -4
  70. pymodaq/utils/scanner/scanners/tabular.py +10 -5
  71. pymodaq/utils/slicing.py +1 -1
  72. pymodaq/utils/tcp_ip/serializer.py +38 -5
  73. pymodaq/utils/tcp_ip/tcp_server_client.py +25 -17
  74. {pymodaq-4.1.5.dist-info → pymodaq-4.2.0.dist-info}/METADATA +4 -2
  75. {pymodaq-4.1.5.dist-info → pymodaq-4.2.0.dist-info}/RECORD +78 -63
  76. pymodaq/resources/config_scan_template.toml +0 -42
  77. {pymodaq-4.1.5.dist-info → pymodaq-4.2.0.dist-info}/WHEEL +0 -0
  78. {pymodaq-4.1.5.dist-info → pymodaq-4.2.0.dist-info}/entry_points.txt +0 -0
  79. {pymodaq-4.1.5.dist-info → pymodaq-4.2.0.dist-info}/licenses/LICENSE +0 -0
pymodaq/utils/enums.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from enum import Enum
2
- from pymodaq.utils.daq_utils import find_index
2
+ from pymodaq.utils.math_utils import find_index
3
3
  from pymodaq.utils.math_utils import my_moment
4
4
  import numpy as np
5
5
  from scipy.optimize import curve_fit
@@ -19,6 +19,22 @@ class BaseEnum(Enum):
19
19
  """Returns all the names of the enum"""
20
20
  return [cls[name].value for name in cls.names()]
21
21
 
22
+ @classmethod
23
+ def to_dict(cls):
24
+ """ Returns the enum in form of a dict with names os keys
25
+
26
+ New in 4.0.2
27
+ """
28
+ return {name: cls[name].value for name in cls.names()}
29
+
30
+ @classmethod
31
+ def to_dict_value(cls):
32
+ """ Returns the enum in form of a dict with values os keys
33
+
34
+ New in 4.0.2
35
+ """
36
+ return {cls[name].value: name for name in cls.names()}
37
+
22
38
  def __eq__(self, other: Union[str, Enum]):
23
39
  """testing for equality using the enum name"""
24
40
  if isinstance(other, str):
pymodaq/utils/factory.py CHANGED
@@ -27,8 +27,8 @@ class BuilderBase(ABCMeta):
27
27
 
28
28
 
29
29
  class ObjectFactory(metaclass=ABCMeta):
30
- """Generic ObjectFactory with a decorator register to add object builders to the factory with a unique key
31
- identifier
30
+ """Generic ObjectFactory with a decorator register to add object builders to the factory with a
31
+ unique key identifier
32
32
 
33
33
  See https://realpython.com/factory-method-python/ for some details
34
34
 
@@ -4,9 +4,12 @@ from pymodaq.utils.managers.action_manager import ActionManager
4
4
  from pymodaq.utils.managers.parameter_manager import ParameterManager
5
5
  from pyqtgraph.dockarea import DockArea
6
6
  from qtpy import QtCore, QtWidgets
7
- from typing import Union
7
+ from typing import Union, TYPE_CHECKING
8
8
  from pymodaq.utils.managers.modules_manager import ModulesManager
9
9
 
10
+ if TYPE_CHECKING:
11
+ from pymodaq.dashboard import DashBoard
12
+
10
13
 
11
14
  class CustomApp(QObject, ActionManager, ParameterManager):
12
15
  """Base Class to ease the implementation of User Interfaces
@@ -38,7 +41,7 @@ class CustomApp(QObject, ActionManager, ParameterManager):
38
41
  log_signal = QtCore.Signal(str)
39
42
  params = []
40
43
 
41
- def __init__(self, parent: Union[DockArea, QtWidgets.QWidget], dashboard=None):
44
+ def __init__(self, parent: Union[DockArea, QtWidgets.QWidget], dashboard: 'DashBoard'=None):
42
45
  QObject.__init__(self)
43
46
  ActionManager.__init__(self)
44
47
  ParameterManager.__init__(self)
@@ -9,9 +9,9 @@ from pyqtgraph.widgets.VerticalLabel import VerticalLabel
9
9
 
10
10
  class Dock(Dock):
11
11
  dock_focused = Signal(str)
12
- def __init__(self, name, *args, fontSize='14px', **kwargs):
13
- label = DockLabel(name, fontSize=fontSize)
14
- super().__init__(name, *args, label=label, **kwargs)
12
+ def __init__(self, name, *args, fontSize='20px', **kwargs):
13
+ kwargs['fontSize'] = fontSize
14
+ super().__init__(name, *args, **kwargs)
15
15
 
16
16
  def removeWidgets(self):
17
17
  for widget in self.widgets:
@@ -75,4 +75,33 @@ class DockArea(DockArea, QObject):
75
75
  else:
76
76
  area = self.home.addTempArea()
77
77
  # print "added temp area", area, area.window()
78
- return area
78
+ return area
79
+
80
+
81
+ if __name__ == '__main__':
82
+ import sys
83
+ from pymodaq.utils.parameter import ParameterTree
84
+ app = QtWidgets.QApplication(sys.argv)
85
+ import qdarkstyle
86
+ app.setStyleSheet(qdarkstyle.load_stylesheet(qdarkstyle.DarkPalette))
87
+
88
+ labelv = DockLabel('mysuperlabel', fontSize='25px')
89
+ docky = Dock('MysuperDockLogger', fontSize='30px')
90
+ dockx = Dock('MysuperDockLoggerx', fontSize='30px')
91
+ area = DockArea()
92
+ area.addDock(docky)
93
+ area.addDock(dockx)
94
+ dockx.addWidget(ParameterTree())
95
+ labelv.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop | QtCore.Qt.AlignmentFlag.AlignHCenter)
96
+ f = labelv.font()
97
+ f.setPixelSize(25)
98
+ labelv.setFont(f)
99
+ docky.label.setFont(f)
100
+ labelv.show()
101
+ area.show()
102
+ QtWidgets.QApplication.processEvents()
103
+ print(f'labelv size hint: {labelv.sizeHint()}')
104
+ print(f'labelv size: {labelv.size()}')
105
+ print(f'labelv margins: {labelv.contentsMargins().top()}, {labelv.contentsMargins().bottom()}')
106
+
107
+ sys.exit(app.exec())
@@ -1,7 +1,12 @@
1
+ import sys
2
+
1
3
  from qtpy.QtCore import QObject, Signal, QEvent, QBuffer, QIODevice, Qt
2
4
  from qtpy import QtWidgets, QtCore, QtGui
3
5
 
4
6
  from pathlib import Path
7
+ from pymodaq.utils.config import Config
8
+
9
+ config = Config()
5
10
 
6
11
 
7
12
  dashboard_submodules_params = [
@@ -137,4 +142,12 @@ def pngbinary2Qlabel(databinary, scale_height: int = None):
137
142
  pixmap = pixmap.scaledToHeight(scale_height)
138
143
  label = QtWidgets.QLabel()
139
144
  label.setPixmap(pixmap)
140
- return label
145
+ return label
146
+
147
+
148
+ def start_qapplication() -> QtWidgets.QApplication:
149
+ app = QtWidgets.QApplication(sys.argv)
150
+ if config('style', 'darkstyle'):
151
+ import qdarkstyle
152
+ app.setStyleSheet(qdarkstyle.load_stylesheet(qdarkstyle.DarkPalette))
153
+ return app
@@ -381,9 +381,17 @@ class EARRAY(CARRAY):
381
381
  The data to append could be:
382
382
 
383
383
  * a single element (without the enlargeable shape index that is always the first
384
- index, that is of shape length n). In that case the first index of the enlargeable array is increased by one.
384
+ index, that is of shape length n). In that case the first index of the enlargeable array
385
+ is increased by one.
385
386
  * an ensemble of elements (a ndarray) of shape length of (n+1).
386
387
 
388
+ Parameters
389
+ ----------
390
+ data: np.ndarray
391
+ the data array to append to the enlargeable node
392
+ expand: bool
393
+ If True the data array will have its shape expanded by one dim
394
+
387
395
  """
388
396
  if not isinstance(data, np.ndarray):
389
397
  raise TypeError('The appended object should be a ndarray')