bec-widgets 0.57.1__py3-none-any.whl → 0.57.3__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 +42 -56
- PKG-INFO +2 -1
- bec_widgets/cli/client.py +17 -3
- bec_widgets/cli/client_utils.py +48 -49
- bec_widgets/widgets/dock/dock_area.py +17 -2
- bec_widgets/widgets/figure/plots/motor_map/motor_map.py +2 -2
- bec_widgets/widgets/figure/plots/waveform/waveform.py +0 -1
- bec_widgets/widgets/spiral_progress_bar/ring.py +26 -4
- bec_widgets/widgets/spiral_progress_bar/spiral_progress_bar.py +38 -9
- {bec_widgets-0.57.1.dist-info → bec_widgets-0.57.3.dist-info}/METADATA +2 -1
- {bec_widgets-0.57.1.dist-info → bec_widgets-0.57.3.dist-info}/RECORD +22 -21
- docs/user/getting_started/auto_updates.md +82 -0
- docs/user/getting_started/getting_started.md +2 -1
- docs/user/getting_started/{command_line_introduction.md → quick_start.md} +37 -18
- docs/user/widgets/spiral_progress_bar.md +37 -4
- pyproject.toml +2 -1
- tests/end-2-end/conftest.py +41 -26
- tests/end-2-end/test_bec_dock_rpc_e2e.py +68 -90
- tests/end-2-end/test_bec_figure_rpc_e2e.py +18 -30
- tests/end-2-end/test_rpc_register_e2e.py +16 -26
- {bec_widgets-0.57.1.dist-info → bec_widgets-0.57.3.dist-info}/WHEEL +0 -0
- {bec_widgets-0.57.1.dist-info → bec_widgets-0.57.3.dist-info}/licenses/LICENSE +0 -0
@@ -5,9 +5,8 @@ from bec_lib.endpoints import MessageEndpoints
|
|
5
5
|
from bec_widgets.cli.client import BECFigure, BECImageShow, BECMotorMap, BECWaveform
|
6
6
|
|
7
7
|
|
8
|
-
def test_rpc_waveform1d_custom_curve(rpc_server_figure
|
9
|
-
fig = BECFigure(rpc_server_figure
|
10
|
-
fig_server = rpc_server_figure.gui
|
8
|
+
def test_rpc_waveform1d_custom_curve(rpc_server_figure):
|
9
|
+
fig = BECFigure(rpc_server_figure)
|
11
10
|
|
12
11
|
ax = fig.add_plot()
|
13
12
|
curve = ax.add_curve_custom([1, 2, 3], [1, 2, 3])
|
@@ -15,13 +14,12 @@ def test_rpc_waveform1d_custom_curve(rpc_server_figure, qtbot):
|
|
15
14
|
curve = ax.curves[0]
|
16
15
|
curve.set_color("blue")
|
17
16
|
|
18
|
-
assert len(
|
19
|
-
assert len(
|
17
|
+
assert len(fig.widgets) == 1
|
18
|
+
assert len(fig.widgets[ax.rpc_id].curves) == 1
|
20
19
|
|
21
20
|
|
22
21
|
def test_rpc_plotting_shortcuts_init_configs(rpc_server_figure, qtbot):
|
23
|
-
fig = BECFigure(rpc_server_figure
|
24
|
-
fig_server = rpc_server_figure.gui
|
22
|
+
fig = BECFigure(rpc_server_figure)
|
25
23
|
|
26
24
|
plt = fig.plot(x_name="samx", y_name="bpm4i")
|
27
25
|
im = fig.image("eiger")
|
@@ -29,7 +27,7 @@ def test_rpc_plotting_shortcuts_init_configs(rpc_server_figure, qtbot):
|
|
29
27
|
plt_z = fig.add_plot("samx", "samy", "bpm4i")
|
30
28
|
|
31
29
|
# Checking if classes are correctly initialised
|
32
|
-
assert len(
|
30
|
+
assert len(fig.widgets) == 4
|
33
31
|
assert plt.__class__.__name__ == "BECWaveform"
|
34
32
|
assert plt.__class__ == BECWaveform
|
35
33
|
assert im.__class__.__name__ == "BECImageShow"
|
@@ -75,24 +73,21 @@ def test_rpc_plotting_shortcuts_init_configs(rpc_server_figure, qtbot):
|
|
75
73
|
}
|
76
74
|
|
77
75
|
|
78
|
-
def test_rpc_waveform_scan(rpc_server_figure,
|
79
|
-
fig = BECFigure(rpc_server_figure
|
76
|
+
def test_rpc_waveform_scan(rpc_server_figure, bec_client_lib):
|
77
|
+
fig = BECFigure(rpc_server_figure)
|
80
78
|
|
81
79
|
# add 3 different curves to track
|
82
80
|
plt = fig.plot(x_name="samx", y_name="bpm4i")
|
83
81
|
fig.plot(x_name="samx", y_name="bpm3a")
|
84
82
|
fig.plot(x_name="samx", y_name="bpm4d")
|
85
83
|
|
86
|
-
client =
|
84
|
+
client = bec_client_lib
|
87
85
|
dev = client.device_manager.devices
|
88
86
|
scans = client.scans
|
89
87
|
queue = client.queue
|
90
88
|
|
91
89
|
status = scans.line_scan(dev.samx, -5, 5, steps=10, exp_time=0.05, relative=False)
|
92
|
-
|
93
|
-
# wait for scan to finish
|
94
|
-
while not status.status == "COMPLETED":
|
95
|
-
qtbot.wait(200)
|
90
|
+
status.wait()
|
96
91
|
|
97
92
|
last_scan_data = queue.scan_storage.storage[-1].data
|
98
93
|
|
@@ -108,38 +103,33 @@ def test_rpc_waveform_scan(rpc_server_figure, qtbot):
|
|
108
103
|
assert plt_data["bpm4d-bpm4d"]["y"] == last_scan_data["bpm4d"]["bpm4d"].val
|
109
104
|
|
110
105
|
|
111
|
-
def test_rpc_image(rpc_server_figure,
|
112
|
-
fig = BECFigure(rpc_server_figure
|
106
|
+
def test_rpc_image(rpc_server_figure, bec_client_lib):
|
107
|
+
fig = BECFigure(rpc_server_figure)
|
113
108
|
|
114
109
|
im = fig.image("eiger")
|
115
110
|
|
116
|
-
client =
|
111
|
+
client = bec_client_lib
|
117
112
|
dev = client.device_manager.devices
|
118
113
|
scans = client.scans
|
119
114
|
|
120
115
|
status = scans.line_scan(dev.samx, -5, 5, steps=10, exp_time=0.05, relative=False)
|
121
|
-
|
122
|
-
# wait for scan to finish
|
123
|
-
while not status.status == "COMPLETED":
|
124
|
-
qtbot.wait(200)
|
116
|
+
status.wait()
|
125
117
|
|
126
118
|
last_image_device = client.connector.get_last(MessageEndpoints.device_monitor("eiger"))[
|
127
119
|
"data"
|
128
120
|
].data
|
129
|
-
qtbot.wait(500)
|
130
121
|
last_image_plot = im.images[0].get_data()
|
131
122
|
|
132
123
|
# check plotted data
|
133
124
|
np.testing.assert_equal(last_image_device, last_image_plot)
|
134
125
|
|
135
126
|
|
136
|
-
def test_rpc_motor_map(rpc_server_figure,
|
137
|
-
fig = BECFigure(rpc_server_figure
|
138
|
-
fig_server = rpc_server_figure.gui
|
127
|
+
def test_rpc_motor_map(rpc_server_figure, bec_client_lib):
|
128
|
+
fig = BECFigure(rpc_server_figure)
|
139
129
|
|
140
130
|
motor_map = fig.motor_map("samx", "samy")
|
141
131
|
|
142
|
-
client =
|
132
|
+
client = bec_client_lib
|
143
133
|
dev = client.device_manager.devices
|
144
134
|
scans = client.scans
|
145
135
|
|
@@ -147,10 +137,8 @@ def test_rpc_motor_map(rpc_server_figure, qtbot):
|
|
147
137
|
initial_pos_y = dev.samy.read()["samy"]["value"]
|
148
138
|
|
149
139
|
status = scans.mv(dev.samx, 1, dev.samy, 2, relative=True)
|
140
|
+
status.wait()
|
150
141
|
|
151
|
-
# wait for scan to finish
|
152
|
-
while not status.status == "COMPLETED":
|
153
|
-
qtbot.wait(200)
|
154
142
|
final_pos_x = dev.samx.read()["samx"]["value"]
|
155
143
|
final_pos_y = dev.samy.read()["samy"]["value"]
|
156
144
|
|
@@ -3,40 +3,30 @@ import pytest
|
|
3
3
|
from bec_widgets.cli.client import BECFigure, BECImageShow, BECMotorMap, BECWaveform
|
4
4
|
|
5
5
|
|
6
|
-
def
|
7
|
-
|
8
|
-
Recursively find the deepest value in a dictionary
|
9
|
-
Args:
|
10
|
-
d(dict): Dictionary to search
|
11
|
-
|
12
|
-
Returns:
|
13
|
-
The deepest value in the dictionary.
|
14
|
-
"""
|
15
|
-
if isinstance(d, dict):
|
16
|
-
if d:
|
17
|
-
return find_deepest_value(next(iter(d.values())))
|
18
|
-
return d
|
19
|
-
|
20
|
-
|
21
|
-
def test_rpc_register_list_connections(rpc_server_figure, rpc_register, qtbot):
|
22
|
-
fig = BECFigure(rpc_server_figure.gui_id)
|
23
|
-
fig_server = rpc_server_figure.gui
|
6
|
+
def test_rpc_register_list_connections(rpc_server_figure):
|
7
|
+
fig = BECFigure(rpc_server_figure)
|
24
8
|
|
25
9
|
plt = fig.plot(x_name="samx", y_name="bpm4i")
|
26
10
|
im = fig.image("eiger")
|
27
11
|
motor_map = fig.motor_map("samx", "samy")
|
28
12
|
plt_z = fig.add_plot("samx", "samy", "bpm4i")
|
29
13
|
|
30
|
-
|
14
|
+
# keep only class names from objects, since objects on server and client are different
|
15
|
+
# so the best we can do is to compare types (rpc register is unit-tested elsewhere)
|
16
|
+
all_connections = {obj_id: type(obj).__name__ for obj_id, obj in fig.get_all_rpc().items()}
|
31
17
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
18
|
+
all_subwidgets_expected = {wid: type(widget).__name__ for wid, widget in fig.widgets.items()}
|
19
|
+
curve_1D = fig.widgets[plt.rpc_id]
|
20
|
+
curve_2D = fig.widgets[plt_z.rpc_id]
|
21
|
+
curves_expected = {
|
22
|
+
curve_1D.rpc_id: type(curve_1D).__name__,
|
23
|
+
curve_2D.rpc_id: type(curve_2D).__name__,
|
24
|
+
}
|
25
|
+
curves_expected.update({curve._gui_id: type(curve).__name__ for curve in curve_1D.curves})
|
26
|
+
curves_expected.update({curve._gui_id: type(curve).__name__ for curve in curve_2D.curves})
|
27
|
+
fig_expected = {fig.rpc_id: type(fig).__name__}
|
38
28
|
image_item_expected = {
|
39
|
-
|
29
|
+
fig.widgets[im.rpc_id].images[0].rpc_id: type(fig.widgets[im.rpc_id].images[0]).__name__
|
40
30
|
}
|
41
31
|
|
42
32
|
all_connections_expected = {
|
File without changes
|
File without changes
|