bec-widgets 0.53.2__py3-none-any.whl → 0.54.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.
- CHANGELOG.md +24 -25
- PKG-INFO +1 -1
- bec_widgets/cli/client.py +13 -13
- bec_widgets/cli/client_utils.py +0 -4
- bec_widgets/cli/generate_cli.py +7 -5
- bec_widgets/cli/server.py +5 -7
- bec_widgets/examples/jupyter_console/jupyter_console_window.py +7 -3
- bec_widgets/examples/motor_movement/motor_control_compilations.py +17 -16
- bec_widgets/widgets/__init__.py +0 -10
- bec_widgets/widgets/figure/figure.py +40 -23
- bec_widgets/widgets/figure/plots/__init__.py +0 -0
- bec_widgets/widgets/figure/plots/image/__init__.py +0 -0
- bec_widgets/widgets/{plots → figure/plots/image}/image.py +6 -416
- bec_widgets/widgets/figure/plots/image/image_item.py +277 -0
- bec_widgets/widgets/figure/plots/image/image_processor.py +152 -0
- bec_widgets/widgets/figure/plots/motor_map/__init__.py +0 -0
- bec_widgets/widgets/{plots → figure/plots/motor_map}/motor_map.py +2 -2
- bec_widgets/widgets/figure/plots/waveform/__init__.py +0 -0
- bec_widgets/widgets/{plots → figure/plots/waveform}/waveform.py +9 -222
- bec_widgets/widgets/figure/plots/waveform/waveform_curve.py +227 -0
- bec_widgets/widgets/motor_control/__init__.py +0 -7
- bec_widgets/widgets/motor_control/motor_control.py +2 -948
- bec_widgets/widgets/motor_control/motor_table/__init__.py +0 -0
- bec_widgets/widgets/motor_control/motor_table/motor_table.py +483 -0
- bec_widgets/widgets/motor_control/movement_absolute/__init__.py +0 -0
- bec_widgets/widgets/motor_control/movement_absolute/movement_absolute.py +157 -0
- bec_widgets/widgets/motor_control/movement_relative/__init__.py +0 -0
- bec_widgets/widgets/motor_control/movement_relative/movement_relative.py +227 -0
- bec_widgets/widgets/motor_control/selection/__init__.py +0 -0
- bec_widgets/widgets/motor_control/selection/selection.py +110 -0
- {bec_widgets-0.53.2.dist-info → bec_widgets-0.54.0.dist-info}/METADATA +1 -1
- {bec_widgets-0.53.2.dist-info → bec_widgets-0.54.0.dist-info}/RECORD +51 -52
- docs/requirements.txt +1 -0
- pyproject.toml +1 -1
- tests/end-2-end/test_bec_dock_rpc_e2e.py +1 -1
- tests/end-2-end/test_bec_figure_rpc_e2e.py +4 -4
- tests/end-2-end/test_rpc_register_e2e.py +1 -1
- tests/unit_tests/test_bec_dock.py +1 -1
- tests/unit_tests/test_bec_figure.py +6 -4
- tests/unit_tests/test_bec_motor_map.py +2 -3
- tests/unit_tests/test_motor_control.py +6 -5
- tests/unit_tests/test_waveform1d.py +13 -1
- bec_widgets/validation/__init__.py +0 -2
- bec_widgets/validation/monitor_config_validator.py +0 -258
- bec_widgets/widgets/monitor/__init__.py +0 -1
- bec_widgets/widgets/monitor/config_dialog.py +0 -574
- bec_widgets/widgets/monitor/config_dialog.ui +0 -210
- bec_widgets/widgets/monitor/example_configs/config_device.yaml +0 -60
- bec_widgets/widgets/monitor/example_configs/config_scans.yaml +0 -92
- bec_widgets/widgets/monitor/monitor.py +0 -845
- bec_widgets/widgets/monitor/tab_template.ui +0 -180
- bec_widgets/widgets/motor_map/__init__.py +0 -1
- bec_widgets/widgets/motor_map/motor_map.py +0 -594
- bec_widgets/widgets/plots/__init__.py +0 -4
- tests/unit_tests/test_bec_monitor.py +0 -220
- tests/unit_tests/test_config_dialog.py +0 -178
- tests/unit_tests/test_motor_map.py +0 -171
- tests/unit_tests/test_validator_errors.py +0 -110
- /bec_widgets/{cli → assets}/bec_widgets_icon.png +0 -0
- /bec_widgets/{examples/jupyter_console → assets}/terminal_icon.png +0 -0
- /bec_widgets/widgets/{plots → figure/plots}/plot_base.py +0 -0
- /bec_widgets/widgets/motor_control/{motor_control_table.ui → motor_table/motor_table.ui} +0 -0
- /bec_widgets/widgets/motor_control/{motor_control_absolute.ui → movement_absolute/movement_absolute.ui} +0 -0
- /bec_widgets/widgets/motor_control/{motor_control_relative.ui → movement_relative/movement_relative.ui} +0 -0
- /bec_widgets/widgets/motor_control/{motor_control_selection.ui → selection/selection.ui} +0 -0
- {bec_widgets-0.53.2.dist-info → bec_widgets-0.54.0.dist-info}/WHEEL +0 -0
- {bec_widgets-0.53.2.dist-info → bec_widgets-0.54.0.dist-info}/licenses/LICENSE +0 -0
CHANGELOG.md
CHANGED
@@ -2,6 +2,30 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
## v0.54.0 (2024-05-24)
|
6
|
+
|
7
|
+
### Build
|
8
|
+
|
9
|
+
* build: added pyqt6 as sphinx build dependency ([`a47a8ec`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/a47a8ec413934cf7fce8d5b7a5913371d4b3b4a5))
|
10
|
+
|
11
|
+
### Feature
|
12
|
+
|
13
|
+
* feat(figure): changes to support direct plot functionality ([`fc4d0f3`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/fc4d0f3bb2a7c2fca9c326d86eb68b305bcd548b))
|
14
|
+
|
15
|
+
### Refactor
|
16
|
+
|
17
|
+
* refactor(reconstruction): repository structure is changed to separate assets needed for each widget ([`3455c60`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/3455c602361d3b5cc3ff9190f9d2870474becf8a))
|
18
|
+
|
19
|
+
* refactor(clean-up): 1st generation widgets are removed ([`edc25fb`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/edc25fbf9d5a0321e5f0a80b492b6337df807849))
|
20
|
+
|
21
|
+
|
22
|
+
## v0.53.3 (2024-05-16)
|
23
|
+
|
24
|
+
### Fix
|
25
|
+
|
26
|
+
* fix: removed apparently unnecessary sleep while waiting for an rpc response ([`7d64cac`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/7d64cac6610b39d3553ff650354f78ead8ee6b55))
|
27
|
+
|
28
|
+
|
5
29
|
## v0.53.2 (2024-05-15)
|
6
30
|
|
7
31
|
### Ci
|
@@ -146,28 +170,3 @@
|
|
146
170
|
### Fix
|
147
171
|
|
148
172
|
* fix(widgets/editor): qscintilla editor removed ([`ab85374`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ab8537483da6c87cb9a0b0f01706208c964f292d))
|
149
|
-
|
150
|
-
|
151
|
-
## v0.49.0 (2024-04-24)
|
152
|
-
|
153
|
-
### Feature
|
154
|
-
|
155
|
-
* feat(rpc/client_utils): timeout for rpc response ([`6500a00`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/6500a00682a2a7ca535a138bd9496ed8470856a8))
|
156
|
-
|
157
|
-
### Fix
|
158
|
-
|
159
|
-
* fix(rpc/client_utils): close clean up policy for BECFigure ([`9602085`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/9602085f82cbc983f89b5bfe48bf35f08438fa87))
|
160
|
-
|
161
|
-
|
162
|
-
## v0.48.0 (2024-04-24)
|
163
|
-
|
164
|
-
### Feature
|
165
|
-
|
166
|
-
* feat(cli): added auto updates plugin support ([`6238693`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/6238693ffb44b47a56b969bc4129f2af7a2c04fe))
|
167
|
-
|
168
|
-
|
169
|
-
## v0.47.0 (2024-04-23)
|
170
|
-
|
171
|
-
### Feature
|
172
|
-
|
173
|
-
* feat(utils/thread_checker): util class to check the thread leakage for closeEvent in qt ([`71cb80d`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/71cb80d544c5f4ef499379a431ce0c17907c7ce8))
|
PKG-INFO
CHANGED
bec_widgets/cli/client.py
CHANGED
@@ -554,17 +554,17 @@ class BECFigure(RPCBase):
|
|
554
554
|
@rpc_call
|
555
555
|
def plot(
|
556
556
|
self,
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
color: "
|
566
|
-
color_map_z: "
|
567
|
-
label: "
|
557
|
+
x: "list | np.ndarray | None" = None,
|
558
|
+
y: "list | np.ndarray | None" = None,
|
559
|
+
x_name: "str | None" = None,
|
560
|
+
y_name: "str | None" = None,
|
561
|
+
z_name: "str | None" = None,
|
562
|
+
x_entry: "str | None" = None,
|
563
|
+
y_entry: "str | None" = None,
|
564
|
+
z_entry: "str | None" = None,
|
565
|
+
color: "str | None" = None,
|
566
|
+
color_map_z: "str | None" = "plasma",
|
567
|
+
label: "str | None" = None,
|
568
568
|
validate: "bool" = True,
|
569
569
|
**axis_kwargs,
|
570
570
|
) -> "BECWaveform":
|
@@ -572,14 +572,14 @@ class BECFigure(RPCBase):
|
|
572
572
|
Add a 1D waveform plot to the figure. Always access the first waveform widget in the figure.
|
573
573
|
|
574
574
|
Args:
|
575
|
+
x(list | np.ndarray): Custom x data to plot.
|
576
|
+
y(list | np.ndarray): Custom y data to plot.
|
575
577
|
x_name(str): The name of the device for the x-axis.
|
576
578
|
y_name(str): The name of the device for the y-axis.
|
577
579
|
z_name(str): The name of the device for the z-axis.
|
578
580
|
x_entry(str): The name of the entry for the x-axis.
|
579
581
|
y_entry(str): The name of the entry for the y-axis.
|
580
582
|
z_entry(str): The name of the entry for the z-axis.
|
581
|
-
x(list | np.ndarray): Custom x data to plot.
|
582
|
-
y(list | np.ndarray): Custom y data to plot.
|
583
583
|
color(str): The color of the curve.
|
584
584
|
color_map_z(str): The color map to use for the z-axis.
|
585
585
|
label(str): The label of the curve.
|
bec_widgets/cli/client_utils.py
CHANGED
@@ -13,7 +13,6 @@ from functools import wraps
|
|
13
13
|
from typing import TYPE_CHECKING
|
14
14
|
|
15
15
|
from bec_lib.endpoints import MessageEndpoints
|
16
|
-
from bec_lib.service_config import ServiceConfig
|
17
16
|
from bec_lib.utils.import_utils import isinstance_based_on_class_name, lazy_import, lazy_import_from
|
18
17
|
from qtpy.QtCore import QCoreApplication
|
19
18
|
|
@@ -22,8 +21,6 @@ import bec_widgets.cli.client as client
|
|
22
21
|
if TYPE_CHECKING:
|
23
22
|
from bec_lib.device import DeviceBase
|
24
23
|
|
25
|
-
from bec_widgets.cli.client import BECDockArea, BECFigure
|
26
|
-
|
27
24
|
messages = lazy_import("bec_lib.messages")
|
28
25
|
# from bec_lib.connector import MessageObject
|
29
26
|
MessageObject = lazy_import_from("bec_lib.connector", ("MessageObject",))
|
@@ -302,7 +299,6 @@ class RPCBase:
|
|
302
299
|
MessageEndpoints.gui_instruction_response(request_id)
|
303
300
|
)
|
304
301
|
QCoreApplication.processEvents() # keep UI responsive (and execute signals/slots)
|
305
|
-
time.sleep(0.1)
|
306
302
|
if response is None and (time.time() - start_time) >= timeout:
|
307
303
|
raise RPCResponseTimeoutError(request_id, timeout)
|
308
304
|
|
bec_widgets/cli/generate_cli.py
CHANGED
@@ -109,11 +109,13 @@ if __name__ == "__main__": # pragma: no cover
|
|
109
109
|
import os
|
110
110
|
|
111
111
|
from bec_widgets.utils import BECConnector
|
112
|
-
from bec_widgets.widgets
|
113
|
-
from bec_widgets.widgets.figure import
|
114
|
-
from bec_widgets.widgets.plots import
|
115
|
-
from bec_widgets.widgets.plots.
|
116
|
-
from bec_widgets.widgets.plots.
|
112
|
+
from bec_widgets.widgets import BECDock, BECDockArea, BECFigure
|
113
|
+
from bec_widgets.widgets.figure.plots.image.image import BECImageShow
|
114
|
+
from bec_widgets.widgets.figure.plots.image.image_item import BECImageItem
|
115
|
+
from bec_widgets.widgets.figure.plots.motor_map.motor_map import BECMotorMap
|
116
|
+
from bec_widgets.widgets.figure.plots.plot_base import BECPlotBase
|
117
|
+
from bec_widgets.widgets.figure.plots.waveform.waveform import BECWaveform
|
118
|
+
from bec_widgets.widgets.figure.plots.waveform.waveform_curve import BECCurve
|
117
119
|
|
118
120
|
current_path = os.path.dirname(__file__)
|
119
121
|
client_path = os.path.join(current_path, "client.py")
|
bec_widgets/cli/server.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
import inspect
|
2
|
-
import
|
3
|
-
import time
|
4
|
-
from typing import Literal, Union
|
2
|
+
from typing import Union
|
5
3
|
|
6
4
|
from bec_lib.endpoints import MessageEndpoints
|
7
5
|
from bec_lib.utils.import_utils import lazy_import
|
@@ -12,13 +10,11 @@ from bec_widgets.utils import BECDispatcher
|
|
12
10
|
from bec_widgets.utils.bec_connector import BECConnector
|
13
11
|
from bec_widgets.widgets.dock.dock_area import BECDockArea
|
14
12
|
from bec_widgets.widgets.figure import BECFigure
|
15
|
-
from bec_widgets.widgets.plots import BECCurve, BECImageShow, BECWaveform
|
16
13
|
|
17
14
|
messages = lazy_import("bec_lib.messages")
|
18
15
|
|
19
16
|
|
20
17
|
class BECWidgetsCLIServer:
|
21
|
-
WIDGETS = [BECWaveform, BECFigure, BECCurve, BECImageShow]
|
22
18
|
|
23
19
|
def __init__(
|
24
20
|
self,
|
@@ -127,11 +123,13 @@ if __name__ == "__main__": # pragma: no cover
|
|
127
123
|
from qtpy.QtGui import QIcon
|
128
124
|
from qtpy.QtWidgets import QApplication, QMainWindow
|
129
125
|
|
126
|
+
import bec_widgets
|
127
|
+
|
130
128
|
app = QApplication(sys.argv)
|
131
129
|
app.setApplicationName("BEC Figure")
|
132
|
-
|
130
|
+
module_path = os.path.dirname(bec_widgets.__file__)
|
133
131
|
icon = QIcon()
|
134
|
-
icon.addFile(os.path.join(
|
132
|
+
icon.addFile(os.path.join(module_path, "assets", "bec_widgets_icon.png"), size=QSize(48, 48))
|
135
133
|
app.setWindowIcon(icon)
|
136
134
|
|
137
135
|
win = QMainWindow()
|
@@ -93,7 +93,7 @@ class JupyterConsoleWindow(QWidget): # pragma: no cover:
|
|
93
93
|
self.console.set_default_style("linux")
|
94
94
|
|
95
95
|
def _init_figure(self):
|
96
|
-
self.figure.plot("samx", "bpm4d")
|
96
|
+
self.figure.plot(x_name="samx", y_name="bpm4d")
|
97
97
|
self.figure.motor_map("samx", "samy")
|
98
98
|
self.figure.image("eiger", color_map="viridis", vrange=(0, 100))
|
99
99
|
|
@@ -124,7 +124,7 @@ class JupyterConsoleWindow(QWidget): # pragma: no cover:
|
|
124
124
|
self.d2 = self.dock.add_dock(widget=self.label_1, position="right")
|
125
125
|
self.d3 = self.dock.add_dock(name="figure")
|
126
126
|
self.fig_dock3 = BECFigure()
|
127
|
-
self.fig_dock3.plot("samx", "bpm4d")
|
127
|
+
self.fig_dock3.plot(x_name="samx", y_name="bpm4d")
|
128
128
|
self.d3.add_widget(self.label_3)
|
129
129
|
self.d3.add_widget(self.button_3)
|
130
130
|
self.d3.add_widget(self.fig_dock3)
|
@@ -142,6 +142,10 @@ class JupyterConsoleWindow(QWidget): # pragma: no cover:
|
|
142
142
|
if __name__ == "__main__": # pragma: no cover
|
143
143
|
import sys
|
144
144
|
|
145
|
+
import bec_widgets
|
146
|
+
|
147
|
+
module_path = os.path.dirname(bec_widgets.__file__)
|
148
|
+
|
145
149
|
bec_dispatcher = BECDispatcher()
|
146
150
|
client = bec_dispatcher.client
|
147
151
|
client.start()
|
@@ -150,7 +154,7 @@ if __name__ == "__main__": # pragma: no cover
|
|
150
154
|
app.setApplicationName("Jupyter Console")
|
151
155
|
app.setApplicationDisplayName("Jupyter Console")
|
152
156
|
icon = QIcon()
|
153
|
-
icon.addFile("terminal_icon.png", size=QSize(48, 48))
|
157
|
+
icon.addFile(os.path.join(module_path, "assets", "terminal_icon.png"), size=QSize(48, 48))
|
154
158
|
app.setWindowIcon(icon)
|
155
159
|
win = JupyterConsoleWindow()
|
156
160
|
win.show()
|
@@ -5,14 +5,15 @@ from qtpy.QtCore import Qt
|
|
5
5
|
from qtpy.QtWidgets import QApplication, QSplitter, QVBoxLayout, QWidget
|
6
6
|
|
7
7
|
from bec_widgets.utils.bec_dispatcher import BECDispatcher
|
8
|
-
from bec_widgets.widgets import
|
8
|
+
from bec_widgets.widgets.motor_control.motor_control import MotorThread
|
9
|
+
from bec_widgets.widgets.motor_control.motor_table.motor_table import MotorCoordinateTable
|
10
|
+
from bec_widgets.widgets.motor_control.movement_absolute.movement_absolute import (
|
9
11
|
MotorControlAbsolute,
|
12
|
+
)
|
13
|
+
from bec_widgets.widgets.motor_control.movement_relative.movement_relative import (
|
10
14
|
MotorControlRelative,
|
11
|
-
MotorControlSelection,
|
12
|
-
MotorCoordinateTable,
|
13
|
-
MotorMap,
|
14
|
-
MotorThread,
|
15
15
|
)
|
16
|
+
from bec_widgets.widgets.motor_control.selection.selection import MotorControlSelection
|
16
17
|
|
17
18
|
CONFIG_DEFAULT = {
|
18
19
|
"motor_control": {
|
@@ -58,13 +59,13 @@ class MotorControlApp(QWidget):
|
|
58
59
|
# Widgets
|
59
60
|
self.motor_control_panel = MotorControlPanel(client=self.client, config=self.config)
|
60
61
|
# Create MotorMap
|
61
|
-
self.motion_map = MotorMap(client=self.client, config=self.config)
|
62
|
+
# self.motion_map = MotorMap(client=self.client, config=self.config)
|
62
63
|
# Create MotorCoordinateTable
|
63
64
|
self.motor_table = MotorCoordinateTable(client=self.client, config=self.config)
|
64
65
|
|
65
66
|
# Create the splitter and add MotorMap and MotorControlPanel
|
66
67
|
splitter = QSplitter(Qt.Horizontal)
|
67
|
-
splitter.addWidget(self.motion_map)
|
68
|
+
# splitter.addWidget(self.motion_map)
|
68
69
|
splitter.addWidget(self.motor_control_panel)
|
69
70
|
splitter.addWidget(self.motor_table)
|
70
71
|
|
@@ -74,9 +75,9 @@ class MotorControlApp(QWidget):
|
|
74
75
|
self.setLayout(layout)
|
75
76
|
|
76
77
|
# Connecting signals and slots
|
77
|
-
self.motor_control_panel.selection_widget.selected_motors_signal.connect(
|
78
|
-
|
79
|
-
)
|
78
|
+
# self.motor_control_panel.selection_widget.selected_motors_signal.connect(
|
79
|
+
# lambda x, y: self.motion_map.change_motors(x, y, 0)
|
80
|
+
# )
|
80
81
|
self.motor_control_panel.absolute_widget.coordinates_signal.connect(
|
81
82
|
self.motor_table.add_coordinate
|
82
83
|
)
|
@@ -87,7 +88,7 @@ class MotorControlApp(QWidget):
|
|
87
88
|
self.motor_control_panel.absolute_widget.set_precision
|
88
89
|
)
|
89
90
|
|
90
|
-
self.motor_table.plot_coordinates_signal.connect(self.motion_map.plot_saved_coordinates)
|
91
|
+
# self.motor_table.plot_coordinates_signal.connect(self.motion_map.plot_saved_coordinates)
|
91
92
|
|
92
93
|
|
93
94
|
class MotorControlMap(QWidget):
|
@@ -101,11 +102,11 @@ class MotorControlMap(QWidget):
|
|
101
102
|
# Widgets
|
102
103
|
self.motor_control_panel = MotorControlPanel(client=self.client, config=self.config)
|
103
104
|
# Create MotorMap
|
104
|
-
self.motion_map = MotorMap(client=self.client, config=self.config)
|
105
|
+
# self.motion_map = MotorMap(client=self.client, config=self.config)
|
105
106
|
|
106
107
|
# Create the splitter and add MotorMap and MotorControlPanel
|
107
108
|
splitter = QSplitter(Qt.Horizontal)
|
108
|
-
splitter.addWidget(self.motion_map)
|
109
|
+
# splitter.addWidget(self.motion_map)
|
109
110
|
splitter.addWidget(self.motor_control_panel)
|
110
111
|
|
111
112
|
# Set the main layout
|
@@ -114,9 +115,9 @@ class MotorControlMap(QWidget):
|
|
114
115
|
self.setLayout(layout)
|
115
116
|
|
116
117
|
# Connecting signals and slots
|
117
|
-
self.motor_control_panel.selection_widget.selected_motors_signal.connect(
|
118
|
-
|
119
|
-
)
|
118
|
+
# self.motor_control_panel.selection_widget.selected_motors_signal.connect(
|
119
|
+
# lambda x, y: self.motion_map.change_motors(x, y, 0)
|
120
|
+
# )
|
120
121
|
|
121
122
|
|
122
123
|
class MotorControlPanel(QWidget):
|
bec_widgets/widgets/__init__.py
CHANGED
@@ -1,13 +1,3 @@
|
|
1
1
|
from .dock import BECDock, BECDockArea
|
2
2
|
from .figure import BECFigure, FigureConfig
|
3
|
-
from .monitor import BECMonitor
|
4
|
-
from .motor_control import (
|
5
|
-
MotorControlAbsolute,
|
6
|
-
MotorControlRelative,
|
7
|
-
MotorControlSelection,
|
8
|
-
MotorCoordinateTable,
|
9
|
-
MotorThread,
|
10
|
-
)
|
11
|
-
from .motor_map import MotorMap
|
12
|
-
from .plots import BECCurve, BECMotorMap, BECWaveform
|
13
3
|
from .scan_control import ScanControl
|
@@ -11,18 +11,13 @@ import qdarktheme
|
|
11
11
|
from pydantic import Field
|
12
12
|
from qtpy.QtCore import Signal as pyqtSignal
|
13
13
|
from qtpy.QtWidgets import QWidget
|
14
|
+
from typeguard import typechecked
|
14
15
|
|
15
16
|
from bec_widgets.utils import BECConnector, ConnectionConfig, WidgetContainerUtils
|
16
|
-
from bec_widgets.widgets.plots import
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
BECWaveform,
|
21
|
-
SubplotConfig,
|
22
|
-
Waveform1DConfig,
|
23
|
-
)
|
24
|
-
from bec_widgets.widgets.plots.image import ImageConfig
|
25
|
-
from bec_widgets.widgets.plots.motor_map import MotorMapConfig
|
17
|
+
from bec_widgets.widgets.figure.plots.image.image import BECImageShow, ImageConfig
|
18
|
+
from bec_widgets.widgets.figure.plots.motor_map.motor_map import BECMotorMap, MotorMapConfig
|
19
|
+
from bec_widgets.widgets.figure.plots.plot_base import BECPlotBase, SubplotConfig
|
20
|
+
from bec_widgets.widgets.figure.plots.waveform.waveform import BECWaveform, Waveform1DConfig
|
26
21
|
|
27
22
|
|
28
23
|
class FigureConfig(ConnectionConfig):
|
@@ -267,19 +262,20 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
267
262
|
|
268
263
|
return waveform
|
269
264
|
|
265
|
+
@typechecked
|
270
266
|
def plot(
|
271
267
|
self,
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
color:
|
281
|
-
color_map_z:
|
282
|
-
label:
|
268
|
+
x: list | np.ndarray | None = None,
|
269
|
+
y: list | np.ndarray | None = None,
|
270
|
+
x_name: str | None = None,
|
271
|
+
y_name: str | None = None,
|
272
|
+
z_name: str | None = None,
|
273
|
+
x_entry: str | None = None,
|
274
|
+
y_entry: str | None = None,
|
275
|
+
z_entry: str | None = None,
|
276
|
+
color: str | None = None,
|
277
|
+
color_map_z: str | None = "plasma",
|
278
|
+
label: str | None = None,
|
283
279
|
validate: bool = True,
|
284
280
|
**axis_kwargs,
|
285
281
|
) -> BECWaveform:
|
@@ -287,14 +283,14 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
287
283
|
Add a 1D waveform plot to the figure. Always access the first waveform widget in the figure.
|
288
284
|
|
289
285
|
Args:
|
286
|
+
x(list | np.ndarray): Custom x data to plot.
|
287
|
+
y(list | np.ndarray): Custom y data to plot.
|
290
288
|
x_name(str): The name of the device for the x-axis.
|
291
289
|
y_name(str): The name of the device for the y-axis.
|
292
290
|
z_name(str): The name of the device for the z-axis.
|
293
291
|
x_entry(str): The name of the entry for the x-axis.
|
294
292
|
y_entry(str): The name of the entry for the y-axis.
|
295
293
|
z_entry(str): The name of the entry for the z-axis.
|
296
|
-
x(list | np.ndarray): Custom x data to plot.
|
297
|
-
y(list | np.ndarray): Custom y data to plot.
|
298
294
|
color(str): The color of the curve.
|
299
295
|
color_map_z(str): The color map to use for the z-axis.
|
300
296
|
label(str): The label of the curve.
|
@@ -313,6 +309,27 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
313
309
|
else:
|
314
310
|
waveform = self.add_plot(**axis_kwargs)
|
315
311
|
|
312
|
+
if x is not None and y is None:
|
313
|
+
if isinstance(x, np.ndarray):
|
314
|
+
if x.ndim == 1:
|
315
|
+
y = np.arange(x.size)
|
316
|
+
waveform.add_curve_custom(x=np.arange(x.size), y=x, color=color, label=label)
|
317
|
+
return waveform
|
318
|
+
if x.ndim == 2:
|
319
|
+
waveform.add_curve_custom(x=x[:, 0], y=x[:, 1], color=color, label=label)
|
320
|
+
return waveform
|
321
|
+
elif isinstance(x, list):
|
322
|
+
y = np.arange(len(x))
|
323
|
+
waveform.add_curve_custom(x=np.arange(len(x)), y=x, color=color, label=label)
|
324
|
+
return waveform
|
325
|
+
else:
|
326
|
+
raise ValueError(
|
327
|
+
"Invalid input. Provide either device names (x_name, y_name) or custom data."
|
328
|
+
)
|
329
|
+
if x is not None and y is not None:
|
330
|
+
waveform.add_curve_custom(x=x, y=y, color=color, label=label)
|
331
|
+
return waveform
|
332
|
+
|
316
333
|
# User wants to add scan curve -> 1D Waveform
|
317
334
|
if x_name is not None and y_name is not None and z_name is None and x is None and y is None:
|
318
335
|
waveform.add_curve_scan(
|
File without changes
|
File without changes
|