bec-widgets 0.57.4__py3-none-any.whl → 0.57.6__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 -26
- PKG-INFO +1 -1
- bec_widgets/cli/client.py +101 -85
- bec_widgets/examples/jupyter_console/jupyter_console_window.py +4 -3
- bec_widgets/widgets/figure/figure.py +170 -116
- bec_widgets/widgets/figure/plots/image/image.py +0 -1
- bec_widgets/widgets/figure/plots/plot_base.py +0 -14
- bec_widgets/widgets/figure/plots/waveform/waveform.py +79 -29
- bec_widgets/widgets/spiral_progress_bar/ring.py +72 -1
- bec_widgets/widgets/spiral_progress_bar/spiral_progress_bar.py +22 -0
- {bec_widgets-0.57.4.dist-info → bec_widgets-0.57.6.dist-info}/METADATA +1 -1
- {bec_widgets-0.57.4.dist-info → bec_widgets-0.57.6.dist-info}/RECORD +18 -18
- docs/user/widgets/bec_figure.md +2 -2
- pyproject.toml +1 -1
- tests/end-2-end/test_bec_figure_rpc_e2e.py +2 -2
- tests/end-2-end/test_rpc_register_e2e.py +1 -1
- {bec_widgets-0.57.4.dist-info → bec_widgets-0.57.6.dist-info}/WHEEL +0 -0
- {bec_widgets-0.57.4.dist-info → bec_widgets-0.57.6.dist-info}/licenses/LICENSE +0 -0
CHANGELOG.md
CHANGED
@@ -2,6 +2,30 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
## v0.57.6 (2024-06-06)
|
6
|
+
|
7
|
+
### Fix
|
8
|
+
|
9
|
+
* fix(bar): docstrings extended ([`edb1775`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/edb1775967c3ff0723d0edad2b764f1ffc832b7c))
|
10
|
+
|
11
|
+
|
12
|
+
## v0.57.5 (2024-06-06)
|
13
|
+
|
14
|
+
### Documentation
|
15
|
+
|
16
|
+
* docs(figure): docs adjusted to be compatible with new signature ([`c037b87`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/c037b87675af91b26e8c7c60e76622d4ed4cf5d5))
|
17
|
+
|
18
|
+
### Fix
|
19
|
+
|
20
|
+
* fix(waveform): added .plot method with the same signature as BECFigure.plot ([`8479caf`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/8479caf53a7325788ca264e5bd9aee01f1d4c5a0))
|
21
|
+
|
22
|
+
* fix(plot_base): .plot removed from plot_base.py, because there is no use case for it ([`82e2c89`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/82e2c898d2e26f786b2d481f85c647472675e75b))
|
23
|
+
|
24
|
+
### Refactor
|
25
|
+
|
26
|
+
* refactor(figure): logic for .add_image and .image consolidated; logic for .add_plot and .plot consolidated ([`52bc322`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/52bc322b2b8d3ef92ff3480e61bddaf32464f976))
|
27
|
+
|
28
|
+
|
5
29
|
## v0.57.4 (2024-06-06)
|
6
30
|
|
7
31
|
### Fix
|
@@ -128,34 +152,8 @@
|
|
128
152
|
|
129
153
|
* docs(examples): example apps section deleted ([`ad208a5`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ad208a5ef8495c45a8b83a4850ba9a1041b42717))
|
130
154
|
|
131
|
-
### Feature
|
132
|
-
|
133
|
-
* feat(utils/ui_loader): universal ui loader for pyside/pyqt ([`0fea8d6`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/0fea8d606574fa99dda3b117da5d5209c251f694))
|
134
|
-
|
135
155
|
### Fix
|
136
156
|
|
137
157
|
* fix(examples): outdated examples removed (mca_plot.py, stream_plot.py, motor_example.py) ([`ddc9510`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/ddc9510c2ba8dadf291809eeb5b135a105259492))
|
138
158
|
|
139
159
|
* fix: compatibility adjustment to .ui loading and tests for PySide6 ([`07b99d9`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/07b99d91a57a645cddd76294f48d78773e4c9ea5))
|
140
|
-
|
141
|
-
|
142
|
-
## v0.55.0 (2024-05-24)
|
143
|
-
|
144
|
-
### Feature
|
145
|
-
|
146
|
-
* feat(widgets/progressbar): SpiralProgressBar added with rpc interface ([`76bd0d3`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/76bd0d339ac9ae9e8a3baa0d0d4e951ec1d09670))
|
147
|
-
|
148
|
-
|
149
|
-
## v0.54.0 (2024-05-24)
|
150
|
-
|
151
|
-
### Build
|
152
|
-
|
153
|
-
* build: added pyqt6 as sphinx build dependency ([`a47a8ec`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/a47a8ec413934cf7fce8d5b7a5913371d4b3b4a5))
|
154
|
-
|
155
|
-
### Feature
|
156
|
-
|
157
|
-
* feat(figure): changes to support direct plot functionality ([`fc4d0f3`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/fc4d0f3bb2a7c2fca9c326d86eb68b305bcd548b))
|
158
|
-
|
159
|
-
### Refactor
|
160
|
-
|
161
|
-
* refactor(reconstruction): repository structure is changed to separate assets needed for each widget ([`3455c60`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/3455c602361d3b5cc3ff9190f9d2870474becf8a))
|
PKG-INFO
CHANGED
bec_widgets/cli/client.py
CHANGED
@@ -128,17 +128,6 @@ class BECPlotBase(RPCBase):
|
|
128
128
|
lock(bool): True to lock, False to unlock.
|
129
129
|
"""
|
130
130
|
|
131
|
-
@rpc_call
|
132
|
-
def plot(self, data_x: "list | np.ndarray", data_y: "list | np.ndarray", **kwargs):
|
133
|
-
"""
|
134
|
-
Plot custom data on the plot widget. These data are not saved in config.
|
135
|
-
|
136
|
-
Args:
|
137
|
-
data_x(list|np.ndarray): x-axis data
|
138
|
-
data_y(list|np.ndarray): y-axis data
|
139
|
-
**kwargs: Keyword arguments for the plot.
|
140
|
-
"""
|
141
|
-
|
142
131
|
@rpc_call
|
143
132
|
def remove(self):
|
144
133
|
"""
|
@@ -165,57 +154,36 @@ class BECWaveform(RPCBase):
|
|
165
154
|
"""
|
166
155
|
|
167
156
|
@rpc_call
|
168
|
-
def
|
157
|
+
def plot(
|
169
158
|
self,
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
159
|
+
x: "list | np.ndarray | None" = None,
|
160
|
+
y: "list | np.ndarray | None" = None,
|
161
|
+
x_name: "str | None" = None,
|
162
|
+
y_name: "str | None" = None,
|
163
|
+
z_name: "str | None" = None,
|
164
|
+
x_entry: "str | None" = None,
|
165
|
+
y_entry: "str | None" = None,
|
166
|
+
z_entry: "str | None" = None,
|
167
|
+
color: "str | None" = None,
|
168
|
+
color_map_z: "str | None" = "plasma",
|
169
|
+
label: "str | None" = None,
|
170
|
+
validate: "bool" = True,
|
181
171
|
) -> "BECCurve":
|
182
172
|
"""
|
183
|
-
|
184
|
-
|
173
|
+
Plot a curve to the plot widget.
|
185
174
|
Args:
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
z_name(str):
|
191
|
-
|
192
|
-
|
175
|
+
x(list | np.ndarray): Custom x data to plot.
|
176
|
+
y(list | np.ndarray): Custom y data to plot.
|
177
|
+
x_name(str): The name of the device for the x-axis.
|
178
|
+
y_name(str): The name of the device for the y-axis.
|
179
|
+
z_name(str): The name of the device for the z-axis.
|
180
|
+
x_entry(str): The name of the entry for the x-axis.
|
181
|
+
y_entry(str): The name of the entry for the y-axis.
|
182
|
+
z_entry(str): The name of the entry for the z-axis.
|
183
|
+
color(str): The color of the curve.
|
193
184
|
color_map_z(str): The color map to use for the z-axis.
|
194
|
-
label(str
|
195
|
-
|
196
|
-
|
197
|
-
Returns:
|
198
|
-
BECCurve: The curve object.
|
199
|
-
"""
|
200
|
-
|
201
|
-
@rpc_call
|
202
|
-
def add_curve_custom(
|
203
|
-
self,
|
204
|
-
x: "list | np.ndarray",
|
205
|
-
y: "list | np.ndarray",
|
206
|
-
label: "str" = None,
|
207
|
-
color: "str" = None,
|
208
|
-
**kwargs,
|
209
|
-
) -> "BECCurve":
|
210
|
-
"""
|
211
|
-
Add a custom data curve to the plot widget.
|
212
|
-
|
213
|
-
Args:
|
214
|
-
x(list|np.ndarray): X data of the curve.
|
215
|
-
y(list|np.ndarray): Y data of the curve.
|
216
|
-
label(str, optional): Label of the curve. Defaults to None.
|
217
|
-
color(str, optional): Color of the curve. Defaults to None.
|
218
|
-
**kwargs: Additional keyword arguments for the curve configuration.
|
185
|
+
label(str): The label of the curve.
|
186
|
+
validate(bool): If True, validate the device names and entries.
|
219
187
|
|
220
188
|
Returns:
|
221
189
|
BECCurve: The curve object.
|
@@ -409,14 +377,39 @@ class BECWaveform(RPCBase):
|
|
409
377
|
"""
|
410
378
|
|
411
379
|
@rpc_call
|
412
|
-
def plot(
|
380
|
+
def plot(
|
381
|
+
self,
|
382
|
+
x: "list | np.ndarray | None" = None,
|
383
|
+
y: "list | np.ndarray | None" = None,
|
384
|
+
x_name: "str | None" = None,
|
385
|
+
y_name: "str | None" = None,
|
386
|
+
z_name: "str | None" = None,
|
387
|
+
x_entry: "str | None" = None,
|
388
|
+
y_entry: "str | None" = None,
|
389
|
+
z_entry: "str | None" = None,
|
390
|
+
color: "str | None" = None,
|
391
|
+
color_map_z: "str | None" = "plasma",
|
392
|
+
label: "str | None" = None,
|
393
|
+
validate: "bool" = True,
|
394
|
+
) -> "BECCurve":
|
413
395
|
"""
|
414
|
-
Plot
|
415
|
-
|
396
|
+
Plot a curve to the plot widget.
|
416
397
|
Args:
|
417
|
-
|
418
|
-
|
419
|
-
|
398
|
+
x(list | np.ndarray): Custom x data to plot.
|
399
|
+
y(list | np.ndarray): Custom y data to plot.
|
400
|
+
x_name(str): The name of the device for the x-axis.
|
401
|
+
y_name(str): The name of the device for the y-axis.
|
402
|
+
z_name(str): The name of the device for the z-axis.
|
403
|
+
x_entry(str): The name of the entry for the x-axis.
|
404
|
+
y_entry(str): The name of the entry for the y-axis.
|
405
|
+
z_entry(str): The name of the entry for the z-axis.
|
406
|
+
color(str): The color of the curve.
|
407
|
+
color_map_z(str): The color map to use for the z-axis.
|
408
|
+
label(str): The label of the curve.
|
409
|
+
validate(bool): If True, validate the device names and entries.
|
410
|
+
|
411
|
+
Returns:
|
412
|
+
BECCurve: The curve object.
|
420
413
|
"""
|
421
414
|
|
422
415
|
@rpc_call
|
@@ -469,14 +462,14 @@ class BECFigure(RPCBase):
|
|
469
462
|
@rpc_call
|
470
463
|
def add_plot(
|
471
464
|
self,
|
465
|
+
x: "list | np.ndarray" = None,
|
466
|
+
y: "list | np.ndarray" = None,
|
472
467
|
x_name: "str" = None,
|
473
468
|
y_name: "str" = None,
|
474
469
|
z_name: "str" = None,
|
475
470
|
x_entry: "str" = None,
|
476
471
|
y_entry: "str" = None,
|
477
472
|
z_entry: "str" = None,
|
478
|
-
x: "list | np.ndarray" = None,
|
479
|
-
y: "list | np.ndarray" = None,
|
480
473
|
color: "Optional[str]" = None,
|
481
474
|
color_map_z: "Optional[str]" = "plasma",
|
482
475
|
label: "Optional[str]" = None,
|
@@ -490,7 +483,18 @@ class BECFigure(RPCBase):
|
|
490
483
|
Add a Waveform1D plot to the figure at the specified position.
|
491
484
|
|
492
485
|
Args:
|
493
|
-
|
486
|
+
x(list | np.ndarray): Custom x data to plot.
|
487
|
+
y(list | np.ndarray): Custom y data to plot.
|
488
|
+
x_name(str): The name of the device for the x-axis.
|
489
|
+
y_name(str): The name of the device for the y-axis.
|
490
|
+
z_name(str): The name of the device for the z-axis.
|
491
|
+
x_entry(str): The name of the entry for the x-axis.
|
492
|
+
y_entry(str): The name of the entry for the y-axis.
|
493
|
+
z_entry(str): The name of the entry for the z-axis.
|
494
|
+
color(str): The color of the curve.
|
495
|
+
color_map_z(str): The color map to use for the z-axis.
|
496
|
+
label(str): The label of the curve.
|
497
|
+
validate(bool): If True, validate the device names and entries.
|
494
498
|
row(int): The row coordinate of the widget in the figure. If not provided, the next empty row will be used.
|
495
499
|
col(int): The column coordinate of the widget in the figure. If not provided, the next empty column will be used.
|
496
500
|
config(dict): Additional configuration for the widget.
|
@@ -1139,17 +1143,6 @@ class BECImageShow(RPCBase):
|
|
1139
1143
|
lock(bool): True to lock, False to unlock.
|
1140
1144
|
"""
|
1141
1145
|
|
1142
|
-
@rpc_call
|
1143
|
-
def plot(self, data_x: "list | np.ndarray", data_y: "list | np.ndarray", **kwargs):
|
1144
|
-
"""
|
1145
|
-
Plot custom data on the plot widget. These data are not saved in config.
|
1146
|
-
|
1147
|
-
Args:
|
1148
|
-
data_x(list|np.ndarray): x-axis data
|
1149
|
-
data_y(list|np.ndarray): y-axis data
|
1150
|
-
**kwargs: Keyword arguments for the plot.
|
1151
|
-
"""
|
1152
|
-
|
1153
1146
|
@rpc_call
|
1154
1147
|
def remove(self):
|
1155
1148
|
"""
|
@@ -1868,43 +1861,66 @@ class Ring(RPCBase):
|
|
1868
1861
|
@rpc_call
|
1869
1862
|
def set_value(self, value: "int | float"):
|
1870
1863
|
"""
|
1871
|
-
|
1864
|
+
Set the value for the ring widget
|
1865
|
+
|
1866
|
+
Args:
|
1867
|
+
value(int | float): Value for the ring widget
|
1872
1868
|
"""
|
1873
1869
|
|
1874
1870
|
@rpc_call
|
1875
1871
|
def set_color(self, color: "str | tuple"):
|
1876
1872
|
"""
|
1877
|
-
|
1873
|
+
Set the color for the ring widget
|
1874
|
+
|
1875
|
+
Args:
|
1876
|
+
color(str | tuple): Color for the ring widget. Can be HEX code or tuple (R, G, B, A).
|
1878
1877
|
"""
|
1879
1878
|
|
1880
1879
|
@rpc_call
|
1881
1880
|
def set_background(self, color: "str | tuple"):
|
1882
1881
|
"""
|
1883
|
-
|
1882
|
+
Set the background color for the ring widget
|
1883
|
+
|
1884
|
+
Args:
|
1885
|
+
color(str | tuple): Background color for the ring widget. Can be HEX code or tuple (R, G, B, A).
|
1884
1886
|
"""
|
1885
1887
|
|
1886
1888
|
@rpc_call
|
1887
1889
|
def set_line_width(self, width: "int"):
|
1888
1890
|
"""
|
1889
|
-
|
1891
|
+
Set the line width for the ring widget
|
1892
|
+
|
1893
|
+
Args:
|
1894
|
+
width(int): Line width for the ring widget
|
1890
1895
|
"""
|
1891
1896
|
|
1892
1897
|
@rpc_call
|
1893
1898
|
def set_min_max_values(self, min_value: "int | float", max_value: "int | float"):
|
1894
1899
|
"""
|
1895
|
-
|
1900
|
+
Set the min and max values for the ring widget.
|
1901
|
+
|
1902
|
+
Args:
|
1903
|
+
min_value(int | float): Minimum value for the ring widget
|
1904
|
+
max_value(int | float): Maximum value for the ring widget
|
1896
1905
|
"""
|
1897
1906
|
|
1898
1907
|
@rpc_call
|
1899
1908
|
def set_start_angle(self, start_angle: "int"):
|
1900
1909
|
"""
|
1901
|
-
|
1910
|
+
Set the start angle for the ring widget
|
1911
|
+
|
1912
|
+
Args:
|
1913
|
+
start_angle(int): Start angle for the ring widget in degrees
|
1902
1914
|
"""
|
1903
1915
|
|
1904
1916
|
@rpc_call
|
1905
1917
|
def set_update(self, mode: "Literal['manual', 'scan', 'device']", device: "str" = None):
|
1906
1918
|
"""
|
1907
|
-
Set the update mode for the ring widget
|
1919
|
+
Set the update mode for the ring widget.
|
1920
|
+
Modes:
|
1921
|
+
- "manual": Manual update mode, the value is set by the user.
|
1922
|
+
- "scan": Update mode for the scan progress. The value is updated by the current scan progress.
|
1923
|
+
- "device": Update mode for the device readback. The value is updated by the device readback. Take into account that user has to set the device name and limits.
|
1908
1924
|
|
1909
1925
|
Args:
|
1910
1926
|
mode(str): Update mode for the ring widget. Can be "manual", "scan" or "device"
|
@@ -1914,5 +1930,5 @@ class Ring(RPCBase):
|
|
1914
1930
|
@rpc_call
|
1915
1931
|
def reset_connection(self):
|
1916
1932
|
"""
|
1917
|
-
|
1933
|
+
Reset the connections for the ring widget. Disconnect the current slot and endpoint.
|
1918
1934
|
"""
|
@@ -97,14 +97,16 @@ class JupyterConsoleWindow(QWidget): # pragma: no cover:
|
|
97
97
|
self.w3 = self.figure[1, 0]
|
98
98
|
|
99
99
|
# curves for w1
|
100
|
-
self.w1.
|
101
|
-
self.w1.
|
100
|
+
self.w1.plot(x_name="samx", y_name="samy", z_name="bpm4i")
|
101
|
+
self.w1.plot(x_name="samx", y_name="samy", z_name="bpm3a")
|
102
102
|
self.c1 = self.w1.get_config()
|
103
103
|
|
104
104
|
def _init_dock(self):
|
105
105
|
|
106
106
|
self.d0 = self.dock.add_dock(name="dock_0")
|
107
107
|
self.fig0 = self.d0.add_widget("BECFigure")
|
108
|
+
data = np.random.rand(10, 2)
|
109
|
+
self.fig0.plot(data, label="2d Data")
|
108
110
|
self.fig0.image("eiger", vrange=(0, 100))
|
109
111
|
|
110
112
|
self.d1 = self.dock.add_dock(name="dock_1", position="right")
|
@@ -114,7 +116,6 @@ class JupyterConsoleWindow(QWidget): # pragma: no cover:
|
|
114
116
|
|
115
117
|
self.d2 = self.dock.add_dock(name="dock_2", position="bottom")
|
116
118
|
self.fig2 = self.d2.add_widget("BECFigure", row=0, col=0)
|
117
|
-
self.fig2.motor_map(x_name="samx", y_name="samy")
|
118
119
|
self.fig2.plot(x_name="samx", y_name="bpm4i")
|
119
120
|
self.bar = self.d2.add_widget("SpiralProgressBar", row=0, col=1)
|
120
121
|
self.bar.set_diameter(200)
|
@@ -184,8 +184,9 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
184
184
|
"""
|
185
185
|
self._widgets = value
|
186
186
|
|
187
|
-
def
|
187
|
+
def _init_waveform(
|
188
188
|
self,
|
189
|
+
waveform,
|
189
190
|
x_name: str = None,
|
190
191
|
y_name: str = None,
|
191
192
|
z_name: str = None,
|
@@ -198,33 +199,45 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
198
199
|
color_map_z: Optional[str] = "plasma",
|
199
200
|
label: Optional[str] = None,
|
200
201
|
validate: bool = True,
|
201
|
-
|
202
|
-
col: int = None,
|
203
|
-
config=None,
|
204
|
-
**axis_kwargs,
|
205
|
-
) -> BECWaveform:
|
202
|
+
):
|
206
203
|
"""
|
207
|
-
|
204
|
+
Configure the waveform based on the provided parameters.
|
208
205
|
|
209
206
|
Args:
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
207
|
+
waveform (BECWaveform): The waveform to configure.
|
208
|
+
x (list | np.ndarray): Custom x data to plot.
|
209
|
+
y (list | np.ndarray): Custom y data to plot.
|
210
|
+
x_name (str): The name of the device for the x-axis.
|
211
|
+
y_name (str): The name of the device for the y-axis.
|
212
|
+
z_name (str): The name of the device for the z-axis.
|
213
|
+
x_entry (str): The name of the entry for the x-axis.
|
214
|
+
y_entry (str): The name of the entry for the y-axis.
|
215
|
+
z_entry (str): The name of the entry for the z-axis.
|
216
|
+
color (str): The color of the curve.
|
217
|
+
color_map_z (str): The color map to use for the z-axis.
|
218
|
+
label (str): The label of the curve.
|
219
|
+
validate (bool): If True, validate the device names and entries.
|
215
220
|
"""
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
221
|
+
if x is not None and y is None:
|
222
|
+
if isinstance(x, np.ndarray):
|
223
|
+
if x.ndim == 1:
|
224
|
+
y = np.arange(x.size)
|
225
|
+
waveform.add_curve_custom(x=np.arange(x.size), y=x, color=color, label=label)
|
226
|
+
return waveform
|
227
|
+
if x.ndim == 2:
|
228
|
+
waveform.add_curve_custom(x=x[:, 0], y=x[:, 1], color=color, label=label)
|
229
|
+
return waveform
|
230
|
+
elif isinstance(x, list):
|
231
|
+
y = np.arange(len(x))
|
232
|
+
waveform.add_curve_custom(x=np.arange(len(x)), y=x, color=color, label=label)
|
233
|
+
return waveform
|
234
|
+
else:
|
235
|
+
raise ValueError(
|
236
|
+
"Invalid input. Provide either device names (x_name, y_name) or custom data."
|
237
|
+
)
|
238
|
+
if x is not None and y is not None:
|
239
|
+
waveform.add_curve_custom(x=x, y=y, color=color, label=label)
|
240
|
+
return waveform
|
228
241
|
# User wants to add scan curve -> 1D Waveform
|
229
242
|
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:
|
230
243
|
waveform.add_curve_scan(
|
@@ -262,6 +275,73 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
262
275
|
|
263
276
|
return waveform
|
264
277
|
|
278
|
+
def add_plot(
|
279
|
+
self,
|
280
|
+
x: list | np.ndarray = None,
|
281
|
+
y: list | np.ndarray = None,
|
282
|
+
x_name: str = None,
|
283
|
+
y_name: str = None,
|
284
|
+
z_name: str = None,
|
285
|
+
x_entry: str = None,
|
286
|
+
y_entry: str = None,
|
287
|
+
z_entry: str = None,
|
288
|
+
color: Optional[str] = None,
|
289
|
+
color_map_z: Optional[str] = "plasma",
|
290
|
+
label: Optional[str] = None,
|
291
|
+
validate: bool = True,
|
292
|
+
row: int = None,
|
293
|
+
col: int = None,
|
294
|
+
config=None,
|
295
|
+
**axis_kwargs,
|
296
|
+
) -> BECWaveform:
|
297
|
+
"""
|
298
|
+
Add a Waveform1D plot to the figure at the specified position.
|
299
|
+
|
300
|
+
Args:
|
301
|
+
x(list | np.ndarray): Custom x data to plot.
|
302
|
+
y(list | np.ndarray): Custom y data to plot.
|
303
|
+
x_name(str): The name of the device for the x-axis.
|
304
|
+
y_name(str): The name of the device for the y-axis.
|
305
|
+
z_name(str): The name of the device for the z-axis.
|
306
|
+
x_entry(str): The name of the entry for the x-axis.
|
307
|
+
y_entry(str): The name of the entry for the y-axis.
|
308
|
+
z_entry(str): The name of the entry for the z-axis.
|
309
|
+
color(str): The color of the curve.
|
310
|
+
color_map_z(str): The color map to use for the z-axis.
|
311
|
+
label(str): The label of the curve.
|
312
|
+
validate(bool): If True, validate the device names and entries.
|
313
|
+
row(int): The row coordinate of the widget in the figure. If not provided, the next empty row will be used.
|
314
|
+
col(int): The column coordinate of the widget in the figure. If not provided, the next empty column will be used.
|
315
|
+
config(dict): Additional configuration for the widget.
|
316
|
+
**axis_kwargs(dict): Additional axis properties to set on the widget after creation.
|
317
|
+
"""
|
318
|
+
widget_id = str(uuid.uuid4())
|
319
|
+
waveform = self.add_widget(
|
320
|
+
widget_type="Waveform1D",
|
321
|
+
widget_id=widget_id,
|
322
|
+
row=row,
|
323
|
+
col=col,
|
324
|
+
config=config,
|
325
|
+
**axis_kwargs,
|
326
|
+
)
|
327
|
+
|
328
|
+
waveform = self._init_waveform(
|
329
|
+
waveform=waveform,
|
330
|
+
x=x,
|
331
|
+
y=y,
|
332
|
+
x_name=x_name,
|
333
|
+
y_name=y_name,
|
334
|
+
z_name=z_name,
|
335
|
+
x_entry=x_entry,
|
336
|
+
y_entry=y_entry,
|
337
|
+
z_entry=z_entry,
|
338
|
+
color=color,
|
339
|
+
color_map_z=color_map_z,
|
340
|
+
label=label,
|
341
|
+
validate=validate,
|
342
|
+
)
|
343
|
+
return waveform
|
344
|
+
|
265
345
|
@typechecked
|
266
346
|
def plot(
|
267
347
|
self,
|
@@ -309,69 +389,60 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
309
389
|
else:
|
310
390
|
waveform = self.add_plot(**axis_kwargs)
|
311
391
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
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
|
392
|
+
waveform = self._init_waveform(
|
393
|
+
waveform=waveform,
|
394
|
+
x=x,
|
395
|
+
y=y,
|
396
|
+
x_name=x_name,
|
397
|
+
y_name=y_name,
|
398
|
+
z_name=z_name,
|
399
|
+
x_entry=x_entry,
|
400
|
+
y_entry=y_entry,
|
401
|
+
z_entry=z_entry,
|
402
|
+
color=color,
|
403
|
+
color_map_z=color_map_z,
|
404
|
+
label=label,
|
405
|
+
validate=validate,
|
406
|
+
)
|
407
|
+
# TODO remove repetition from .plot method
|
408
|
+
return waveform
|
332
409
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
410
|
+
def _init_image(
|
411
|
+
self,
|
412
|
+
image,
|
413
|
+
monitor: str = None,
|
414
|
+
color_bar: Literal["simple", "full"] = "full",
|
415
|
+
color_map: str = "magma",
|
416
|
+
data: np.ndarray = None,
|
417
|
+
vrange: tuple[float, float] = None,
|
418
|
+
) -> BECImageShow:
|
419
|
+
"""
|
420
|
+
Configure the image based on the provided parameters.
|
421
|
+
|
422
|
+
Args:
|
423
|
+
image (BECImageShow): The image to configure.
|
424
|
+
monitor (str): The name of the monitor to display.
|
425
|
+
color_bar (Literal["simple","full"]): The type of color bar to display.
|
426
|
+
color_map (str): The color map to use for the image.
|
427
|
+
data (np.ndarray): Custom data to display.
|
428
|
+
"""
|
429
|
+
if monitor is not None and data is None:
|
430
|
+
image.add_monitor_image(
|
431
|
+
monitor=monitor, color_map=color_map, vrange=vrange, color_bar=color_bar
|
344
432
|
)
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
and y_name is not None
|
349
|
-
and z_name is not None
|
350
|
-
and x is None
|
351
|
-
and y is None
|
352
|
-
):
|
353
|
-
waveform.add_curve_scan(
|
354
|
-
x_name=x_name,
|
355
|
-
y_name=y_name,
|
356
|
-
z_name=z_name,
|
357
|
-
x_entry=x_entry,
|
358
|
-
y_entry=y_entry,
|
359
|
-
z_entry=z_entry,
|
360
|
-
color=color,
|
361
|
-
color_map_z=color_map_z,
|
362
|
-
label=label,
|
363
|
-
validate=validate,
|
433
|
+
elif data is not None and monitor is None:
|
434
|
+
image.add_custom_image(
|
435
|
+
name="custom", data=data, color_map=color_map, vrange=vrange, color_bar=color_bar
|
364
436
|
)
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
437
|
+
elif data is None and monitor is None:
|
438
|
+
# Setting appearance
|
439
|
+
if vrange is not None:
|
440
|
+
image.set_vrange(vmin=vrange[0], vmax=vrange[1])
|
441
|
+
if color_map is not None:
|
442
|
+
image.set_color_map(color_map)
|
370
443
|
else:
|
371
|
-
raise ValueError(
|
372
|
-
|
373
|
-
)
|
374
|
-
return waveform
|
444
|
+
raise ValueError("Invalid input. Provide either monitor name or custom data.")
|
445
|
+
return image
|
375
446
|
|
376
447
|
def image(
|
377
448
|
self,
|
@@ -405,23 +476,14 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
405
476
|
else:
|
406
477
|
image = self.add_image(color_bar=color_bar, **axis_kwargs)
|
407
478
|
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
)
|
417
|
-
elif data is None and monitor is None:
|
418
|
-
# Setting appearance
|
419
|
-
if vrange is not None:
|
420
|
-
image.set_vrange(vmin=vrange[0], vmax=vrange[1])
|
421
|
-
if color_map is not None:
|
422
|
-
image.set_color_map(color_map)
|
423
|
-
else:
|
424
|
-
raise ValueError("Invalid input. Provide either monitor name or custom data.")
|
479
|
+
image = self._init_image(
|
480
|
+
image=image,
|
481
|
+
monitor=monitor,
|
482
|
+
color_bar=color_bar,
|
483
|
+
color_map=color_map,
|
484
|
+
data=data,
|
485
|
+
vrange=vrange,
|
486
|
+
)
|
425
487
|
return image
|
426
488
|
|
427
489
|
def add_image(
|
@@ -472,22 +534,14 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
472
534
|
config=config,
|
473
535
|
**axis_kwargs,
|
474
536
|
)
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
)
|
484
|
-
elif data is None and monitor is None:
|
485
|
-
# Setting appearance
|
486
|
-
if vrange is not None:
|
487
|
-
image.set_vrange(vmin=vrange[0], vmax=vrange[1])
|
488
|
-
if color_map is not None:
|
489
|
-
image.set_color_map(color_map)
|
490
|
-
|
537
|
+
image = self._init_image(
|
538
|
+
image=image,
|
539
|
+
monitor=monitor,
|
540
|
+
color_bar=color_bar,
|
541
|
+
color_map=color_map,
|
542
|
+
data=data,
|
543
|
+
vrange=vrange,
|
544
|
+
)
|
491
545
|
return image
|
492
546
|
|
493
547
|
def motor_map(self, motor_x: str = None, motor_y: str = None, **axis_kwargs) -> BECMotorMap:
|
@@ -48,7 +48,6 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
48
48
|
"set_y_lim",
|
49
49
|
"set_grid",
|
50
50
|
"lock_aspect_ratio",
|
51
|
-
"plot",
|
52
51
|
"remove",
|
53
52
|
]
|
54
53
|
|
@@ -237,19 +236,6 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
237
236
|
"""
|
238
237
|
self.plot_item.setAspectLocked(lock)
|
239
238
|
|
240
|
-
def plot(self, data_x: list | np.ndarray, data_y: list | np.ndarray, **kwargs):
|
241
|
-
"""
|
242
|
-
Plot custom data on the plot widget. These data are not saved in config.
|
243
|
-
|
244
|
-
Args:
|
245
|
-
data_x(list|np.ndarray): x-axis data
|
246
|
-
data_y(list|np.ndarray): y-axis data
|
247
|
-
**kwargs: Keyword arguments for the plot.
|
248
|
-
"""
|
249
|
-
# TODO very basic so far, add more options
|
250
|
-
# TODO decide name of the method
|
251
|
-
self.plot_item.plot(data_x, data_y, **kwargs)
|
252
|
-
|
253
239
|
def remove(self):
|
254
240
|
"""Remove the plot widget from the figure."""
|
255
241
|
if self.figure is not None:
|
@@ -35,8 +35,7 @@ class BECWaveform(BECPlotBase):
|
|
35
35
|
USER_ACCESS = [
|
36
36
|
"rpc_id",
|
37
37
|
"config_dict",
|
38
|
-
"
|
39
|
-
"add_curve_custom",
|
38
|
+
"plot",
|
40
39
|
"remove_curve",
|
41
40
|
"scan_history",
|
42
41
|
"curves",
|
@@ -200,6 +199,57 @@ class BECWaveform(BECPlotBase):
|
|
200
199
|
else:
|
201
200
|
raise ValueError("Identifier must be either an integer (index) or a string (curve_id).")
|
202
201
|
|
202
|
+
def plot(
|
203
|
+
self,
|
204
|
+
x: list | np.ndarray | None = None,
|
205
|
+
y: list | np.ndarray | None = None,
|
206
|
+
x_name: str | None = None,
|
207
|
+
y_name: str | None = None,
|
208
|
+
z_name: str | None = None,
|
209
|
+
x_entry: str | None = None,
|
210
|
+
y_entry: str | None = None,
|
211
|
+
z_entry: str | None = None,
|
212
|
+
color: str | None = None,
|
213
|
+
color_map_z: str | None = "plasma",
|
214
|
+
label: str | None = None,
|
215
|
+
validate: bool = True,
|
216
|
+
) -> BECCurve:
|
217
|
+
"""
|
218
|
+
Plot a curve to the plot widget.
|
219
|
+
Args:
|
220
|
+
x(list | np.ndarray): Custom x data to plot.
|
221
|
+
y(list | np.ndarray): Custom y data to plot.
|
222
|
+
x_name(str): The name of the device for the x-axis.
|
223
|
+
y_name(str): The name of the device for the y-axis.
|
224
|
+
z_name(str): The name of the device for the z-axis.
|
225
|
+
x_entry(str): The name of the entry for the x-axis.
|
226
|
+
y_entry(str): The name of the entry for the y-axis.
|
227
|
+
z_entry(str): The name of the entry for the z-axis.
|
228
|
+
color(str): The color of the curve.
|
229
|
+
color_map_z(str): The color map to use for the z-axis.
|
230
|
+
label(str): The label of the curve.
|
231
|
+
validate(bool): If True, validate the device names and entries.
|
232
|
+
|
233
|
+
Returns:
|
234
|
+
BECCurve: The curve object.
|
235
|
+
"""
|
236
|
+
|
237
|
+
if x is not None and y is not None:
|
238
|
+
return self.add_curve_custom(x=x, y=y, label=label, color=color)
|
239
|
+
else:
|
240
|
+
return self.add_curve_scan(
|
241
|
+
x_name=x_name,
|
242
|
+
y_name=y_name,
|
243
|
+
z_name=z_name,
|
244
|
+
x_entry=x_entry,
|
245
|
+
y_entry=y_entry,
|
246
|
+
z_entry=z_entry,
|
247
|
+
color=color,
|
248
|
+
color_map_z=color_map_z,
|
249
|
+
label=label,
|
250
|
+
validate_bec=validate,
|
251
|
+
)
|
252
|
+
|
203
253
|
def add_curve_custom(
|
204
254
|
self,
|
205
255
|
x: list | np.ndarray,
|
@@ -252,33 +302,6 @@ class BECWaveform(BECPlotBase):
|
|
252
302
|
)
|
253
303
|
return curve
|
254
304
|
|
255
|
-
def _add_curve_object(
|
256
|
-
self,
|
257
|
-
name: str,
|
258
|
-
source: str,
|
259
|
-
config: CurveConfig,
|
260
|
-
data: tuple[list | np.ndarray, list | np.ndarray] = None,
|
261
|
-
) -> BECCurve:
|
262
|
-
"""
|
263
|
-
Add a curve object to the plot widget.
|
264
|
-
|
265
|
-
Args:
|
266
|
-
name(str): ID of the curve.
|
267
|
-
source(str): Source of the curve.
|
268
|
-
config(CurveConfig): Configuration of the curve.
|
269
|
-
data(tuple[list|np.ndarray,list|np.ndarray], optional): Data (x,y) to be plotted. Defaults to None.
|
270
|
-
|
271
|
-
Returns:
|
272
|
-
BECCurve: The curve object.
|
273
|
-
"""
|
274
|
-
curve = BECCurve(config=config, name=name, parent_item=self.plot_item)
|
275
|
-
self._curves_data[source][name] = curve
|
276
|
-
self.plot_item.addItem(curve)
|
277
|
-
self.config.curves[name] = curve.config
|
278
|
-
if data is not None:
|
279
|
-
curve.setData(data[0], data[1])
|
280
|
-
return curve
|
281
|
-
|
282
305
|
def add_curve_scan(
|
283
306
|
self,
|
284
307
|
x_name: str,
|
@@ -354,6 +377,33 @@ class BECWaveform(BECPlotBase):
|
|
354
377
|
curve = self._add_curve_object(name=label, source=curve_source, config=curve_config)
|
355
378
|
return curve
|
356
379
|
|
380
|
+
def _add_curve_object(
|
381
|
+
self,
|
382
|
+
name: str,
|
383
|
+
source: str,
|
384
|
+
config: CurveConfig,
|
385
|
+
data: tuple[list | np.ndarray, list | np.ndarray] = None,
|
386
|
+
) -> BECCurve:
|
387
|
+
"""
|
388
|
+
Add a curve object to the plot widget.
|
389
|
+
|
390
|
+
Args:
|
391
|
+
name(str): ID of the curve.
|
392
|
+
source(str): Source of the curve.
|
393
|
+
config(CurveConfig): Configuration of the curve.
|
394
|
+
data(tuple[list|np.ndarray,list|np.ndarray], optional): Data (x,y) to be plotted. Defaults to None.
|
395
|
+
|
396
|
+
Returns:
|
397
|
+
BECCurve: The curve object.
|
398
|
+
"""
|
399
|
+
curve = BECCurve(config=config, name=name, parent_item=self.plot_item)
|
400
|
+
self._curves_data[source][name] = curve
|
401
|
+
self.plot_item.addItem(curve)
|
402
|
+
self.config.curves[name] = curve.config
|
403
|
+
if data is not None:
|
404
|
+
curve.setData(data[0], data[1])
|
405
|
+
return curve
|
406
|
+
|
357
407
|
def _validate_signal_entries(
|
358
408
|
self,
|
359
409
|
x_name: str,
|
@@ -114,32 +114,75 @@ class Ring(BECConnector):
|
|
114
114
|
self.set_connections(self.config.connections.slot, self.config.connections.endpoint)
|
115
115
|
|
116
116
|
def set_value(self, value: int | float):
|
117
|
+
"""
|
118
|
+
Set the value for the ring widget
|
119
|
+
|
120
|
+
Args:
|
121
|
+
value(int | float): Value for the ring widget
|
122
|
+
"""
|
117
123
|
self.config.value = round(
|
118
124
|
float(max(self.config.min_value, min(self.config.max_value, value))),
|
119
125
|
self.config.precision,
|
120
126
|
)
|
121
127
|
|
122
128
|
def set_color(self, color: str | tuple):
|
129
|
+
"""
|
130
|
+
Set the color for the ring widget
|
131
|
+
|
132
|
+
Args:
|
133
|
+
color(str | tuple): Color for the ring widget. Can be HEX code or tuple (R, G, B, A).
|
134
|
+
"""
|
123
135
|
self.config.color = color
|
124
136
|
self.color = self.convert_color(color)
|
125
137
|
|
126
138
|
def set_background(self, color: str | tuple):
|
139
|
+
"""
|
140
|
+
Set the background color for the ring widget
|
141
|
+
|
142
|
+
Args:
|
143
|
+
color(str | tuple): Background color for the ring widget. Can be HEX code or tuple (R, G, B, A).
|
144
|
+
"""
|
127
145
|
self.config.background_color = color
|
128
146
|
self.color = self.convert_color(color)
|
129
147
|
|
130
148
|
def set_line_width(self, width: int):
|
149
|
+
"""
|
150
|
+
Set the line width for the ring widget
|
151
|
+
|
152
|
+
Args:
|
153
|
+
width(int): Line width for the ring widget
|
154
|
+
"""
|
131
155
|
self.config.line_width = width
|
132
156
|
|
133
157
|
def set_min_max_values(self, min_value: int | float, max_value: int | float):
|
158
|
+
"""
|
159
|
+
Set the min and max values for the ring widget.
|
160
|
+
|
161
|
+
Args:
|
162
|
+
min_value(int | float): Minimum value for the ring widget
|
163
|
+
max_value(int | float): Maximum value for the ring widget
|
164
|
+
"""
|
134
165
|
self.config.min_value = min_value
|
135
166
|
self.config.max_value = max_value
|
136
167
|
|
137
168
|
def set_start_angle(self, start_angle: int):
|
169
|
+
"""
|
170
|
+
Set the start angle for the ring widget
|
171
|
+
|
172
|
+
Args:
|
173
|
+
start_angle(int): Start angle for the ring widget in degrees
|
174
|
+
"""
|
138
175
|
self.config.start_position = start_angle
|
139
176
|
self.start_position = start_angle * 16
|
140
177
|
|
141
178
|
@staticmethod
|
142
179
|
def convert_color(color):
|
180
|
+
"""
|
181
|
+
Convert the color to QColor
|
182
|
+
|
183
|
+
Args:
|
184
|
+
color(str | tuple): Color for the ring widget. Can be HEX code or tuple (R, G, B, A).
|
185
|
+
"""
|
143
186
|
converted_color = None
|
144
187
|
if isinstance(color, str):
|
145
188
|
converted_color = QtGui.QColor(color)
|
@@ -149,7 +192,11 @@ class Ring(BECConnector):
|
|
149
192
|
|
150
193
|
def set_update(self, mode: Literal["manual", "scan", "device"], device: str = None):
|
151
194
|
"""
|
152
|
-
Set the update mode for the ring widget
|
195
|
+
Set the update mode for the ring widget.
|
196
|
+
Modes:
|
197
|
+
- "manual": Manual update mode, the value is set by the user.
|
198
|
+
- "scan": Update mode for the scan progress. The value is updated by the current scan progress.
|
199
|
+
- "device": Update mode for the device readback. The value is updated by the device readback. Take into account that user has to set the device name and limits.
|
153
200
|
|
154
201
|
Args:
|
155
202
|
mode(str): Update mode for the ring widget. Can be "manual", "scan" or "device"
|
@@ -169,6 +216,13 @@ class Ring(BECConnector):
|
|
169
216
|
self.parent_progress_widget.enable_auto_updates(False)
|
170
217
|
|
171
218
|
def set_connections(self, slot: str, endpoint: str | EndpointInfo):
|
219
|
+
"""
|
220
|
+
Set the connections for the ring widget
|
221
|
+
|
222
|
+
Args:
|
223
|
+
slot(str): Slot for the ring widget update. Can be "on_scan_progress" or "on_device_readback".
|
224
|
+
endpoint(str | EndpointInfo): Endpoint for the ring widget update. Endpoint has to match the slot type.
|
225
|
+
"""
|
172
226
|
if self.config.connections.endpoint == endpoint and self.config.connections.slot == slot:
|
173
227
|
return
|
174
228
|
else:
|
@@ -179,12 +233,22 @@ class Ring(BECConnector):
|
|
179
233
|
self.bec_dispatcher.connect_slot(getattr(self, slot), endpoint)
|
180
234
|
|
181
235
|
def reset_connection(self):
|
236
|
+
"""
|
237
|
+
Reset the connections for the ring widget. Disconnect the current slot and endpoint.
|
238
|
+
"""
|
182
239
|
self.bec_dispatcher.disconnect_slot(
|
183
240
|
self.config.connections.slot, self.config.connections.endpoint
|
184
241
|
)
|
185
242
|
self.config.connections = RingConnections()
|
186
243
|
|
187
244
|
def on_scan_progress(self, msg, meta):
|
245
|
+
"""
|
246
|
+
Update the ring widget with the scan progress.
|
247
|
+
|
248
|
+
Args:
|
249
|
+
msg(dict): Message with the scan progress
|
250
|
+
meta(dict): Metadata for the message
|
251
|
+
"""
|
188
252
|
current_RID = meta.get("RID", None)
|
189
253
|
if current_RID != self.RID:
|
190
254
|
self.set_min_max_values(0, msg.get("max_value", 100))
|
@@ -192,6 +256,13 @@ class Ring(BECConnector):
|
|
192
256
|
self.parent_progress_widget.update()
|
193
257
|
|
194
258
|
def on_device_readback(self, msg, meta):
|
259
|
+
"""
|
260
|
+
Update the ring widget with the device readback.
|
261
|
+
|
262
|
+
Args:
|
263
|
+
msg(dict): Message with the device readback
|
264
|
+
meta(dict): Metadata for the message
|
265
|
+
"""
|
195
266
|
if isinstance(self.config.connections.endpoint, EndpointInfo):
|
196
267
|
endpoint = self.config.connections.endpoint.endpoint
|
197
268
|
else:
|
@@ -464,6 +464,13 @@ class SpiralProgressBar(BECConnector, QWidget):
|
|
464
464
|
|
465
465
|
@Slot(dict, dict)
|
466
466
|
def on_scan_queue_status(self, msg, meta):
|
467
|
+
"""
|
468
|
+
Slot to handle scan queue status messages. Decides what update to perform based on the scan queue status.
|
469
|
+
|
470
|
+
Args:
|
471
|
+
msg(dict): Message from the BEC.
|
472
|
+
meta(dict): Metadata from the BEC.
|
473
|
+
"""
|
467
474
|
primary_queue = msg.get("queue").get("primary")
|
468
475
|
info = primary_queue.get("info", None)
|
469
476
|
|
@@ -490,6 +497,12 @@ class SpiralProgressBar(BECConnector, QWidget):
|
|
490
497
|
# print("hook device_progress")
|
491
498
|
|
492
499
|
def _hook_scan_progress(self, ring_index: int = None):
|
500
|
+
"""
|
501
|
+
Hook the scan progress to the progress bars.
|
502
|
+
|
503
|
+
Args:
|
504
|
+
ring_index(int): Index of the progress bar to hook the scan progress to.
|
505
|
+
"""
|
493
506
|
if ring_index is not None:
|
494
507
|
ring = self._find_ring_by_index(ring_index)
|
495
508
|
else:
|
@@ -501,6 +514,15 @@ class SpiralProgressBar(BECConnector, QWidget):
|
|
501
514
|
ring.set_connections("on_scan_progress", MessageEndpoints.scan_progress())
|
502
515
|
|
503
516
|
def _hook_readback(self, bar_index: int, device: str, min: float | int, max: float | int):
|
517
|
+
"""
|
518
|
+
Hook the readback values to the progress bars.
|
519
|
+
|
520
|
+
Args:
|
521
|
+
bar_index(int): Index of the progress bar to hook the readback values to.
|
522
|
+
device(str): Device to readback values from.
|
523
|
+
min(float|int): Minimum value for the progress bar.
|
524
|
+
max(float|int): Maximum value for the progress bar.
|
525
|
+
"""
|
504
526
|
ring = self._find_ring_by_index(bar_index)
|
505
527
|
ring.set_min_max_values(min, max)
|
506
528
|
endpoint = MessageEndpoints.device_readback(device)
|
@@ -2,11 +2,11 @@
|
|
2
2
|
.gitlab-ci.yml,sha256=RF2JeGh8tG09DyAOwEu991IZy3C8Vm6lI8O_4Dr9B9Q,12239
|
3
3
|
.pylintrc,sha256=OstrgmEyP0smNFBKoIN5_26-UmNZgMHnbjvAWX0UrLs,18535
|
4
4
|
.readthedocs.yaml,sha256=aSOc277LqXcsTI6lgvm_JY80lMlr69GbPKgivua2cS0,603
|
5
|
-
CHANGELOG.md,sha256=
|
5
|
+
CHANGELOG.md,sha256=PBUKv3Symz1kDLb8arybg5eBIhTCCqgW09Sh45Bo7rc,7209
|
6
6
|
LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
|
7
|
-
PKG-INFO,sha256=
|
7
|
+
PKG-INFO,sha256=W1IkNBUfxaDv1yzQ94gfD1NSm1CF3FAmJwlMYzn7was,1178
|
8
8
|
README.md,sha256=y4jB6wvArS7N8_iTbKWnSM_oRAqLA2GqgzUR-FMh5sU,2645
|
9
|
-
pyproject.toml,sha256=
|
9
|
+
pyproject.toml,sha256=tKe6Rt9bkUN4Pj1OuLyr5AuOLho0b0s0PaGU0xSOBg4,1822
|
10
10
|
.git_hooks/pre-commit,sha256=n3RofIZHJl8zfJJIUomcMyYGFi_rwq4CC19z0snz3FI,286
|
11
11
|
.gitlab/issue_templates/bug_report_template.md,sha256=gAuyEwl7XlnebBrkiJ9AqffSNOywmr8vygUFWKTuQeI,386
|
12
12
|
.gitlab/issue_templates/documentation_update_template.md,sha256=FHLdb3TS_D9aL4CYZCjyXSulbaW5mrN2CmwTaeLPbNw,860
|
@@ -17,7 +17,7 @@ bec_widgets/assets/bec_widgets_icon.png,sha256=K8dgGwIjalDh9PRHUsSQBqgdX7a00nM3i
|
|
17
17
|
bec_widgets/assets/terminal_icon.png,sha256=bJl7Tft4Fi2uxvuXI8o14uMHnI9eAWKSU2uftXCH9ws,3889
|
18
18
|
bec_widgets/cli/__init__.py,sha256=tLD8HWgyURhMjYlKZ43pBu-qvGD1LI5o3n3rEieg-70,43
|
19
19
|
bec_widgets/cli/auto_updates.py,sha256=8x4_SrD8Hh1RbrUWXLfisw6X5v8Mij2DiTfjvn9dkUw,4692
|
20
|
-
bec_widgets/cli/client.py,sha256=
|
20
|
+
bec_widgets/cli/client.py,sha256=3GiSipBcjFvQunvevSgxGgriK1dslqpu-0A5WWFN_fA,55076
|
21
21
|
bec_widgets/cli/client_utils.py,sha256=7u8P9EYgLPJuAcHxnFiZi-gCZohO3vAn0W7dqsSrs4M,10660
|
22
22
|
bec_widgets/cli/generate_cli.py,sha256=tBt-F4Xccg9Pj2zuDEGHd0Ho1fKLfCf3PuSa8KmelQk,4431
|
23
23
|
bec_widgets/cli/rpc_register.py,sha256=QxXUZu5XNg00Yf5O3UHWOXg3-f_pzKjjoZYMOa-MOJc,2216
|
@@ -25,7 +25,7 @@ bec_widgets/cli/rpc_wigdet_handler.py,sha256=OXHoiDFJPzbQ5RO0bzIX5aUXeMMlJTwAiTm
|
|
25
25
|
bec_widgets/cli/server.py,sha256=rsj31Vsx6ayThNe4PQelQFahGjYXFZjfrNyB2fnm6Ro,5737
|
26
26
|
bec_widgets/examples/__init__.py,sha256=WWQ0cu7m8sA4Ehy-DWdTIqSISjaHsbxhsNmNrMnhDZU,202
|
27
27
|
bec_widgets/examples/jupyter_console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
|
-
bec_widgets/examples/jupyter_console/jupyter_console_window.py,sha256=
|
28
|
+
bec_widgets/examples/jupyter_console/jupyter_console_window.py,sha256=Rnr6bO-cue1AuT5IyUsBw5gXGeyuEQFqLpA1sx_-Kcs,5339
|
29
29
|
bec_widgets/examples/jupyter_console/jupyter_console_window.ui,sha256=2A2mNTUMZBYygz8K4qWzrcjnNqZBMVyeHm26iLZVRWI,1473
|
30
30
|
bec_widgets/examples/motor_movement/__init__.py,sha256=LzPJkxLAxOsZCbXR-fRCPmeYobp7Yqds6tDxW4W1gSw,214
|
31
31
|
bec_widgets/examples/motor_movement/motor_control_compilations.py,sha256=8rpA7a2xVZTDMrx7YQIj3IJew78J1gcVMkHvloS0U_Q,9055
|
@@ -51,17 +51,17 @@ bec_widgets/widgets/dock/__init__.py,sha256=B7foHt02gnhM7mFksa7GJVwT7n0j_JvYDCt6
|
|
51
51
|
bec_widgets/widgets/dock/dock.py,sha256=HCr0MeXljzIFOSuHuWfTz_B5str03pjkKXPX8PCrJ9c,9010
|
52
52
|
bec_widgets/widgets/dock/dock_area.py,sha256=zupu05KHrrdUlNNQe-x9zC-bXDk-qPXvr_mONCm-JwI,7759
|
53
53
|
bec_widgets/widgets/figure/__init__.py,sha256=3hGx_KOV7QHCYAV06aNuUgKq4QIYCjUTad-DrwkUaBM,44
|
54
|
-
bec_widgets/widgets/figure/figure.py,sha256=
|
54
|
+
bec_widgets/widgets/figure/figure.py,sha256=O--r3dyeOPXndV2400wpE9lPdBezzd0ZUt7yA2u2n0A,31468
|
55
55
|
bec_widgets/widgets/figure/plots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
56
|
-
bec_widgets/widgets/figure/plots/plot_base.py,sha256=
|
56
|
+
bec_widgets/widgets/figure/plots/plot_base.py,sha256=R3wiO88ZmATRy9kJoLvj_7BmkMSyayNkzrSOJzJHvtk,7994
|
57
57
|
bec_widgets/widgets/figure/plots/image/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
58
|
-
bec_widgets/widgets/figure/plots/image/image.py,sha256
|
58
|
+
bec_widgets/widgets/figure/plots/image/image.py,sha256=-rxCt1IXmS2XQu0dS0SSXAF8VaxacSmQ-_kDsFxbPm4,19653
|
59
59
|
bec_widgets/widgets/figure/plots/image/image_item.py,sha256=1oytCY2IIgRbtS3GRrp9JV02KOif78O2-iaK0qYuHFU,9058
|
60
60
|
bec_widgets/widgets/figure/plots/image/image_processor.py,sha256=59JwHMEBjLo72fmrAB7W1PFBT2oBe16heBaZfYM6MAk,4368
|
61
61
|
bec_widgets/widgets/figure/plots/motor_map/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
62
62
|
bec_widgets/widgets/figure/plots/motor_map/motor_map.py,sha256=Ff2WoNHxO_A3ggsbSd_AVUP1JeOWMuJs-0GLskxn-94,15267
|
63
63
|
bec_widgets/widgets/figure/plots/waveform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
64
|
-
bec_widgets/widgets/figure/plots/waveform/waveform.py,sha256=
|
64
|
+
bec_widgets/widgets/figure/plots/waveform/waveform.py,sha256=DgnUdH3wj0uyvZvK9jqdDKaRwPoadf14VZ4g1TOXY5A,23511
|
65
65
|
bec_widgets/widgets/figure/plots/waveform/waveform_curve.py,sha256=9q7nJfyH8y9rWw_AIOd6tk7cbckoAGNLHv2oHEKCCyo,7229
|
66
66
|
bec_widgets/widgets/jupyter_console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
67
67
|
bec_widgets/widgets/jupyter_console/jupyter_console.py,sha256=ioLYJL31RdBoAOGFSS8PVSnUhkWPWmLC3tiKp7CouO8,2251
|
@@ -82,8 +82,8 @@ bec_widgets/widgets/motor_control/selection/selection.ui,sha256=vXXpvNWuL6xyHhW7
|
|
82
82
|
bec_widgets/widgets/scan_control/__init__.py,sha256=IOfHl15vxb_uC6KN62-PeUzbBha_vQyqkkXbJ2HU674,38
|
83
83
|
bec_widgets/widgets/scan_control/scan_control.py,sha256=B5n2U2iVtTCY3Tx93JyBqzGCDCmWhWwAOhbPelLI-bs,17168
|
84
84
|
bec_widgets/widgets/spiral_progress_bar/__init__.py,sha256=4efbtcqCToMIw5bkQrTzy2TzuBCXvlhuUPh1bYC_Yzg,51
|
85
|
-
bec_widgets/widgets/spiral_progress_bar/ring.py,sha256=
|
86
|
-
bec_widgets/widgets/spiral_progress_bar/spiral_progress_bar.py,sha256=
|
85
|
+
bec_widgets/widgets/spiral_progress_bar/ring.py,sha256=JUx2TDH5eh1x9tWCkIkis9Tvo5P27gqFcszxVxSq7Ho,10469
|
86
|
+
bec_widgets/widgets/spiral_progress_bar/spiral_progress_bar.py,sha256=OQzJiR0Fd4fWop4ojykEKtXVqeLL0WLNSBdhf7JvLsc,24386
|
87
87
|
bec_widgets/widgets/toolbar/__init__.py,sha256=d-TP4_cr_VbpwreMM4ePnfZ5YXsEPQ45ibEf75nuGoE,36
|
88
88
|
bec_widgets/widgets/toolbar/toolbar.py,sha256=e0zCD_0q7K4NVhrzD8001Qvfxt-VhqHTgofchS9NgCM,5125
|
89
89
|
docs/Makefile,sha256=i2WHuFlgfyAPEW4ssEP8NY4cOibDJrVjvzSEU8_Ggwc,634
|
@@ -113,7 +113,7 @@ docs/user/getting_started/getting_started.md,sha256=lxZXCr6HAkM61oo5Bu-YjINSKo4w
|
|
113
113
|
docs/user/getting_started/gui_complex_gui.gif,sha256=ovv9u371BGG5GqhzyBMl4mvqMHLfJS0ylr-dR0Ydwtw,6550393
|
114
114
|
docs/user/getting_started/installation.md,sha256=nBl2Hfvo6ua3-tVZn1B-UG0hCTlrFY6_ibXHWnXeegs,1135
|
115
115
|
docs/user/getting_started/quick_start.md,sha256=MNXEaww5hiQY7N7AQhrmbxdYQHimFk_iKQW8tS-72cU,9337
|
116
|
-
docs/user/widgets/bec_figure.md,sha256=
|
116
|
+
docs/user/widgets/bec_figure.md,sha256=371T59CniH1pv2MT796kywfwYgWRBHPh17ixEWIcfVc,5093
|
117
117
|
docs/user/widgets/image_plot.gif,sha256=_mVFhMTXGqwDOcEtrBHMZj5Thn2sLhDAHEeL2XyHN-s,14098977
|
118
118
|
docs/user/widgets/motor.gif,sha256=FtaWdRHx4UZaGJPpq8LNhMMgX4PFcAB6IZ93JCMEh_w,2280719
|
119
119
|
docs/user/widgets/progress_bar.gif,sha256=5jh0Zw2BBGPuNxszV1DBLJCb4_6glIRX-U2ABjnsK2k,5263592
|
@@ -125,8 +125,8 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
125
125
|
tests/end-2-end/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
126
126
|
tests/end-2-end/conftest.py,sha256=taLqiYVzOhJjMre5ypgQjB7wzSXP4soKANW3XfAjems,1773
|
127
127
|
tests/end-2-end/test_bec_dock_rpc_e2e.py,sha256=G-YBfOhJCyV6g74mxXuhAPA9E_BPQ6EUT6xS278aq34,8865
|
128
|
-
tests/end-2-end/test_bec_figure_rpc_e2e.py,sha256=
|
129
|
-
tests/end-2-end/test_rpc_register_e2e.py,sha256=
|
128
|
+
tests/end-2-end/test_bec_figure_rpc_e2e.py,sha256=zTbB_F4Fs-QG8KhMK24xfsrCQBgZUAguMk3KFdEdP2o,5095
|
129
|
+
tests/end-2-end/test_rpc_register_e2e.py,sha256=3dfCnSvdcRO92pzHt9WlCTK0vzTKAvPtliEoEKrtuzQ,1604
|
130
130
|
tests/unit_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
131
131
|
tests/unit_tests/client_mocks.py,sha256=ErrklY7446jXE2_XGKebs_a-2Pqif5ECOPvxVAKRZXY,4170
|
132
132
|
tests/unit_tests/conftest.py,sha256=KrnktXPWmZhnKNue-xGWOLD1XGEvdz9Vf7V2eO3XQ3A,596
|
@@ -151,7 +151,7 @@ tests/unit_tests/test_configs/config_device_no_entry.yaml,sha256=hdvue9KLc_kfNzG
|
|
151
151
|
tests/unit_tests/test_configs/config_scan.yaml,sha256=vo484BbWOjA_e-h6bTjSV9k7QaQHrlAvx-z8wtY-P4E,1915
|
152
152
|
tests/unit_tests/test_msgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
153
153
|
tests/unit_tests/test_msgs/available_scans_message.py,sha256=m_z97hIrjHXXMa2Ex-UvsPmTxOYXfjxyJaGkIY6StTY,46532
|
154
|
-
bec_widgets-0.57.
|
155
|
-
bec_widgets-0.57.
|
156
|
-
bec_widgets-0.57.
|
157
|
-
bec_widgets-0.57.
|
154
|
+
bec_widgets-0.57.6.dist-info/METADATA,sha256=W1IkNBUfxaDv1yzQ94gfD1NSm1CF3FAmJwlMYzn7was,1178
|
155
|
+
bec_widgets-0.57.6.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
156
|
+
bec_widgets-0.57.6.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
|
157
|
+
bec_widgets-0.57.6.dist-info/RECORD,,
|
docs/user/widgets/bec_figure.md
CHANGED
@@ -22,7 +22,7 @@ The following code snipped demonstrates how to create a 1D waveform plot using B
|
|
22
22
|
# adds a new dock, a new BECFigure and a BECWaveForm to the dock
|
23
23
|
plt = gui.add_dock().add_widget('BECFigure').plot('samx', 'bpm4i')
|
24
24
|
# add a second curve to the same plot
|
25
|
-
plt.
|
25
|
+
plt.plot(x_name='samx', y_name='bpm3i')
|
26
26
|
plt.set_title("Gauss plots vs. samx")
|
27
27
|
plt.set_x_label("Motor X")
|
28
28
|
plt.set_y_label("Gauss Signal (A.U.")
|
@@ -53,7 +53,7 @@ dev.bpm3i.sim.select_sim_model("StepModel")
|
|
53
53
|
The following code snipped demonstrates how to create a 2D scatter plot using BEC Widgets within BEC.
|
54
54
|
```python
|
55
55
|
# adds a new dock, a new BECFigure and a BECWaveForm to the dock
|
56
|
-
plt = gui.add_dock().add_widget('BECFigure').add_plot('samx', 'samy', 'bpm4i')
|
56
|
+
plt = gui.add_dock().add_widget('BECFigure').add_plot(x_name='samx', y_name='samy', z_name='bpm4i')
|
57
57
|
```
|
58
58
|
|
59
59
|
(user.widgets.motor_map)=
|
pyproject.toml
CHANGED
@@ -9,7 +9,7 @@ def test_rpc_waveform1d_custom_curve(rpc_server_figure):
|
|
9
9
|
fig = BECFigure(rpc_server_figure)
|
10
10
|
|
11
11
|
ax = fig.add_plot()
|
12
|
-
curve = ax.
|
12
|
+
curve = ax.plot(x=[1, 2, 3], y=[1, 2, 3])
|
13
13
|
curve.set_color("red")
|
14
14
|
curve = ax.curves[0]
|
15
15
|
curve.set_color("blue")
|
@@ -24,7 +24,7 @@ def test_rpc_plotting_shortcuts_init_configs(rpc_server_figure, qtbot):
|
|
24
24
|
plt = fig.plot(x_name="samx", y_name="bpm4i")
|
25
25
|
im = fig.image("eiger")
|
26
26
|
motor_map = fig.motor_map("samx", "samy")
|
27
|
-
plt_z = fig.add_plot("samx", "samy", "bpm4i")
|
27
|
+
plt_z = fig.add_plot(x_name="samx", y_name="samy", z_name="bpm4i")
|
28
28
|
|
29
29
|
# Checking if classes are correctly initialised
|
30
30
|
assert len(fig.widgets) == 4
|
@@ -9,7 +9,7 @@ def test_rpc_register_list_connections(rpc_server_figure):
|
|
9
9
|
plt = fig.plot(x_name="samx", y_name="bpm4i")
|
10
10
|
im = fig.image("eiger")
|
11
11
|
motor_map = fig.motor_map("samx", "samy")
|
12
|
-
plt_z = fig.add_plot("samx", "samy", "bpm4i")
|
12
|
+
plt_z = fig.add_plot(x_name="samx", y_name="samy", z_name="bpm4i")
|
13
13
|
|
14
14
|
# keep only class names from objects, since objects on server and client are different
|
15
15
|
# so the best we can do is to compare types (rpc register is unit-tested elsewhere)
|
File without changes
|
File without changes
|