bec-widgets 0.56.1__py3-none-any.whl → 0.56.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.
- .gitlab-ci.yml +1 -1
- CHANGELOG.md +28 -30
- PKG-INFO +1 -1
- bec_widgets/cli/__init__.py +0 -7
- bec_widgets/cli/auto_updates.py +45 -13
- bec_widgets/cli/client.py +20 -0
- bec_widgets/cli/client_utils.py +11 -5
- bec_widgets/widgets/dock/dock.py +6 -2
- bec_widgets/widgets/dock/dock_area.py +8 -3
- bec_widgets/widgets/figure/figure.py +1 -1
- bec_widgets/widgets/spiral_progress_bar/ring.py +2 -2
- bec_widgets/widgets/spiral_progress_bar/spiral_progress_bar.py +1 -2
- {bec_widgets-0.56.1.dist-info → bec_widgets-0.56.3.dist-info}/METADATA +1 -1
- {bec_widgets-0.56.1.dist-info → bec_widgets-0.56.3.dist-info}/RECORD +38 -28
- docs/_static/custom.css +170 -0
- docs/{developer/reference.md → api_reference/api_reference.md} +3 -1
- docs/assets/apps_48dp.svg +1 -0
- docs/assets/display_settings_48dp.svg +1 -0
- docs/assets/index_api.svg +97 -0
- docs/assets/index_contribute.svg +76 -0
- docs/assets/index_getting_started.svg +66 -0
- docs/assets/index_user_guide.svg +67 -0
- docs/assets/rocket_launch_48dp.svg +1 -0
- docs/conf.py +3 -3
- docs/developer/developer.md +0 -8
- docs/index.md +39 -8
- docs/user/api_reference/api_reference.md +11 -0
- docs/user/{apps.md → applications/applications.md} +1 -1
- docs/user/getting_started/getting_started.md +12 -0
- docs/user/{installation.md → getting_started/installation.md} +1 -1
- docs/user/user.md +51 -22
- docs/user/{widgets.md → widgets/widgets.md} +3 -3
- pyproject.toml +1 -1
- tests/end-2-end/test_bec_dock_rpc_e2e.py +73 -5
- tests/unit_tests/test_client_utils.py +2 -2
- tests/unit_tests/test_spiral_progress_bar.py +5 -5
- {bec_widgets-0.56.1.dist-info → bec_widgets-0.56.3.dist-info}/WHEEL +0 -0
- {bec_widgets-0.56.1.dist-info → bec_widgets-0.56.3.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
(user.getting_started)=
|
2
|
+
# Getting Started
|
3
|
+
This section provides a comprehensive guide to getting started with BEC Widgets. Whether you are new to BEC Widgets or looking to refresh your knowledge, this guide will help you set up and navigate the framework with ease.
|
4
|
+
|
5
|
+
```{toctree}
|
6
|
+
---
|
7
|
+
maxdepth: 2
|
8
|
+
hidden: true
|
9
|
+
---
|
10
|
+
|
11
|
+
getting_started/installation
|
12
|
+
```
|
@@ -14,7 +14,7 @@ Before installing BEC Widgets, please ensure the following requirements are met:
|
|
14
14
|
Install BEC Widgets using the pip package manager. Open your terminal and execute:
|
15
15
|
|
16
16
|
```bash
|
17
|
-
pip install bec_widgets
|
17
|
+
pip install bec_widgets PyQt6
|
18
18
|
```
|
19
19
|
|
20
20
|
This command installs BEC Widgets along with its dependencies, including the default PyQt6.
|
docs/user/user.md
CHANGED
@@ -1,38 +1,67 @@
|
|
1
1
|
(user)=
|
2
2
|
# User
|
3
|
+
Welcome to the User section of the BEC Widgets documentation! BEC Widgets is a versatile GUI framework tailored for beamline scientists, enabling efficient and intuitive interaction with beamline experiments. This section is designed to guide both new and experienced users through the essential aspects of utilizing BEC Widgets.
|
3
4
|
|
4
|
-
|
5
|
+
```{toctree}
|
6
|
+
---
|
7
|
+
maxdepth: 2
|
8
|
+
hidden: true
|
9
|
+
---
|
5
10
|
|
6
|
-
|
11
|
+
getting_started/getting_started.md
|
12
|
+
applications/applications.md
|
13
|
+
widgets/widgets.md
|
14
|
+
api_reference/api_reference.md
|
15
|
+
```
|
7
16
|
|
8
|
-
**Key Topics**
|
9
17
|
|
10
|
-
|
18
|
+
***
|
11
19
|
|
12
|
-
|
20
|
+
````{grid} 2
|
21
|
+
:gutter: 5
|
13
22
|
|
14
|
-
-
|
23
|
+
```{grid-item-card}
|
24
|
+
:link: user.getting_started
|
25
|
+
:link-type: ref
|
26
|
+
:img-top: /assets/rocket_launch_48dp.svg
|
27
|
+
:text-align: center
|
15
28
|
|
16
|
-
|
29
|
+
## Getting Started
|
17
30
|
|
18
|
-
|
31
|
+
Learn how to install BEC Widgets and get started with the framework.
|
32
|
+
```
|
19
33
|
|
20
|
-
|
34
|
+
```{grid-item-card}
|
35
|
+
:link: user.applications
|
36
|
+
:link-type: ref
|
37
|
+
:img-top: /assets/display_settings_48dp.svg
|
38
|
+
:text-align: center
|
21
39
|
|
22
|
-
|
23
|
-
- **Feature Requests:** Have an idea for a new feature or an enhancement? Share it with us on the [Issues page](https://gitlab.psi.ch/bec/bec-widgets/-/issues?sort=created_date&state=opened) of our repository. We have a feature request template that you can use to describe your proposal.
|
40
|
+
## Applications
|
24
41
|
|
25
|
-
|
42
|
+
Learn how to use BEC Widgets Applications, to modify and create new applications.
|
26
43
|
|
27
|
-
|
44
|
+
```
|
28
45
|
|
29
|
-
```{
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
46
|
+
```{grid-item-card}
|
47
|
+
:link: user.widgets
|
48
|
+
:link-type: ref
|
49
|
+
:img-top: /assets/apps_48dp.svg
|
50
|
+
:text-align: center
|
51
|
+
|
52
|
+
## Widgets
|
53
|
+
|
54
|
+
Learn about the building blocks of larger applications: widgets.
|
55
|
+
```
|
56
|
+
|
57
|
+
```{grid-item-card}
|
58
|
+
:link: user.api_reference
|
59
|
+
:link-type: ref
|
60
|
+
:img-top: /assets/index_api.svg
|
61
|
+
:text-align: center
|
62
|
+
|
63
|
+
## API reference
|
34
64
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
customisation
|
65
|
+
Comprehensive reference of all user-facing classes, functions, and methods.
|
66
|
+
```
|
67
|
+
````
|
@@ -15,7 +15,7 @@ BEC Widgets includes a variety of visualization widgets designed to cater to div
|
|
15
15
|
- Customizable visual elements such as line color and style.
|
16
16
|
|
17
17
|
**Example of Use:**
|
18
|
-

|
19
19
|
### 2D Scatter Plot
|
20
20
|
|
21
21
|
**Purpose:** The 2D scatter plot widget is designed for more complex data visualization. It employs a false color map to represent a third dimension (z-axis), making it an ideal tool for visualizing multidimensional data sets.
|
@@ -27,7 +27,7 @@ BEC Widgets includes a variety of visualization widgets designed to cater to div
|
|
27
27
|
- Tools for selecting and inspecting specific data points.
|
28
28
|
|
29
29
|
**Example of Use:**
|
30
|
-

|
31
31
|
### Motor Position Map
|
32
32
|
|
33
33
|
**Purpose:** A specialized component derived from the Motor Alignment Tool. It's focused on tracking and visualizing the position of motors, crucial for precise alignment and movement tracking during scans.
|
@@ -38,4 +38,4 @@ BEC Widgets includes a variety of visualization widgets designed to cater to div
|
|
38
38
|
- Ability to record and recall specific motor positions for repetitive tasks.
|
39
39
|
|
40
40
|
**Example of Use:**
|
41
|
-

|
pyproject.toml
CHANGED
@@ -1,11 +1,25 @@
|
|
1
1
|
import numpy as np
|
2
2
|
import pytest
|
3
|
+
from bec_lib.client import BECClient
|
3
4
|
from bec_lib.endpoints import MessageEndpoints
|
4
5
|
|
6
|
+
from bec_widgets.cli.auto_updates import AutoUpdates
|
5
7
|
from bec_widgets.cli.client import BECDockArea, BECFigure, BECImageShow, BECMotorMap, BECWaveform
|
6
8
|
from bec_widgets.utils import Colors
|
7
9
|
|
8
10
|
|
11
|
+
@pytest.fixture(name="bec_client")
|
12
|
+
def cli_bec_client(rpc_server_dock):
|
13
|
+
"""
|
14
|
+
Fixture to create a BECClient instance that is independent of the GUI.
|
15
|
+
"""
|
16
|
+
# pylint: disable=protected-access
|
17
|
+
cli_client = BECClient(forced=True, config=rpc_server_dock.client._service_config)
|
18
|
+
cli_client.start()
|
19
|
+
yield cli_client
|
20
|
+
cli_client.shutdown()
|
21
|
+
|
22
|
+
|
9
23
|
def test_rpc_add_dock_with_figure_e2e(rpc_server_dock, qtbot):
|
10
24
|
dock = BECDockArea(rpc_server_dock.gui_id)
|
11
25
|
dock_server = rpc_server_dock.gui
|
@@ -163,7 +177,7 @@ def test_spiral_bar(rpc_server_dock):
|
|
163
177
|
|
164
178
|
expected_colors = Colors.golden_angle_color("viridis", 5, "RGB")
|
165
179
|
bar_colors = [ring.color.getRgb() for ring in bar_server.rings]
|
166
|
-
bar_values = [ring.value for ring in bar_server.rings]
|
180
|
+
bar_values = [ring.config.value for ring in bar_server.rings]
|
167
181
|
assert bar_values == [10, 20, 30, 40, 50]
|
168
182
|
assert bar_colors == expected_colors
|
169
183
|
|
@@ -188,7 +202,7 @@ def test_spiral_bar_scan_update(rpc_server_dock, qtbot):
|
|
188
202
|
qtbot.wait(200)
|
189
203
|
bar_server = dock_server.docks["dock_0"].widgets[0]
|
190
204
|
assert bar_server.config.num_bars == 1
|
191
|
-
np.testing.assert_allclose(bar_server.rings[0].value, 10, atol=0.1)
|
205
|
+
np.testing.assert_allclose(bar_server.rings[0].config.value, 10, atol=0.1)
|
192
206
|
np.testing.assert_allclose(bar_server.rings[0].config.min_value, 0, atol=0.1)
|
193
207
|
np.testing.assert_allclose(bar_server.rings[0].config.max_value, 10, atol=0.1)
|
194
208
|
|
@@ -199,7 +213,7 @@ def test_spiral_bar_scan_update(rpc_server_dock, qtbot):
|
|
199
213
|
|
200
214
|
qtbot.wait(200)
|
201
215
|
assert bar_server.config.num_bars == 1
|
202
|
-
np.testing.assert_allclose(bar_server.rings[0].value, 16, atol=0.1)
|
216
|
+
np.testing.assert_allclose(bar_server.rings[0].config.value, 16, atol=0.1)
|
203
217
|
np.testing.assert_allclose(bar_server.rings[0].config.min_value, 0, atol=0.1)
|
204
218
|
np.testing.assert_allclose(bar_server.rings[0].config.max_value, 16, atol=0.1)
|
205
219
|
|
@@ -218,9 +232,63 @@ def test_spiral_bar_scan_update(rpc_server_dock, qtbot):
|
|
218
232
|
|
219
233
|
qtbot.wait(200)
|
220
234
|
assert bar_server.config.num_bars == 2
|
221
|
-
np.testing.assert_allclose(bar_server.rings[0].value, final_samx, atol=0.1)
|
222
|
-
np.testing.assert_allclose(bar_server.rings[1].value, final_samy, atol=0.1)
|
235
|
+
np.testing.assert_allclose(bar_server.rings[0].config.value, final_samx, atol=0.1)
|
236
|
+
np.testing.assert_allclose(bar_server.rings[1].config.value, final_samy, atol=0.1)
|
223
237
|
np.testing.assert_allclose(bar_server.rings[0].config.min_value, init_samx, atol=0.1)
|
224
238
|
np.testing.assert_allclose(bar_server.rings[1].config.min_value, init_samy, atol=0.1)
|
225
239
|
np.testing.assert_allclose(bar_server.rings[0].config.max_value, final_samx, atol=0.1)
|
226
240
|
np.testing.assert_allclose(bar_server.rings[1].config.max_value, final_samy, atol=0.1)
|
241
|
+
|
242
|
+
|
243
|
+
def test_auto_update(rpc_server_dock, bec_client, qtbot):
|
244
|
+
dock = BECDockArea(rpc_server_dock.gui_id)
|
245
|
+
dock._client = bec_client
|
246
|
+
|
247
|
+
AutoUpdates.enabled = True
|
248
|
+
AutoUpdates.create_default_dock = True
|
249
|
+
dock.auto_updates = AutoUpdates(gui=dock)
|
250
|
+
dock.auto_updates.start_default_dock()
|
251
|
+
dock.selected_device = "bpm4i"
|
252
|
+
|
253
|
+
# we need to start the update script manually; normally this is done when the GUI is started
|
254
|
+
dock._start_update_script()
|
255
|
+
|
256
|
+
client = bec_client
|
257
|
+
dev = client.device_manager.devices
|
258
|
+
scans = client.scans
|
259
|
+
queue = client.queue
|
260
|
+
|
261
|
+
status = scans.line_scan(dev.samx, -5, 5, steps=10, exp_time=0.05, relative=False)
|
262
|
+
|
263
|
+
# wait for scan to finish
|
264
|
+
while not status.status == "COMPLETED":
|
265
|
+
qtbot.wait(200)
|
266
|
+
|
267
|
+
last_scan_data = queue.scan_storage.storage[-1].data
|
268
|
+
|
269
|
+
# get data from curves
|
270
|
+
plt = dock.auto_updates.get_default_figure()
|
271
|
+
widgets = plt.widget_list
|
272
|
+
plt_data = widgets[0].get_all_data()
|
273
|
+
|
274
|
+
# check plotted data
|
275
|
+
assert plt_data["bpm4i-bpm4i"]["x"] == last_scan_data["samx"]["samx"].val
|
276
|
+
assert plt_data["bpm4i-bpm4i"]["y"] == last_scan_data["bpm4i"]["bpm4i"].val
|
277
|
+
|
278
|
+
status = scans.grid_scan(
|
279
|
+
dev.samx, -10, 10, 5, dev.samy, -5, 5, 5, exp_time=0.05, relative=False
|
280
|
+
)
|
281
|
+
|
282
|
+
# wait for scan to finish
|
283
|
+
while not status.status == "COMPLETED":
|
284
|
+
qtbot.wait(200)
|
285
|
+
|
286
|
+
plt = dock.auto_updates.get_default_figure()
|
287
|
+
widgets = plt.widget_list
|
288
|
+
plt_data = widgets[0].get_all_data()
|
289
|
+
|
290
|
+
last_scan_data = queue.scan_storage.storage[-1].data
|
291
|
+
|
292
|
+
# check plotted data
|
293
|
+
assert plt_data[f"Scan {status.scan.scan_number}"]["x"] == last_scan_data["samx"]["samx"].val
|
294
|
+
assert plt_data[f"Scan {status.scan.scan_number}"]["y"] == last_scan_data["samy"]["samy"].val
|
@@ -25,5 +25,5 @@ def test_rpc_call_accepts_device_as_input(cli_figure):
|
|
25
25
|
dev1 = FakeDevice("samx")
|
26
26
|
dev2 = FakeDevice("bpm4i")
|
27
27
|
fig, mock_rpc_call = cli_figure
|
28
|
-
fig.plot(dev1, dev2)
|
29
|
-
mock_rpc_call.assert_called_with("plot", "samx", "bpm4i")
|
28
|
+
fig.plot(x_name=dev1, y_name=dev2)
|
29
|
+
mock_rpc_call.assert_called_with("plot", x_name="samx", y_name="bpm4i")
|
@@ -145,12 +145,12 @@ def test_bar_set_value(spiral_progress_bar):
|
|
145
145
|
assert len(spiral_progress_bar.rings) == 5
|
146
146
|
|
147
147
|
spiral_progress_bar.set_value([10, 20, 30, 40, 50])
|
148
|
-
ring_values = [ring.value for ring in spiral_progress_bar.rings]
|
148
|
+
ring_values = [ring.config.value for ring in spiral_progress_bar.rings]
|
149
149
|
assert ring_values == [10, 20, 30, 40, 50]
|
150
150
|
|
151
151
|
# update just one bar
|
152
152
|
spiral_progress_bar.set_value(90, 1)
|
153
|
-
ring_values = [ring.value for ring in spiral_progress_bar.rings]
|
153
|
+
ring_values = [ring.config.value for ring in spiral_progress_bar.rings]
|
154
154
|
assert ring_values == [10, 90, 30, 40, 50]
|
155
155
|
|
156
156
|
|
@@ -166,7 +166,7 @@ def test_bar_set_precision(spiral_progress_bar):
|
|
166
166
|
assert ring_precision == [2, 2, 2]
|
167
167
|
|
168
168
|
spiral_progress_bar.set_value([10.1234, 20.1234, 30.1234])
|
169
|
-
ring_values = [ring.value for ring in spiral_progress_bar.rings]
|
169
|
+
ring_values = [ring.config.value for ring in spiral_progress_bar.rings]
|
170
170
|
assert ring_values == [10.12, 20.12, 30.12]
|
171
171
|
|
172
172
|
spiral_progress_bar.set_precision(4, 1)
|
@@ -174,7 +174,7 @@ def test_bar_set_precision(spiral_progress_bar):
|
|
174
174
|
assert ring_precision == [2, 4, 2]
|
175
175
|
|
176
176
|
spiral_progress_bar.set_value([10.1234, 20.1234, 30.1234])
|
177
|
-
ring_values = [ring.value for ring in spiral_progress_bar.rings]
|
177
|
+
ring_values = [ring.config.value for ring in spiral_progress_bar.rings]
|
178
178
|
assert ring_values == [10.12, 20.1234, 30.12]
|
179
179
|
|
180
180
|
|
@@ -189,7 +189,7 @@ def test_set_min_max_value(spiral_progress_bar):
|
|
189
189
|
assert ring_max_values == [10, 10]
|
190
190
|
|
191
191
|
spiral_progress_bar.set_value([5, 15])
|
192
|
-
ring_values = [ring.value for ring in spiral_progress_bar.rings]
|
192
|
+
ring_values = [ring.config.value for ring in spiral_progress_bar.rings]
|
193
193
|
assert ring_values == [5, 10]
|
194
194
|
|
195
195
|
|
File without changes
|
File without changes
|