bec-widgets 0.83.1__py3-none-any.whl → 0.85.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- CHANGELOG.md +40 -42
- PKG-INFO +1 -1
- bec_widgets/cli/client.py +61 -8
- bec_widgets/examples/jupyter_console/jupyter_console_window.py +105 -57
- bec_widgets/utils/bec_dispatcher.py +5 -2
- bec_widgets/widgets/color_map_selector/__init__.py +0 -0
- bec_widgets/widgets/color_map_selector/assets/color_map_selector_icon.png +0 -0
- bec_widgets/widgets/color_map_selector/color_map_selector.py +111 -0
- bec_widgets/widgets/color_map_selector/color_map_selector.pyproject +1 -0
- bec_widgets/widgets/color_map_selector/color_map_selector_plugin.py +57 -0
- bec_widgets/widgets/color_map_selector/register_color_map_selector.py +17 -0
- bec_widgets/widgets/figure/figure.py +21 -114
- bec_widgets/widgets/figure/plots/waveform/waveform.py +651 -94
- bec_widgets/widgets/figure/plots/waveform/waveform_curve.py +9 -2
- {bec_widgets-0.83.1.dist-info → bec_widgets-0.85.0.dist-info}/METADATA +1 -1
- {bec_widgets-0.83.1.dist-info → bec_widgets-0.85.0.dist-info}/RECORD +24 -18
- pyproject.toml +1 -1
- tests/unit_tests/client_mocks.py +13 -4
- tests/unit_tests/test_color_map_selector.py +43 -0
- tests/unit_tests/test_device_input_widgets.py +2 -0
- tests/unit_tests/test_waveform1d.py +202 -23
- bec_widgets/examples/jupyter_console/jupyter_console_window.ui +0 -54
- {bec_widgets-0.83.1.dist-info → bec_widgets-0.85.0.dist-info}/WHEEL +0 -0
- {bec_widgets-0.83.1.dist-info → bec_widgets-0.85.0.dist-info}/entry_points.txt +0 -0
- {bec_widgets-0.83.1.dist-info → bec_widgets-0.85.0.dist-info}/licenses/LICENSE +0 -0
@@ -227,106 +227,12 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
227
227
|
"""
|
228
228
|
self._widgets = value
|
229
229
|
|
230
|
-
def _init_waveform(
|
231
|
-
self,
|
232
|
-
waveform,
|
233
|
-
x_name: str = None,
|
234
|
-
y_name: str = None,
|
235
|
-
z_name: str = None,
|
236
|
-
x_entry: str = None,
|
237
|
-
y_entry: str = None,
|
238
|
-
z_entry: str = None,
|
239
|
-
x: list | np.ndarray = None,
|
240
|
-
y: list | np.ndarray = None,
|
241
|
-
color: str | None = None,
|
242
|
-
color_map_z: str | None = "plasma",
|
243
|
-
label: str | None = None,
|
244
|
-
validate: bool = True,
|
245
|
-
dap: str | None = None,
|
246
|
-
) -> BECWaveform:
|
247
|
-
"""
|
248
|
-
Configure the waveform based on the provided parameters.
|
249
|
-
|
250
|
-
Args:
|
251
|
-
waveform (BECWaveform): The waveform to configure.
|
252
|
-
x (list | np.ndarray): Custom x data to plot.
|
253
|
-
y (list | np.ndarray): Custom y data to plot.
|
254
|
-
x_name (str): The name of the device for the x-axis.
|
255
|
-
y_name (str): The name of the device for the y-axis.
|
256
|
-
z_name (str): The name of the device for the z-axis.
|
257
|
-
x_entry (str): The name of the entry for the x-axis.
|
258
|
-
y_entry (str): The name of the entry for the y-axis.
|
259
|
-
z_entry (str): The name of the entry for the z-axis.
|
260
|
-
color (str): The color of the curve.
|
261
|
-
color_map_z (str): The color map to use for the z-axis.
|
262
|
-
label (str): The label of the curve.
|
263
|
-
validate (bool): If True, validate the device names and entries.
|
264
|
-
dap (str): The DAP model to use for the curve.
|
265
|
-
"""
|
266
|
-
if x is not None and y is None:
|
267
|
-
if isinstance(x, np.ndarray):
|
268
|
-
if x.ndim == 1:
|
269
|
-
y = np.arange(x.size)
|
270
|
-
waveform.add_curve_custom(x=np.arange(x.size), y=x, color=color, label=label)
|
271
|
-
return waveform
|
272
|
-
if x.ndim == 2:
|
273
|
-
waveform.add_curve_custom(x=x[:, 0], y=x[:, 1], color=color, label=label)
|
274
|
-
return waveform
|
275
|
-
elif isinstance(x, list):
|
276
|
-
y = np.arange(len(x))
|
277
|
-
waveform.add_curve_custom(x=np.arange(len(x)), y=x, color=color, label=label)
|
278
|
-
return waveform
|
279
|
-
else:
|
280
|
-
raise ValueError(
|
281
|
-
"Invalid input. Provide either device names (x_name, y_name) or custom data."
|
282
|
-
)
|
283
|
-
if x is not None and y is not None:
|
284
|
-
waveform.add_curve_custom(x=x, y=y, color=color, label=label)
|
285
|
-
return waveform
|
286
|
-
# User wants to add scan curve -> 1D Waveform
|
287
|
-
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:
|
288
|
-
waveform.plot(
|
289
|
-
x_name=x_name,
|
290
|
-
y_name=y_name,
|
291
|
-
x_entry=x_entry,
|
292
|
-
y_entry=y_entry,
|
293
|
-
validate=validate,
|
294
|
-
color=color,
|
295
|
-
label=label,
|
296
|
-
dap=dap,
|
297
|
-
)
|
298
|
-
# User wants to add scan curve -> 2D Waveform Scatter
|
299
|
-
if (
|
300
|
-
x_name is not None
|
301
|
-
and y_name is not None
|
302
|
-
and z_name is not None
|
303
|
-
and x is None
|
304
|
-
and y is None
|
305
|
-
):
|
306
|
-
waveform.plot(
|
307
|
-
x_name=x_name,
|
308
|
-
y_name=y_name,
|
309
|
-
z_name=z_name,
|
310
|
-
x_entry=x_entry,
|
311
|
-
y_entry=y_entry,
|
312
|
-
z_entry=z_entry,
|
313
|
-
color=color,
|
314
|
-
color_map_z=color_map_z,
|
315
|
-
label=label,
|
316
|
-
validate=validate,
|
317
|
-
dap=dap,
|
318
|
-
)
|
319
|
-
# User wants to add custom curve
|
320
|
-
elif x is not None and y is not None and x_name is None and y_name is None:
|
321
|
-
waveform.add_curve_custom(x=x, y=y, color=color, label=label)
|
322
|
-
|
323
|
-
return waveform
|
324
|
-
|
325
230
|
@typechecked
|
326
231
|
def plot(
|
327
232
|
self,
|
328
|
-
|
233
|
+
arg1: list | np.ndarray | str | None = None,
|
329
234
|
y: list | np.ndarray | None = None,
|
235
|
+
x: list | np.ndarray | None = None,
|
330
236
|
x_name: str | None = None,
|
331
237
|
y_name: str | None = None,
|
332
238
|
z_name: str | None = None,
|
@@ -348,8 +254,9 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
348
254
|
Add a 1D waveform plot to the figure. Always access the first waveform widget in the figure.
|
349
255
|
|
350
256
|
Args:
|
351
|
-
|
257
|
+
arg1(list | np.ndarray | str | None): First argument which can be x data, y data, or y_name.
|
352
258
|
y(list | np.ndarray): Custom y data to plot.
|
259
|
+
x(list | np.ndarray): Custom x data to plot.
|
353
260
|
x_name(str): The name of the device for the x-axis.
|
354
261
|
y_name(str): The name of the device for the y-axis.
|
355
262
|
z_name(str): The name of the device for the z-axis.
|
@@ -376,23 +283,23 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
376
283
|
if config is not None:
|
377
284
|
return waveform
|
378
285
|
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
286
|
+
if arg1 is not None or y_name is not None or (y is not None and x is not None):
|
287
|
+
waveform.plot(
|
288
|
+
arg1=arg1,
|
289
|
+
y=y,
|
290
|
+
x=x,
|
291
|
+
x_name=x_name,
|
292
|
+
y_name=y_name,
|
293
|
+
z_name=z_name,
|
294
|
+
x_entry=x_entry,
|
295
|
+
y_entry=y_entry,
|
296
|
+
z_entry=z_entry,
|
297
|
+
color=color,
|
298
|
+
color_map_z=color_map_z,
|
299
|
+
label=label,
|
300
|
+
validate=validate,
|
301
|
+
dap=dap,
|
302
|
+
)
|
396
303
|
return waveform
|
397
304
|
|
398
305
|
def _init_image(
|