bec-widgets 0.51.0__py3-none-any.whl → 0.52.1__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.
- bec_widgets/cli/__init__.py +1 -1
- bec_widgets/cli/bec_widgets_icon.png +0 -0
- bec_widgets/cli/client.py +328 -5
- bec_widgets/cli/client_utils.py +17 -5
- bec_widgets/cli/generate_cli.py +7 -3
- bec_widgets/cli/rpc_register.py +4 -0
- bec_widgets/cli/rpc_wigdet_handler.py +27 -0
- bec_widgets/cli/server.py +34 -9
- bec_widgets/examples/jupyter_console/jupyter_console_window.py +54 -2
- bec_widgets/examples/jupyter_console/jupyter_console_window.ui +26 -2
- bec_widgets/examples/jupyter_console/terminal_icon.png +0 -0
- bec_widgets/utils/__init__.py +1 -0
- bec_widgets/utils/bec_connector.py +18 -3
- bec_widgets/utils/bec_table.py +1 -0
- bec_widgets/utils/container_utils.py +3 -0
- bec_widgets/utils/crosshair.py +1 -0
- bec_widgets/utils/entry_validator.py +2 -0
- bec_widgets/utils/layout_manager.py +121 -0
- bec_widgets/utils/widget_io.py +5 -0
- bec_widgets/utils/yaml_dialog.py +2 -0
- bec_widgets/validation/monitor_config_validator.py +2 -1
- bec_widgets/widgets/__init__.py +1 -0
- bec_widgets/widgets/dock/__init__.py +2 -0
- bec_widgets/widgets/dock/dock.py +269 -0
- bec_widgets/widgets/dock/dock_area.py +225 -0
- bec_widgets/widgets/figure/figure.py +45 -16
- bec_widgets/widgets/plots/__init__.py +1 -1
- bec_widgets/widgets/plots/image.py +46 -9
- bec_widgets/widgets/plots/motor_map.py +17 -3
- bec_widgets/widgets/plots/plot_base.py +14 -3
- bec_widgets/widgets/plots/waveform.py +37 -10
- bec_widgets/widgets/scan_control/scan_control.py +10 -2
- bec_widgets/widgets/toolbar/toolbar.py +1 -0
- {bec_widgets-0.51.0.dist-info → bec_widgets-0.52.1.dist-info}/METADATA +1 -1
- {bec_widgets-0.51.0.dist-info → bec_widgets-0.52.1.dist-info}/RECORD +46 -40
- tests/end-2-end/conftest.py +19 -4
- tests/end-2-end/test_bec_dock_rpc_e2e.py +145 -0
- tests/end-2-end/test_bec_figure_rpc_e2e.py +17 -17
- tests/end-2-end/test_rpc_register_e2e.py +3 -3
- tests/unit_tests/test_bec_dock.py +114 -0
- tests/unit_tests/test_bec_figure.py +20 -22
- tests/unit_tests/test_generate_cli_client.py +1 -1
- tests/unit_tests/test_waveform1d.py +1 -1
- bec_widgets/simulations/__init__.py +0 -0
- bec_widgets/utils/ctrl_c.py +0 -39
- {bec_widgets-0.51.0.dist-info → bec_widgets-0.52.1.dist-info}/LICENSE +0 -0
- {bec_widgets-0.51.0.dist-info → bec_widgets-0.52.1.dist-info}/WHEEL +0 -0
- {bec_widgets-0.51.0.dist-info → bec_widgets-0.52.1.dist-info}/top_level.txt +0 -0
@@ -13,11 +13,11 @@ from qtpy.QtCore import Slot as pyqtSlot
|
|
13
13
|
from qtpy.QtWidgets import QWidget
|
14
14
|
|
15
15
|
from bec_widgets.utils import EntryValidator
|
16
|
-
from bec_widgets.widgets.plots.plot_base import BECPlotBase,
|
16
|
+
from bec_widgets.widgets.plots.plot_base import BECPlotBase, SubplotConfig
|
17
17
|
from bec_widgets.widgets.plots.waveform import Signal, SignalData
|
18
18
|
|
19
19
|
|
20
|
-
class MotorMapConfig(
|
20
|
+
class MotorMapConfig(SubplotConfig):
|
21
21
|
signals: Optional[Signal] = Field(None, description="Signals of the motor map")
|
22
22
|
color_map: Optional[str] = Field(
|
23
23
|
"Greys", description="Color scheme of the motor position gradient."
|
@@ -102,6 +102,7 @@ class BECMotorMap(BECPlotBase):
|
|
102
102
|
) -> None:
|
103
103
|
"""
|
104
104
|
Change the active motors for the plot.
|
105
|
+
|
105
106
|
Args:
|
106
107
|
motor_x(str): Motor name for the X axis.
|
107
108
|
motor_y(str): Motor name for the Y axis.
|
@@ -145,6 +146,7 @@ class BECMotorMap(BECPlotBase):
|
|
145
146
|
def set_max_points(self, max_points: int) -> None:
|
146
147
|
"""
|
147
148
|
Set the maximum number of points to display.
|
149
|
+
|
148
150
|
Args:
|
149
151
|
max_points(int): Maximum number of points to display.
|
150
152
|
"""
|
@@ -153,6 +155,7 @@ class BECMotorMap(BECPlotBase):
|
|
153
155
|
def set_precision(self, precision: int) -> None:
|
154
156
|
"""
|
155
157
|
Set the decimal precision of the motor position.
|
158
|
+
|
156
159
|
Args:
|
157
160
|
precision(int): Decimal precision of the motor position.
|
158
161
|
"""
|
@@ -161,6 +164,7 @@ class BECMotorMap(BECPlotBase):
|
|
161
164
|
def set_num_dim_points(self, num_dim_points: int) -> None:
|
162
165
|
"""
|
163
166
|
Set the number of dim points for the motor map.
|
167
|
+
|
164
168
|
Args:
|
165
169
|
num_dim_points(int): Number of dim points.
|
166
170
|
"""
|
@@ -169,6 +173,7 @@ class BECMotorMap(BECPlotBase):
|
|
169
173
|
def set_background_value(self, background_value: int) -> None:
|
170
174
|
"""
|
171
175
|
Set the background value of the motor map.
|
176
|
+
|
172
177
|
Args:
|
173
178
|
background_value(int): Background value of the motor map.
|
174
179
|
"""
|
@@ -177,6 +182,7 @@ class BECMotorMap(BECPlotBase):
|
|
177
182
|
def set_scatter_size(self, scatter_size: int) -> None:
|
178
183
|
"""
|
179
184
|
Set the scatter size of the motor map plot.
|
185
|
+
|
180
186
|
Args:
|
181
187
|
scatter_size(int): Size of the scatter points.
|
182
188
|
"""
|
@@ -247,6 +253,7 @@ class BECMotorMap(BECPlotBase):
|
|
247
253
|
def _add_coordinantes_crosshair(self, x: float, y: float) -> None:
|
248
254
|
"""
|
249
255
|
Add crosshair to the plot to highlight the current position.
|
256
|
+
|
250
257
|
Args:
|
251
258
|
x(float): X coordinate.
|
252
259
|
y(float): Y coordinate.
|
@@ -274,6 +281,7 @@ class BECMotorMap(BECPlotBase):
|
|
274
281
|
def _make_limit_map(self, limits_x: list, limits_y: list) -> pg.ImageItem:
|
275
282
|
"""
|
276
283
|
Create a limit map for the motor map plot.
|
284
|
+
|
277
285
|
Args:
|
278
286
|
limits_x(list): Motor limits for the x axis.
|
279
287
|
limits_y(list): Motor limits for the y axis.
|
@@ -303,10 +311,12 @@ class BECMotorMap(BECPlotBase):
|
|
303
311
|
def _get_motor_init_position(self, name: str, entry: str, precision: int) -> float:
|
304
312
|
"""
|
305
313
|
Get the motor initial position from the config.
|
314
|
+
|
306
315
|
Args:
|
307
316
|
name(str): Motor name.
|
308
317
|
entry(str): Motor entry.
|
309
318
|
precision(int): Decimal precision of the motor position.
|
319
|
+
|
310
320
|
Returns:
|
311
321
|
float: Motor initial position.
|
312
322
|
"""
|
@@ -323,12 +333,14 @@ class BECMotorMap(BECPlotBase):
|
|
323
333
|
) -> tuple[str, str]:
|
324
334
|
"""
|
325
335
|
Validate the signal name and entry.
|
336
|
+
|
326
337
|
Args:
|
327
338
|
x_name(str): Name of the x signal.
|
328
339
|
y_name(str): Name of the y signal.
|
329
340
|
x_entry(str|None): Entry of the x signal.
|
330
341
|
y_entry(str|None): Entry of the y signal.
|
331
342
|
validate_bec(bool, optional): If True, validate the signal with BEC. Defaults to True.
|
343
|
+
|
332
344
|
Returns:
|
333
345
|
tuple[str,str]: Validated x and y entries.
|
334
346
|
"""
|
@@ -343,6 +355,7 @@ class BECMotorMap(BECPlotBase):
|
|
343
355
|
def _get_motor_limit(self, motor: str) -> Union[list | None]: # TODO check if works correctly
|
344
356
|
"""
|
345
357
|
Get the motor limit from the config.
|
358
|
+
|
346
359
|
Args:
|
347
360
|
motor(str): Motor name.
|
348
361
|
|
@@ -404,6 +417,7 @@ class BECMotorMap(BECPlotBase):
|
|
404
417
|
def on_device_readback(self, msg: dict) -> None:
|
405
418
|
"""
|
406
419
|
Update the motor map plot with the new motor position.
|
420
|
+
|
407
421
|
Args:
|
408
422
|
msg(dict): Message from the device readback.
|
409
423
|
"""
|
@@ -425,4 +439,4 @@ class BECMotorMap(BECPlotBase):
|
|
425
439
|
def cleanup(self):
|
426
440
|
"""Cleanup the widget."""
|
427
441
|
self._disconnect_current_motors()
|
428
|
-
|
442
|
+
super().cleanup()
|
@@ -22,7 +22,7 @@ class AxisConfig(BaseModel):
|
|
22
22
|
y_grid: bool = Field(False, description="Show grid on the y-axis.")
|
23
23
|
|
24
24
|
|
25
|
-
class
|
25
|
+
class SubplotConfig(ConnectionConfig):
|
26
26
|
parent_id: Optional[str] = Field(None, description="The parent figure of the plot.")
|
27
27
|
|
28
28
|
# Coordinates in the figure
|
@@ -56,12 +56,12 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
56
56
|
self,
|
57
57
|
parent: Optional[QWidget] = None, # TODO decide if needed for this class
|
58
58
|
parent_figure=None,
|
59
|
-
config: Optional[
|
59
|
+
config: Optional[SubplotConfig] = None,
|
60
60
|
client=None,
|
61
61
|
gui_id: Optional[str] = None,
|
62
62
|
):
|
63
63
|
if config is None:
|
64
|
-
config =
|
64
|
+
config = SubplotConfig(widget_class=self.__class__.__name__)
|
65
65
|
super().__init__(client=client, config=config, gui_id=gui_id)
|
66
66
|
pg.GraphicsLayout.__init__(self, parent)
|
67
67
|
|
@@ -73,8 +73,10 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
73
73
|
def set(self, **kwargs) -> None:
|
74
74
|
"""
|
75
75
|
Set the properties of the plot widget.
|
76
|
+
|
76
77
|
Args:
|
77
78
|
**kwargs: Keyword arguments for the properties to be set.
|
79
|
+
|
78
80
|
Possible properties:
|
79
81
|
- title: str
|
80
82
|
- x_label: str
|
@@ -117,6 +119,7 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
117
119
|
def set_title(self, title: str):
|
118
120
|
"""
|
119
121
|
Set the title of the plot widget.
|
122
|
+
|
120
123
|
Args:
|
121
124
|
title(str): Title of the plot widget.
|
122
125
|
"""
|
@@ -126,6 +129,7 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
126
129
|
def set_x_label(self, label: str):
|
127
130
|
"""
|
128
131
|
Set the label of the x-axis.
|
132
|
+
|
129
133
|
Args:
|
130
134
|
label(str): Label of the x-axis.
|
131
135
|
"""
|
@@ -135,6 +139,7 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
135
139
|
def set_y_label(self, label: str):
|
136
140
|
"""
|
137
141
|
Set the label of the y-axis.
|
142
|
+
|
138
143
|
Args:
|
139
144
|
label(str): Label of the y-axis.
|
140
145
|
"""
|
@@ -144,6 +149,7 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
144
149
|
def set_x_scale(self, scale: Literal["linear", "log"] = "linear"):
|
145
150
|
"""
|
146
151
|
Set the scale of the x-axis.
|
152
|
+
|
147
153
|
Args:
|
148
154
|
scale(Literal["linear", "log"]): Scale of the x-axis.
|
149
155
|
"""
|
@@ -153,6 +159,7 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
153
159
|
def set_y_scale(self, scale: Literal["linear", "log"] = "linear"):
|
154
160
|
"""
|
155
161
|
Set the scale of the y-axis.
|
162
|
+
|
156
163
|
Args:
|
157
164
|
scale(Literal["linear", "log"]): Scale of the y-axis.
|
158
165
|
"""
|
@@ -208,6 +215,7 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
208
215
|
def set_grid(self, x: bool = False, y: bool = False):
|
209
216
|
"""
|
210
217
|
Set the grid of the plot widget.
|
218
|
+
|
211
219
|
Args:
|
212
220
|
x(bool): Show grid on the x-axis.
|
213
221
|
y(bool): Show grid on the y-axis.
|
@@ -223,6 +231,7 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
223
231
|
def lock_aspect_ratio(self, lock):
|
224
232
|
"""
|
225
233
|
Lock aspect ratio.
|
234
|
+
|
226
235
|
Args:
|
227
236
|
lock(bool): True to lock, False to unlock.
|
228
237
|
"""
|
@@ -231,6 +240,7 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
231
240
|
def plot(self, data_x: list | np.ndarray, data_y: list | np.ndarray, **kwargs):
|
232
241
|
"""
|
233
242
|
Plot custom data on the plot widget. These data are not saved in config.
|
243
|
+
|
234
244
|
Args:
|
235
245
|
data_x(list|np.ndarray): x-axis data
|
236
246
|
data_y(list|np.ndarray): y-axis data
|
@@ -248,3 +258,4 @@ class BECPlotBase(BECConnector, pg.GraphicsLayout):
|
|
248
258
|
|
249
259
|
def cleanup(self):
|
250
260
|
"""Cleanup the plot widget."""
|
261
|
+
super().cleanup()
|
@@ -15,7 +15,7 @@ from qtpy.QtCore import Slot as pyqtSlot
|
|
15
15
|
from qtpy.QtWidgets import QWidget
|
16
16
|
|
17
17
|
from bec_widgets.utils import BECConnector, Colors, ConnectionConfig, EntryValidator
|
18
|
-
from bec_widgets.widgets.plots.plot_base import BECPlotBase,
|
18
|
+
from bec_widgets.widgets.plots.plot_base import BECPlotBase, SubplotConfig
|
19
19
|
|
20
20
|
|
21
21
|
class SignalData(BaseModel):
|
@@ -53,7 +53,7 @@ class CurveConfig(ConnectionConfig):
|
|
53
53
|
colormap: Optional[str] = Field("plasma", description="The colormap of the curves z gradient.")
|
54
54
|
|
55
55
|
|
56
|
-
class Waveform1DConfig(
|
56
|
+
class Waveform1DConfig(SubplotConfig):
|
57
57
|
color_palette: Literal["plasma", "viridis", "inferno", "magma"] = Field(
|
58
58
|
"plasma", description="The color palette of the figure widget."
|
59
59
|
) # TODO can be extended to all colormaps from current pyqtgraph session
|
@@ -129,8 +129,10 @@ class BECCurve(BECConnector, pg.PlotDataItem):
|
|
129
129
|
def set(self, **kwargs):
|
130
130
|
"""
|
131
131
|
Set the properties of the curve.
|
132
|
+
|
132
133
|
Args:
|
133
134
|
**kwargs: Keyword arguments for the properties to be set.
|
135
|
+
|
134
136
|
Possible properties:
|
135
137
|
- color: str
|
136
138
|
- symbol: str
|
@@ -159,6 +161,7 @@ class BECCurve(BECConnector, pg.PlotDataItem):
|
|
159
161
|
def set_color(self, color: str, symbol_color: Optional[str] = None):
|
160
162
|
"""
|
161
163
|
Change the color of the curve.
|
164
|
+
|
162
165
|
Args:
|
163
166
|
color(str): Color of the curve.
|
164
167
|
symbol_color(str, optional): Color of the symbol. Defaults to None.
|
@@ -170,6 +173,7 @@ class BECCurve(BECConnector, pg.PlotDataItem):
|
|
170
173
|
def set_symbol(self, symbol: str):
|
171
174
|
"""
|
172
175
|
Change the symbol of the curve.
|
176
|
+
|
173
177
|
Args:
|
174
178
|
symbol(str): Symbol of the curve.
|
175
179
|
"""
|
@@ -179,6 +183,7 @@ class BECCurve(BECConnector, pg.PlotDataItem):
|
|
179
183
|
def set_symbol_color(self, symbol_color: str):
|
180
184
|
"""
|
181
185
|
Change the symbol color of the curve.
|
186
|
+
|
182
187
|
Args:
|
183
188
|
symbol_color(str): Color of the symbol.
|
184
189
|
"""
|
@@ -188,6 +193,7 @@ class BECCurve(BECConnector, pg.PlotDataItem):
|
|
188
193
|
def set_symbol_size(self, symbol_size: int):
|
189
194
|
"""
|
190
195
|
Change the symbol size of the curve.
|
196
|
+
|
191
197
|
Args:
|
192
198
|
symbol_size(int): Size of the symbol.
|
193
199
|
"""
|
@@ -197,6 +203,7 @@ class BECCurve(BECConnector, pg.PlotDataItem):
|
|
197
203
|
def set_pen_width(self, pen_width: int):
|
198
204
|
"""
|
199
205
|
Change the pen width of the curve.
|
206
|
+
|
200
207
|
Args:
|
201
208
|
pen_width(int): Width of the pen.
|
202
209
|
"""
|
@@ -206,6 +213,7 @@ class BECCurve(BECConnector, pg.PlotDataItem):
|
|
206
213
|
def set_pen_style(self, pen_style: Literal["solid", "dash", "dot", "dashdot"]):
|
207
214
|
"""
|
208
215
|
Change the pen style of the curve.
|
216
|
+
|
209
217
|
Args:
|
210
218
|
pen_style(Literal["solid", "dash", "dot", "dashdot"]): Style of the pen.
|
211
219
|
"""
|
@@ -215,6 +223,7 @@ class BECCurve(BECConnector, pg.PlotDataItem):
|
|
215
223
|
def set_colormap(self, colormap: str):
|
216
224
|
"""
|
217
225
|
Set the colormap for the scatter plot z gradient.
|
226
|
+
|
218
227
|
Args:
|
219
228
|
colormap(str): Colormap for the scatter plot.
|
220
229
|
"""
|
@@ -229,14 +238,10 @@ class BECCurve(BECConnector, pg.PlotDataItem):
|
|
229
238
|
x_data, y_data = self.getData()
|
230
239
|
return x_data, y_data
|
231
240
|
|
232
|
-
def cleanup(self):
|
233
|
-
"""Cleanup the curve."""
|
234
|
-
self.rpc_register.remove_rpc(self)
|
235
|
-
|
236
241
|
def remove(self):
|
237
242
|
"""Remove the curve from the plot."""
|
238
|
-
self.cleanup()
|
239
243
|
self.parent_item.removeItem(self)
|
244
|
+
self.cleanup()
|
240
245
|
|
241
246
|
|
242
247
|
class BECWaveform(BECPlotBase):
|
@@ -300,11 +305,12 @@ class BECWaveform(BECPlotBase):
|
|
300
305
|
self.add_legend()
|
301
306
|
self.apply_config(self.config)
|
302
307
|
|
303
|
-
def apply_config(self, config: dict |
|
308
|
+
def apply_config(self, config: dict | SubplotConfig, replot_last_scan: bool = False):
|
304
309
|
"""
|
305
310
|
Apply the configuration to the 1D waveform widget.
|
311
|
+
|
306
312
|
Args:
|
307
|
-
config(dict|
|
313
|
+
config(dict|SubplotConfig): Configuration settings.
|
308
314
|
replot_last_scan(bool, optional): If True, replot the last scan. Defaults to False.
|
309
315
|
"""
|
310
316
|
if isinstance(config, dict):
|
@@ -343,8 +349,10 @@ class BECWaveform(BECPlotBase):
|
|
343
349
|
def add_curve_by_config(self, curve_config: CurveConfig | dict) -> BECCurve:
|
344
350
|
"""
|
345
351
|
Add a curve to the plot widget by its configuration.
|
352
|
+
|
346
353
|
Args:
|
347
354
|
curve_config(CurveConfig|dict): Configuration of the curve to be added.
|
355
|
+
|
348
356
|
Returns:
|
349
357
|
BECCurve: The curve object.
|
350
358
|
"""
|
@@ -358,8 +366,10 @@ class BECWaveform(BECPlotBase):
|
|
358
366
|
def get_curve_config(self, curve_id: str, dict_output: bool = True) -> CurveConfig | dict:
|
359
367
|
"""
|
360
368
|
Get the configuration of a curve by its ID.
|
369
|
+
|
361
370
|
Args:
|
362
371
|
curve_id(str): ID of the curve.
|
372
|
+
|
363
373
|
Returns:
|
364
374
|
CurveConfig|dict: Configuration of the curve.
|
365
375
|
"""
|
@@ -386,8 +396,10 @@ class BECWaveform(BECPlotBase):
|
|
386
396
|
def get_curve(self, identifier) -> BECCurve:
|
387
397
|
"""
|
388
398
|
Get the curve by its index or ID.
|
399
|
+
|
389
400
|
Args:
|
390
401
|
identifier(int|str): Identifier of the curve. Can be either an integer (index) or a string (curve_id).
|
402
|
+
|
391
403
|
Returns:
|
392
404
|
BECCurve: The curve object.
|
393
405
|
"""
|
@@ -411,6 +423,7 @@ class BECWaveform(BECPlotBase):
|
|
411
423
|
) -> BECCurve:
|
412
424
|
"""
|
413
425
|
Add a custom data curve to the plot widget.
|
426
|
+
|
414
427
|
Args:
|
415
428
|
x(list|np.ndarray): X data of the curve.
|
416
429
|
y(list|np.ndarray): Y data of the curve.
|
@@ -461,11 +474,13 @@ class BECWaveform(BECPlotBase):
|
|
461
474
|
) -> BECCurve:
|
462
475
|
"""
|
463
476
|
Add a curve object to the plot widget.
|
477
|
+
|
464
478
|
Args:
|
465
479
|
name(str): ID of the curve.
|
466
480
|
source(str): Source of the curve.
|
467
481
|
config(CurveConfig): Configuration of the curve.
|
468
482
|
data(tuple[list|np.ndarray,list|np.ndarray], optional): Data (x,y) to be plotted. Defaults to None.
|
483
|
+
|
469
484
|
Returns:
|
470
485
|
BECCurve: The curve object.
|
471
486
|
"""
|
@@ -493,6 +508,7 @@ class BECWaveform(BECPlotBase):
|
|
493
508
|
) -> BECCurve:
|
494
509
|
"""
|
495
510
|
Add a curve to the plot widget from the scan segment.
|
511
|
+
|
496
512
|
Args:
|
497
513
|
x_name(str): Name of the x signal.
|
498
514
|
x_entry(str): Entry of the x signal.
|
@@ -563,6 +579,7 @@ class BECWaveform(BECPlotBase):
|
|
563
579
|
) -> tuple[str, str, str | None]:
|
564
580
|
"""
|
565
581
|
Validate the signal name and entry.
|
582
|
+
|
566
583
|
Args:
|
567
584
|
x_name(str): Name of the x signal.
|
568
585
|
y_name(str): Name of the y signal.
|
@@ -571,6 +588,7 @@ class BECWaveform(BECPlotBase):
|
|
571
588
|
y_entry(str|None): Entry of the y signal.
|
572
589
|
z_entry(str|None): Entry of the z signal.
|
573
590
|
validate_bec(bool, optional): If True, validate the signal with BEC. Defaults to True.
|
591
|
+
|
574
592
|
Returns:
|
575
593
|
tuple[str,str,str|None]: Validated x, y, z entries.
|
576
594
|
"""
|
@@ -588,6 +606,7 @@ class BECWaveform(BECPlotBase):
|
|
588
606
|
def _check_curve_id(self, val: Any, dict_to_check: dict) -> bool:
|
589
607
|
"""
|
590
608
|
Check if val is in the values of the dict_to_check or in the values of the nested dictionaries.
|
609
|
+
|
591
610
|
Args:
|
592
611
|
val(Any): Value to check.
|
593
612
|
dict_to_check(dict): Dictionary to check.
|
@@ -606,6 +625,7 @@ class BECWaveform(BECPlotBase):
|
|
606
625
|
def remove_curve(self, *identifiers):
|
607
626
|
"""
|
608
627
|
Remove a curve from the plot widget.
|
628
|
+
|
609
629
|
Args:
|
610
630
|
*identifiers: Identifier of the curve to be removed. Can be either an integer (index) or a string (curve_id).
|
611
631
|
"""
|
@@ -622,6 +642,7 @@ class BECWaveform(BECPlotBase):
|
|
622
642
|
def _remove_curve_by_id(self, curve_id):
|
623
643
|
"""
|
624
644
|
Remove a curve by its ID from the plot widget.
|
645
|
+
|
625
646
|
Args:
|
626
647
|
curve_id(str): ID of the curve to be removed.
|
627
648
|
"""
|
@@ -638,6 +659,7 @@ class BECWaveform(BECPlotBase):
|
|
638
659
|
def _remove_curve_by_order(self, N):
|
639
660
|
"""
|
640
661
|
Remove a curve by its order from the plot widget.
|
662
|
+
|
641
663
|
Args:
|
642
664
|
N(int): Order of the curve to be removed.
|
643
665
|
"""
|
@@ -683,6 +705,7 @@ class BECWaveform(BECPlotBase):
|
|
683
705
|
def _update_scan_curves(self, data: ScanData):
|
684
706
|
"""
|
685
707
|
Update the scan curves with the data from the scan segment.
|
708
|
+
|
686
709
|
Args:
|
687
710
|
data(ScanData): Data from the scan segment.
|
688
711
|
"""
|
@@ -717,6 +740,7 @@ class BECWaveform(BECPlotBase):
|
|
717
740
|
def _make_z_gradient(self, data_z: list | np.ndarray, colormap: str) -> list | None:
|
718
741
|
"""
|
719
742
|
Make a gradient color for the z values.
|
743
|
+
|
720
744
|
Args:
|
721
745
|
data_z(list|np.ndarray): Z values.
|
722
746
|
colormap(str): Colormap for the gradient color.
|
@@ -739,6 +763,7 @@ class BECWaveform(BECPlotBase):
|
|
739
763
|
"""
|
740
764
|
Update the scan curves with the data from the scan storage.
|
741
765
|
Provide only one of scan_id or scan_index.
|
766
|
+
|
742
767
|
Args:
|
743
768
|
scan_id(str, optional): ScanID of the scan to be updated. Defaults to None.
|
744
769
|
scan_index(int, optional): Index of the scan to be updated. Defaults to None.
|
@@ -758,8 +783,10 @@ class BECWaveform(BECPlotBase):
|
|
758
783
|
def get_all_data(self, output: Literal["dict", "pandas"] = "dict") -> dict | pd.DataFrame:
|
759
784
|
"""
|
760
785
|
Extract all curve data into a dictionary or a pandas DataFrame.
|
786
|
+
|
761
787
|
Args:
|
762
788
|
output (Literal["dict", "pandas"]): Format of the output data.
|
789
|
+
|
763
790
|
Returns:
|
764
791
|
dict | pd.DataFrame: Data of all curves in the specified format.
|
765
792
|
"""
|
@@ -799,4 +826,4 @@ class BECWaveform(BECPlotBase):
|
|
799
826
|
self.bec_dispatcher.disconnect_slot(self.on_scan_segment, MessageEndpoints.scan_segment())
|
800
827
|
for curve in self.curves:
|
801
828
|
curve.cleanup()
|
802
|
-
|
829
|
+
super().cleanup()
|
@@ -109,6 +109,7 @@ class ScanControl(QWidget):
|
|
109
109
|
def add_horizontal_separator(self, layout) -> None:
|
110
110
|
"""
|
111
111
|
Adds a horizontal separator to the given layout
|
112
|
+
|
112
113
|
Args:
|
113
114
|
layout: Layout to add the separator to
|
114
115
|
"""
|
@@ -142,6 +143,7 @@ class ScanControl(QWidget):
|
|
142
143
|
def add_labels_to_layout(self, labels: list, grid_layout: QGridLayout) -> None:
|
143
144
|
"""
|
144
145
|
Adds labels to the given grid layout as a separate row.
|
146
|
+
|
145
147
|
Args:
|
146
148
|
labels (list): List of label names to add.
|
147
149
|
grid_layout (QGridLayout): The grid layout to which labels will be added.
|
@@ -157,6 +159,7 @@ class ScanControl(QWidget):
|
|
157
159
|
) -> None: # TODO could be moved to BECTable
|
158
160
|
"""
|
159
161
|
Adds labels to the given table widget as a header row.
|
162
|
+
|
160
163
|
Args:
|
161
164
|
labels(list): List of label names to add.
|
162
165
|
table(QTableWidget): The table widget to which labels will be added.
|
@@ -166,7 +169,8 @@ class ScanControl(QWidget):
|
|
166
169
|
|
167
170
|
def generate_args_input_fields(self, scan_info: dict) -> None:
|
168
171
|
"""
|
169
|
-
Generates input fields for args
|
172
|
+
Generates input fields for args.
|
173
|
+
|
170
174
|
Args:
|
171
175
|
scan_info(dict): Scan signature dictionary from BEC.
|
172
176
|
"""
|
@@ -188,6 +192,7 @@ class ScanControl(QWidget):
|
|
188
192
|
def generate_kwargs_input_fields(self, scan_info: dict) -> None:
|
189
193
|
"""
|
190
194
|
Generates input fields for kwargs
|
195
|
+
|
191
196
|
Args:
|
192
197
|
scan_info(dict): Scan signature dictionary from BEC.
|
193
198
|
"""
|
@@ -213,12 +218,13 @@ class ScanControl(QWidget):
|
|
213
218
|
def generate_widgets_from_signature(self, items: list, signature: dict = None) -> list:
|
214
219
|
"""
|
215
220
|
Generates widgets from the given list of items.
|
221
|
+
|
216
222
|
Args:
|
217
223
|
items(list): List of items to create widgets for.
|
218
224
|
signature(dict, optional): Scan signature dictionary from BEC.
|
219
225
|
|
220
226
|
Returns:
|
221
|
-
|
227
|
+
list: List of widgets created from the given items.
|
222
228
|
"""
|
223
229
|
widgets = [] # Initialize an empty list to hold the widgets
|
224
230
|
|
@@ -333,6 +339,7 @@ class ScanControl(QWidget):
|
|
333
339
|
def clear_and_delete_layout(self, layout: QLayout):
|
334
340
|
"""
|
335
341
|
Clears and deletes the given layout and all its child widgets.
|
342
|
+
|
336
343
|
Args:
|
337
344
|
layout(QLayout): Layout to clear and delete
|
338
345
|
"""
|
@@ -383,6 +390,7 @@ class ScanControl(QWidget):
|
|
383
390
|
def extract_args_from_table(self, table: QTableWidget) -> list:
|
384
391
|
"""
|
385
392
|
Extracts the arguments from the given table widget.
|
393
|
+
|
386
394
|
Args:
|
387
395
|
table(QTableWidget): Table widget from which to extract the arguments
|
388
396
|
"""
|
@@ -82,6 +82,7 @@ class RunScriptAction:
|
|
82
82
|
|
83
83
|
class ModularToolBar(QToolBar):
|
84
84
|
"""Modular toolbar with optional automatic initialization.
|
85
|
+
|
85
86
|
Args:
|
86
87
|
parent (QWidget, optional): The parent widget of the toolbar. Defaults to None.
|
87
88
|
auto_init (bool, optional): If True, automatically populates the toolbar based on the parent widget.
|