bec-widgets 0.52.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/client.py +123 -8
- bec_widgets/cli/client_utils.py +1 -0
- bec_widgets/cli/generate_cli.py +1 -0
- bec_widgets/cli/rpc_register.py +4 -0
- bec_widgets/cli/rpc_wigdet_handler.py +1 -0
- bec_widgets/utils/bec_connector.py +7 -0
- 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 +4 -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/dock/dock_area.py +5 -0
- bec_widgets/widgets/figure/figure.py +12 -0
- bec_widgets/widgets/plots/image.py +41 -0
- bec_widgets/widgets/plots/motor_map.py +14 -0
- bec_widgets/widgets/plots/plot_base.py +10 -0
- bec_widgets/widgets/plots/waveform.py +31 -0
- bec_widgets/widgets/scan_control/scan_control.py +10 -2
- bec_widgets/widgets/toolbar/toolbar.py +1 -0
- {bec_widgets-0.52.0.dist-info → bec_widgets-0.52.1.dist-info}/METADATA +1 -1
- {bec_widgets-0.52.0.dist-info → bec_widgets-0.52.1.dist-info}/RECORD +27 -29
- bec_widgets/simulations/__init__.py +0 -0
- bec_widgets/utils/ctrl_c.py +0 -39
- {bec_widgets-0.52.0.dist-info → bec_widgets-0.52.1.dist-info}/LICENSE +0 -0
- {bec_widgets-0.52.0.dist-info → bec_widgets-0.52.1.dist-info}/WHEEL +0 -0
- {bec_widgets-0.52.0.dist-info → bec_widgets-0.52.1.dist-info}/top_level.txt +0 -0
@@ -112,8 +112,10 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
112
112
|
def set(self, **kwargs):
|
113
113
|
"""
|
114
114
|
Set the properties of the image.
|
115
|
+
|
115
116
|
Args:
|
116
117
|
**kwargs: Keyword arguments for the properties to be set.
|
118
|
+
|
117
119
|
Possible properties:
|
118
120
|
- downsample
|
119
121
|
- color_map
|
@@ -145,6 +147,7 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
145
147
|
def set_fft(self, enable: bool = False):
|
146
148
|
"""
|
147
149
|
Set the FFT of the image.
|
150
|
+
|
148
151
|
Args:
|
149
152
|
enable(bool): Whether to perform FFT on the monitor data.
|
150
153
|
"""
|
@@ -153,6 +156,7 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
153
156
|
def set_log(self, enable: bool = False):
|
154
157
|
"""
|
155
158
|
Set the log of the image.
|
159
|
+
|
156
160
|
Args:
|
157
161
|
enable(bool): Whether to perform log on the monitor data.
|
158
162
|
"""
|
@@ -163,6 +167,7 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
163
167
|
def set_rotation(self, deg_90: int = 0):
|
164
168
|
"""
|
165
169
|
Set the rotation of the image.
|
170
|
+
|
166
171
|
Args:
|
167
172
|
deg_90(int): The rotation angle of the monitor data before displaying.
|
168
173
|
"""
|
@@ -171,6 +176,7 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
171
176
|
def set_transpose(self, enable: bool = False):
|
172
177
|
"""
|
173
178
|
Set the transpose of the image.
|
179
|
+
|
174
180
|
Args:
|
175
181
|
enable(bool): Whether to transpose the image.
|
176
182
|
"""
|
@@ -179,6 +185,7 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
179
185
|
def set_opacity(self, opacity: float = 1.0):
|
180
186
|
"""
|
181
187
|
Set the opacity of the image.
|
188
|
+
|
182
189
|
Args:
|
183
190
|
opacity(float): The opacity of the image.
|
184
191
|
"""
|
@@ -188,6 +195,7 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
188
195
|
def set_autorange(self, autorange: bool = False):
|
189
196
|
"""
|
190
197
|
Set the autorange of the color bar.
|
198
|
+
|
191
199
|
Args:
|
192
200
|
autorange(bool): Whether to autorange the color bar.
|
193
201
|
"""
|
@@ -198,6 +206,7 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
198
206
|
def set_color_map(self, cmap: str = "magma"):
|
199
207
|
"""
|
200
208
|
Set the color map of the image.
|
209
|
+
|
201
210
|
Args:
|
202
211
|
cmap(str): The color map of the image.
|
203
212
|
"""
|
@@ -212,6 +221,7 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
212
221
|
def set_auto_downsample(self, auto: bool = True):
|
213
222
|
"""
|
214
223
|
Set the auto downsample of the image.
|
224
|
+
|
215
225
|
Args:
|
216
226
|
auto(bool): Whether to downsample the image.
|
217
227
|
"""
|
@@ -221,6 +231,7 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
221
231
|
def set_monitor(self, monitor: str):
|
222
232
|
"""
|
223
233
|
Set the monitor of the image.
|
234
|
+
|
224
235
|
Args:
|
225
236
|
monitor(str): The name of the monitor.
|
226
237
|
"""
|
@@ -229,6 +240,7 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
229
240
|
def set_vrange(self, vmin: float = None, vmax: float = None, vrange: tuple[int, int] = None):
|
230
241
|
"""
|
231
242
|
Set the range of the color bar.
|
243
|
+
|
232
244
|
Args:
|
233
245
|
vmin(float): Minimum value of the color bar.
|
234
246
|
vmax(float): Maximum value of the color bar.
|
@@ -258,6 +270,7 @@ class BECImageItem(BECConnector, pg.ImageItem):
|
|
258
270
|
):
|
259
271
|
"""
|
260
272
|
Add color bar to the layout.
|
273
|
+
|
261
274
|
Args:
|
262
275
|
style(Literal["simple,full"]): The style of the color bar.
|
263
276
|
vrange(tuple[int,int]): The range of the color bar.
|
@@ -363,6 +376,7 @@ class BECImageShow(BECPlotBase):
|
|
363
376
|
def find_image_by_monitor(self, item_id: str) -> BECImageItem:
|
364
377
|
"""
|
365
378
|
Find the widget by its gui_id.
|
379
|
+
|
366
380
|
Args:
|
367
381
|
item_id(str): The gui_id of the widget.
|
368
382
|
|
@@ -381,6 +395,7 @@ class BECImageShow(BECPlotBase):
|
|
381
395
|
def apply_config(self, config: dict | SubplotConfig):
|
382
396
|
"""
|
383
397
|
Apply the configuration to the 1D waveform widget.
|
398
|
+
|
384
399
|
Args:
|
385
400
|
config(dict|SubplotConfig): Configuration settings.
|
386
401
|
replot_last_scan(bool, optional): If True, replot the last scan. Defaults to False.
|
@@ -416,6 +431,7 @@ class BECImageShow(BECPlotBase):
|
|
416
431
|
def add_image_by_config(self, config: ImageItemConfig | dict) -> BECImageItem:
|
417
432
|
"""
|
418
433
|
Add an image to the widget by configuration.
|
434
|
+
|
419
435
|
Args:
|
420
436
|
config(ImageItemConfig|dict): The configuration of the image.
|
421
437
|
|
@@ -432,6 +448,7 @@ class BECImageShow(BECPlotBase):
|
|
432
448
|
def get_image_config(self, image_id, dict_output: bool = True) -> ImageItemConfig | dict:
|
433
449
|
"""
|
434
450
|
Get the configuration of the image.
|
451
|
+
|
435
452
|
Args:
|
436
453
|
image_id(str): The ID of the image.
|
437
454
|
dict_output(bool): Whether to return the configuration as a dictionary. Defaults to True.
|
@@ -473,6 +490,7 @@ class BECImageShow(BECPlotBase):
|
|
473
490
|
def get_image_dict(self) -> dict[str, dict[str, BECImageItem]]:
|
474
491
|
"""
|
475
492
|
Get all images.
|
493
|
+
|
476
494
|
Returns:
|
477
495
|
dict[str, dict[str, BECImageItem]]: The dictionary of images.
|
478
496
|
"""
|
@@ -574,6 +592,7 @@ class BECImageShow(BECPlotBase):
|
|
574
592
|
"""
|
575
593
|
Set the range of the color bar.
|
576
594
|
If name is not specified, then set vrange for all images.
|
595
|
+
|
577
596
|
Args:
|
578
597
|
vmin(float): Minimum value of the color bar.
|
579
598
|
vmax(float): Maximum value of the color bar.
|
@@ -585,6 +604,7 @@ class BECImageShow(BECPlotBase):
|
|
585
604
|
"""
|
586
605
|
Set the color map of the image.
|
587
606
|
If name is not specified, then set color map for all images.
|
607
|
+
|
588
608
|
Args:
|
589
609
|
cmap(str): The color map of the image.
|
590
610
|
name(str): The name of the image. If None, apply to all images.
|
@@ -594,6 +614,7 @@ class BECImageShow(BECPlotBase):
|
|
594
614
|
def set_autorange(self, enable: bool = False, name: str = None):
|
595
615
|
"""
|
596
616
|
Set the autoscale of the image.
|
617
|
+
|
597
618
|
Args:
|
598
619
|
enable(bool): Whether to autoscale the color bar.
|
599
620
|
name(str): The name of the image. If None, apply to all images.
|
@@ -604,6 +625,7 @@ class BECImageShow(BECPlotBase):
|
|
604
625
|
"""
|
605
626
|
Set the monitor of the image.
|
606
627
|
If name is not specified, then set monitor for all images.
|
628
|
+
|
607
629
|
Args:
|
608
630
|
monitor(str): The name of the monitor.
|
609
631
|
name(str): The name of the image. If None, apply to all images.
|
@@ -614,6 +636,7 @@ class BECImageShow(BECPlotBase):
|
|
614
636
|
"""
|
615
637
|
Set the post processing of the image.
|
616
638
|
If name is not specified, then set post processing for all images.
|
639
|
+
|
617
640
|
Args:
|
618
641
|
name(str): The name of the image. If None, apply to all images.
|
619
642
|
**kwargs: Keyword arguments for the properties to be set.
|
@@ -628,6 +651,7 @@ class BECImageShow(BECPlotBase):
|
|
628
651
|
def set_image_properties(self, name: str = None, **kwargs):
|
629
652
|
"""
|
630
653
|
Set the properties of the image.
|
654
|
+
|
631
655
|
Args:
|
632
656
|
name(str): The name of the image. If None, apply to all images.
|
633
657
|
**kwargs: Keyword arguments for the properties to be set.
|
@@ -648,6 +672,7 @@ class BECImageShow(BECPlotBase):
|
|
648
672
|
"""
|
649
673
|
Set the FFT of the image.
|
650
674
|
If name is not specified, then set FFT for all images.
|
675
|
+
|
651
676
|
Args:
|
652
677
|
enable(bool): Whether to perform FFT on the monitor data.
|
653
678
|
name(str): The name of the image. If None, apply to all images.
|
@@ -658,6 +683,7 @@ class BECImageShow(BECPlotBase):
|
|
658
683
|
"""
|
659
684
|
Set the log of the image.
|
660
685
|
If name is not specified, then set log for all images.
|
686
|
+
|
661
687
|
Args:
|
662
688
|
enable(bool): Whether to perform log on the monitor data.
|
663
689
|
name(str): The name of the image. If None, apply to all images.
|
@@ -668,6 +694,7 @@ class BECImageShow(BECPlotBase):
|
|
668
694
|
"""
|
669
695
|
Set the rotation of the image.
|
670
696
|
If name is not specified, then set rotation for all images.
|
697
|
+
|
671
698
|
Args:
|
672
699
|
deg_90(int): The rotation angle of the monitor data before displaying.
|
673
700
|
name(str): The name of the image. If None, apply to all images.
|
@@ -678,6 +705,7 @@ class BECImageShow(BECPlotBase):
|
|
678
705
|
"""
|
679
706
|
Set the transpose of the image.
|
680
707
|
If name is not specified, then set transpose for all images.
|
708
|
+
|
681
709
|
Args:
|
682
710
|
enable(bool): Whether to transpose the monitor data before displaying.
|
683
711
|
name(str): The name of the image. If None, apply to all images.
|
@@ -687,6 +715,7 @@ class BECImageShow(BECPlotBase):
|
|
687
715
|
def toggle_threading(self, use_threading: bool):
|
688
716
|
"""
|
689
717
|
Toggle threading for the widgets postprocessing and updating.
|
718
|
+
|
690
719
|
Args:
|
691
720
|
use_threading(bool): Whether to use threading.
|
692
721
|
"""
|
@@ -698,6 +727,7 @@ class BECImageShow(BECPlotBase):
|
|
698
727
|
def on_image_update(self, msg: dict):
|
699
728
|
"""
|
700
729
|
Update the image of the device monitor from bec.
|
730
|
+
|
701
731
|
Args:
|
702
732
|
msg(dict): The message from bec.
|
703
733
|
"""
|
@@ -716,6 +746,7 @@ class BECImageShow(BECPlotBase):
|
|
716
746
|
def update_image(self, device: str, data: np.ndarray):
|
717
747
|
"""
|
718
748
|
Update the image of the device monitor.
|
749
|
+
|
719
750
|
Args:
|
720
751
|
device(str): The name of the device.
|
721
752
|
data(np.ndarray): The data to be updated.
|
@@ -726,6 +757,7 @@ class BECImageShow(BECPlotBase):
|
|
726
757
|
def _connect_device_monitor(self, monitor: str):
|
727
758
|
"""
|
728
759
|
Connect to the device monitor.
|
760
|
+
|
729
761
|
Args:
|
730
762
|
monitor(str): The name of the monitor.
|
731
763
|
"""
|
@@ -760,6 +792,7 @@ class BECImageShow(BECPlotBase):
|
|
760
792
|
def _check_image_id(self, val: Any, dict_to_check: dict) -> bool:
|
761
793
|
"""
|
762
794
|
Check if val is in the values of the dict_to_check or in the values of the nested dictionaries.
|
795
|
+
|
763
796
|
Args:
|
764
797
|
val(Any): Value to check.
|
765
798
|
dict_to_check(dict): Dictionary to check.
|
@@ -778,6 +811,7 @@ class BECImageShow(BECPlotBase):
|
|
778
811
|
def _validate_monitor(self, monitor: str, validate_bec: bool = True):
|
779
812
|
"""
|
780
813
|
Validate the monitor name.
|
814
|
+
|
781
815
|
Args:
|
782
816
|
monitor(str): The name of the monitor.
|
783
817
|
validate_bec(bool): Whether to validate the monitor name with BEC.
|
@@ -818,6 +852,7 @@ class ImageProcessor:
|
|
818
852
|
def set_config(self, config: ProcessingConfig):
|
819
853
|
"""
|
820
854
|
Set the configuration of the processor.
|
855
|
+
|
821
856
|
Args:
|
822
857
|
config(ProcessingConfig): The configuration of the processor.
|
823
858
|
"""
|
@@ -826,6 +861,7 @@ class ImageProcessor:
|
|
826
861
|
def FFT(self, data: np.ndarray) -> np.ndarray:
|
827
862
|
"""
|
828
863
|
Perform FFT on the data.
|
864
|
+
|
829
865
|
Args:
|
830
866
|
data(np.ndarray): The data to be processed.
|
831
867
|
|
@@ -837,6 +873,7 @@ class ImageProcessor:
|
|
837
873
|
def rotation(self, data: np.ndarray, rotate_90: int) -> np.ndarray:
|
838
874
|
"""
|
839
875
|
Rotate the data by 90 degrees n times.
|
876
|
+
|
840
877
|
Args:
|
841
878
|
data(np.ndarray): The data to be processed.
|
842
879
|
rotate_90(int): The number of 90 degree rotations.
|
@@ -849,6 +886,7 @@ class ImageProcessor:
|
|
849
886
|
def transpose(self, data: np.ndarray) -> np.ndarray:
|
850
887
|
"""
|
851
888
|
Transpose the data.
|
889
|
+
|
852
890
|
Args:
|
853
891
|
data(np.ndarray): The data to be processed.
|
854
892
|
|
@@ -860,6 +898,7 @@ class ImageProcessor:
|
|
860
898
|
def log(self, data: np.ndarray) -> np.ndarray:
|
861
899
|
"""
|
862
900
|
Perform log on the data.
|
901
|
+
|
863
902
|
Args:
|
864
903
|
data(np.ndarray): The data to be processed.
|
865
904
|
|
@@ -878,6 +917,7 @@ class ImageProcessor:
|
|
878
917
|
def process_image(self, data: np.ndarray) -> np.ndarray:
|
879
918
|
"""
|
880
919
|
Process the data according to the configuration.
|
920
|
+
|
881
921
|
Args:
|
882
922
|
data(np.ndarray): The data to be processed.
|
883
923
|
|
@@ -914,6 +954,7 @@ class ProcessorWorker(QObject):
|
|
914
954
|
def process_image(self, device: str, image: np.ndarray):
|
915
955
|
"""
|
916
956
|
Process the image data.
|
957
|
+
|
917
958
|
Args:
|
918
959
|
device(str): The name of the device.
|
919
960
|
image(np.ndarray): The image data.
|
@@ -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
|
"""
|
@@ -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
|
@@ -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
|
"""
|
@@ -299,6 +308,7 @@ class BECWaveform(BECPlotBase):
|
|
299
308
|
def apply_config(self, config: dict | SubplotConfig, replot_last_scan: bool = False):
|
300
309
|
"""
|
301
310
|
Apply the configuration to the 1D waveform widget.
|
311
|
+
|
302
312
|
Args:
|
303
313
|
config(dict|SubplotConfig): Configuration settings.
|
304
314
|
replot_last_scan(bool, optional): If True, replot the last scan. Defaults to False.
|
@@ -339,8 +349,10 @@ class BECWaveform(BECPlotBase):
|
|
339
349
|
def add_curve_by_config(self, curve_config: CurveConfig | dict) -> BECCurve:
|
340
350
|
"""
|
341
351
|
Add a curve to the plot widget by its configuration.
|
352
|
+
|
342
353
|
Args:
|
343
354
|
curve_config(CurveConfig|dict): Configuration of the curve to be added.
|
355
|
+
|
344
356
|
Returns:
|
345
357
|
BECCurve: The curve object.
|
346
358
|
"""
|
@@ -354,8 +366,10 @@ class BECWaveform(BECPlotBase):
|
|
354
366
|
def get_curve_config(self, curve_id: str, dict_output: bool = True) -> CurveConfig | dict:
|
355
367
|
"""
|
356
368
|
Get the configuration of a curve by its ID.
|
369
|
+
|
357
370
|
Args:
|
358
371
|
curve_id(str): ID of the curve.
|
372
|
+
|
359
373
|
Returns:
|
360
374
|
CurveConfig|dict: Configuration of the curve.
|
361
375
|
"""
|
@@ -382,8 +396,10 @@ class BECWaveform(BECPlotBase):
|
|
382
396
|
def get_curve(self, identifier) -> BECCurve:
|
383
397
|
"""
|
384
398
|
Get the curve by its index or ID.
|
399
|
+
|
385
400
|
Args:
|
386
401
|
identifier(int|str): Identifier of the curve. Can be either an integer (index) or a string (curve_id).
|
402
|
+
|
387
403
|
Returns:
|
388
404
|
BECCurve: The curve object.
|
389
405
|
"""
|
@@ -407,6 +423,7 @@ class BECWaveform(BECPlotBase):
|
|
407
423
|
) -> BECCurve:
|
408
424
|
"""
|
409
425
|
Add a custom data curve to the plot widget.
|
426
|
+
|
410
427
|
Args:
|
411
428
|
x(list|np.ndarray): X data of the curve.
|
412
429
|
y(list|np.ndarray): Y data of the curve.
|
@@ -457,11 +474,13 @@ class BECWaveform(BECPlotBase):
|
|
457
474
|
) -> BECCurve:
|
458
475
|
"""
|
459
476
|
Add a curve object to the plot widget.
|
477
|
+
|
460
478
|
Args:
|
461
479
|
name(str): ID of the curve.
|
462
480
|
source(str): Source of the curve.
|
463
481
|
config(CurveConfig): Configuration of the curve.
|
464
482
|
data(tuple[list|np.ndarray,list|np.ndarray], optional): Data (x,y) to be plotted. Defaults to None.
|
483
|
+
|
465
484
|
Returns:
|
466
485
|
BECCurve: The curve object.
|
467
486
|
"""
|
@@ -489,6 +508,7 @@ class BECWaveform(BECPlotBase):
|
|
489
508
|
) -> BECCurve:
|
490
509
|
"""
|
491
510
|
Add a curve to the plot widget from the scan segment.
|
511
|
+
|
492
512
|
Args:
|
493
513
|
x_name(str): Name of the x signal.
|
494
514
|
x_entry(str): Entry of the x signal.
|
@@ -559,6 +579,7 @@ class BECWaveform(BECPlotBase):
|
|
559
579
|
) -> tuple[str, str, str | None]:
|
560
580
|
"""
|
561
581
|
Validate the signal name and entry.
|
582
|
+
|
562
583
|
Args:
|
563
584
|
x_name(str): Name of the x signal.
|
564
585
|
y_name(str): Name of the y signal.
|
@@ -567,6 +588,7 @@ class BECWaveform(BECPlotBase):
|
|
567
588
|
y_entry(str|None): Entry of the y signal.
|
568
589
|
z_entry(str|None): Entry of the z signal.
|
569
590
|
validate_bec(bool, optional): If True, validate the signal with BEC. Defaults to True.
|
591
|
+
|
570
592
|
Returns:
|
571
593
|
tuple[str,str,str|None]: Validated x, y, z entries.
|
572
594
|
"""
|
@@ -584,6 +606,7 @@ class BECWaveform(BECPlotBase):
|
|
584
606
|
def _check_curve_id(self, val: Any, dict_to_check: dict) -> bool:
|
585
607
|
"""
|
586
608
|
Check if val is in the values of the dict_to_check or in the values of the nested dictionaries.
|
609
|
+
|
587
610
|
Args:
|
588
611
|
val(Any): Value to check.
|
589
612
|
dict_to_check(dict): Dictionary to check.
|
@@ -602,6 +625,7 @@ class BECWaveform(BECPlotBase):
|
|
602
625
|
def remove_curve(self, *identifiers):
|
603
626
|
"""
|
604
627
|
Remove a curve from the plot widget.
|
628
|
+
|
605
629
|
Args:
|
606
630
|
*identifiers: Identifier of the curve to be removed. Can be either an integer (index) or a string (curve_id).
|
607
631
|
"""
|
@@ -618,6 +642,7 @@ class BECWaveform(BECPlotBase):
|
|
618
642
|
def _remove_curve_by_id(self, curve_id):
|
619
643
|
"""
|
620
644
|
Remove a curve by its ID from the plot widget.
|
645
|
+
|
621
646
|
Args:
|
622
647
|
curve_id(str): ID of the curve to be removed.
|
623
648
|
"""
|
@@ -634,6 +659,7 @@ class BECWaveform(BECPlotBase):
|
|
634
659
|
def _remove_curve_by_order(self, N):
|
635
660
|
"""
|
636
661
|
Remove a curve by its order from the plot widget.
|
662
|
+
|
637
663
|
Args:
|
638
664
|
N(int): Order of the curve to be removed.
|
639
665
|
"""
|
@@ -679,6 +705,7 @@ class BECWaveform(BECPlotBase):
|
|
679
705
|
def _update_scan_curves(self, data: ScanData):
|
680
706
|
"""
|
681
707
|
Update the scan curves with the data from the scan segment.
|
708
|
+
|
682
709
|
Args:
|
683
710
|
data(ScanData): Data from the scan segment.
|
684
711
|
"""
|
@@ -713,6 +740,7 @@ class BECWaveform(BECPlotBase):
|
|
713
740
|
def _make_z_gradient(self, data_z: list | np.ndarray, colormap: str) -> list | None:
|
714
741
|
"""
|
715
742
|
Make a gradient color for the z values.
|
743
|
+
|
716
744
|
Args:
|
717
745
|
data_z(list|np.ndarray): Z values.
|
718
746
|
colormap(str): Colormap for the gradient color.
|
@@ -735,6 +763,7 @@ class BECWaveform(BECPlotBase):
|
|
735
763
|
"""
|
736
764
|
Update the scan curves with the data from the scan storage.
|
737
765
|
Provide only one of scan_id or scan_index.
|
766
|
+
|
738
767
|
Args:
|
739
768
|
scan_id(str, optional): ScanID of the scan to be updated. Defaults to None.
|
740
769
|
scan_index(int, optional): Index of the scan to be updated. Defaults to None.
|
@@ -754,8 +783,10 @@ class BECWaveform(BECPlotBase):
|
|
754
783
|
def get_all_data(self, output: Literal["dict", "pandas"] = "dict") -> dict | pd.DataFrame:
|
755
784
|
"""
|
756
785
|
Extract all curve data into a dictionary or a pandas DataFrame.
|
786
|
+
|
757
787
|
Args:
|
758
788
|
output (Literal["dict", "pandas"]): Format of the output data.
|
789
|
+
|
759
790
|
Returns:
|
760
791
|
dict | pd.DataFrame: Data of all curves in the specified format.
|
761
792
|
"""
|