bec-widgets 0.52.0__py3-none-any.whl → 0.53.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.
- .git_hooks/pre-commit +3 -0
- .gitignore +177 -0
- .gitlab/issue_templates/bug_report_template.md +17 -0
- .gitlab/issue_templates/documentation_update_template.md +27 -0
- .gitlab/issue_templates/feature_request_template.md +40 -0
- .gitlab/merge_request_templates/default.md +28 -0
- .gitlab-ci.yml +225 -0
- .pylintrc +581 -0
- .readthedocs.yaml +25 -0
- CHANGELOG.md +176 -0
- PKG-INFO +33 -0
- bec_widgets-0.52.0.dist-info/METADATA → README.md +6 -42
- bec_widgets/cli/client.py +132 -17
- 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 +2 -3
- bec_widgets/examples/modular_app/modular.ui +92 -0
- bec_widgets/examples/modular_app/modular_app.py +197 -0
- bec_widgets/examples/motor_movement/motor_control_compilations.py +1 -1
- bec_widgets/examples/motor_movement/motor_example.py +3 -12
- bec_widgets/utils/bec_connector.py +7 -0
- bec_widgets/utils/bec_dispatcher.py +1 -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 +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 +6 -4
- bec_widgets/widgets/figure/figure.py +15 -15
- bec_widgets/widgets/monitor/config_dialog.py +3 -19
- bec_widgets/widgets/monitor/example_configs/config_device.yaml +60 -0
- bec_widgets/widgets/monitor/example_configs/config_scans.yaml +92 -0
- bec_widgets/widgets/motor_map/motor_map.py +3 -14
- bec_widgets/widgets/plots/image.py +41 -0
- bec_widgets/widgets/plots/motor_map.py +16 -9
- 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 +11 -5
- bec_widgets/widgets/toolbar/toolbar.py +1 -0
- bec_widgets-0.53.0.dist-info/METADATA +33 -0
- bec_widgets-0.53.0.dist-info/RECORD +156 -0
- {bec_widgets-0.52.0.dist-info → bec_widgets-0.53.0.dist-info}/WHEEL +1 -2
- bec_widgets-0.53.0.dist-info/licenses/LICENSE +29 -0
- docs/Makefile +20 -0
- docs/_templates/custom-class-template.rst +34 -0
- docs/_templates/custom-module-template.rst +66 -0
- docs/conf.py +81 -0
- docs/developer/developer.md +26 -0
- docs/developer/reference.md +10 -0
- docs/index.md +39 -0
- docs/introduction/introduction.md +18 -0
- docs/make.bat +35 -0
- docs/requirements.txt +10 -0
- docs/user/apps/modular_app.md +6 -0
- docs/user/apps/motor_app.md +34 -0
- docs/user/apps/motor_app_10fps.gif +0 -0
- docs/user/apps/plot_app.md +6 -0
- docs/user/apps.md +39 -0
- docs/user/customisation.md +13 -0
- docs/user/installation.md +46 -0
- docs/user/user.md +38 -0
- docs/user/widgets/motor.gif +0 -0
- docs/user/widgets/scatter_2D.gif +0 -0
- docs/user/widgets/w1D.gif +0 -0
- docs/user/widgets.md +41 -0
- pyproject.toml +94 -0
- tests/unit_tests/test_bec_dispatcher.py +3 -26
- tests/unit_tests/test_bec_figure.py +1 -5
- tests/unit_tests/test_bec_motor_map.py +1 -4
- tests/unit_tests/test_config_dialog.py +1 -5
- tests/unit_tests/test_configs/config_device.yaml +33 -0
- tests/unit_tests/test_configs/config_device_no_entry.yaml +27 -0
- tests/unit_tests/test_configs/config_scan.yaml +82 -0
- tests/unit_tests/test_motor_control.py +1 -1
- tests/unit_tests/test_motor_map.py +5 -20
- tests/unit_tests/test_stream_plot.py +2 -12
- bec_widgets/utils/ctrl_c.py +0 -39
- bec_widgets-0.52.0.dist-info/RECORD +0 -115
- bec_widgets-0.52.0.dist-info/top_level.txt +0 -2
- /bec_widgets-0.52.0.dist-info/LICENSE → /LICENSE +0 -0
- /bec_widgets/{simulations/__init__.py → examples/modular_app/___init__.py} +0 -0
@@ -210,6 +210,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
210
210
|
) -> BECWaveform:
|
211
211
|
"""
|
212
212
|
Add a Waveform1D plot to the figure at the specified position.
|
213
|
+
|
213
214
|
Args:
|
214
215
|
widget_id(str): The unique identifier of the widget. If not provided, a unique ID will be generated.
|
215
216
|
row(int): The row coordinate of the widget in the figure. If not provided, the next empty row will be used.
|
@@ -262,12 +263,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
262
263
|
)
|
263
264
|
# User wants to add custom curve
|
264
265
|
elif x is not None and y is not None and x_name is None and y_name is None:
|
265
|
-
waveform.add_curve_custom(
|
266
|
-
x=x,
|
267
|
-
y=y,
|
268
|
-
color=color,
|
269
|
-
label=label,
|
270
|
-
)
|
266
|
+
waveform.add_curve_custom(x=x, y=y, color=color, label=label)
|
271
267
|
|
272
268
|
return waveform
|
273
269
|
|
@@ -289,6 +285,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
289
285
|
) -> BECWaveform:
|
290
286
|
"""
|
291
287
|
Add a 1D waveform plot to the figure. Always access the first waveform widget in the figure.
|
288
|
+
|
292
289
|
Args:
|
293
290
|
x_name(str): The name of the device for the x-axis.
|
294
291
|
y_name(str): The name of the device for the y-axis.
|
@@ -352,12 +349,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
352
349
|
elif (
|
353
350
|
x is not None and y is not None and x_name is None and y_name is None and z_name is None
|
354
351
|
):
|
355
|
-
waveform.add_curve_custom(
|
356
|
-
x=x,
|
357
|
-
y=y,
|
358
|
-
color=color,
|
359
|
-
label=label,
|
360
|
-
)
|
352
|
+
waveform.add_curve_custom(x=x, y=y, color=color, label=label)
|
361
353
|
else:
|
362
354
|
raise ValueError(
|
363
355
|
"Invalid input. Provide either device names (x_name, y_name) or custom data."
|
@@ -375,6 +367,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
375
367
|
) -> BECImageShow:
|
376
368
|
"""
|
377
369
|
Add an image to the figure. Always access the first image widget in the figure.
|
370
|
+
|
378
371
|
Args:
|
379
372
|
monitor(str): The name of the monitor to display.
|
380
373
|
color_bar(Literal["simple","full"]): The type of color bar to display.
|
@@ -428,6 +421,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
428
421
|
) -> BECImageShow:
|
429
422
|
"""
|
430
423
|
Add an image to the figure at the specified position.
|
424
|
+
|
431
425
|
Args:
|
432
426
|
monitor(str): The name of the monitor to display.
|
433
427
|
color_bar(Literal["simple","full"]): The type of color bar to display.
|
@@ -482,6 +476,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
482
476
|
def motor_map(self, motor_x: str = None, motor_y: str = None, **axis_kwargs) -> BECMotorMap:
|
483
477
|
"""
|
484
478
|
Add a motor map to the figure. Always access the first motor map widget in the figure.
|
479
|
+
|
485
480
|
Args:
|
486
481
|
motor_x(str): The name of the motor for the X axis.
|
487
482
|
motor_y(str): The name of the motor for the Y axis.
|
@@ -529,9 +524,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
529
524
|
widget_id = str(uuid.uuid4())
|
530
525
|
if config is None:
|
531
526
|
config = MotorMapConfig(
|
532
|
-
widget_class="BECMotorMap",
|
533
|
-
gui_id=widget_id,
|
534
|
-
parent_id=self.gui_id,
|
527
|
+
widget_class="BECMotorMap", gui_id=widget_id, parent_id=self.gui_id
|
535
528
|
)
|
536
529
|
motor_map = self.add_widget(
|
537
530
|
widget_type="MotorMap",
|
@@ -558,6 +551,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
558
551
|
) -> BECPlotBase:
|
559
552
|
"""
|
560
553
|
Add a widget to the figure at the specified position.
|
554
|
+
|
561
555
|
Args:
|
562
556
|
widget_type(Literal["PlotBase","Waveform1D"]): The type of the widget to add.
|
563
557
|
widget_id(str): The unique identifier of the widget. If not provided, a unique ID will be generated.
|
@@ -620,6 +614,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
620
614
|
) -> None:
|
621
615
|
"""
|
622
616
|
Remove a widget from the figure. Can be removed by its unique identifier or by its coordinates.
|
617
|
+
|
623
618
|
Args:
|
624
619
|
row(int): The row coordinate of the widget to remove.
|
625
620
|
col(int): The column coordinate of the widget to remove.
|
@@ -638,6 +633,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
638
633
|
def change_theme(self, theme: Literal["dark", "light"]) -> None:
|
639
634
|
"""
|
640
635
|
Change the theme of the figure widget.
|
636
|
+
|
641
637
|
Args:
|
642
638
|
theme(Literal["dark","light"]): The theme to set for the figure widget.
|
643
639
|
"""
|
@@ -648,6 +644,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
648
644
|
def _remove_by_coordinates(self, row: int, col: int) -> None:
|
649
645
|
"""
|
650
646
|
Remove a widget from the figure by its coordinates.
|
647
|
+
|
651
648
|
Args:
|
652
649
|
row(int): The row coordinate of the widget to remove.
|
653
650
|
col(int): The column coordinate of the widget to remove.
|
@@ -661,6 +658,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
661
658
|
def _remove_by_id(self, widget_id: str) -> None:
|
662
659
|
"""
|
663
660
|
Remove a widget from the figure by its unique identifier.
|
661
|
+
|
664
662
|
Args:
|
665
663
|
widget_id(str): The unique identifier of the widget to remove.
|
666
664
|
"""
|
@@ -678,6 +676,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
678
676
|
def axes(self, row: int, col: int) -> BECPlotBase:
|
679
677
|
"""
|
680
678
|
Get widget by its coordinates in the figure.
|
679
|
+
|
681
680
|
Args:
|
682
681
|
row(int): the row coordinate
|
683
682
|
col(int): the column coordinate
|
@@ -700,6 +699,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
|
|
700
699
|
def _change_grid(self, widget_id: str, row: int, col: int):
|
701
700
|
"""
|
702
701
|
Change the grid to reflect the new position of the widget.
|
702
|
+
|
703
703
|
Args:
|
704
704
|
widget_id(str): The unique identifier of the widget.
|
705
705
|
row(int): The new row coordinate of the widget in the figure.
|
@@ -113,10 +113,7 @@ CONFIG_SCAN_MODE = {
|
|
113
113
|
"sources": [
|
114
114
|
{
|
115
115
|
"type": "scan_segment",
|
116
|
-
"signals": {
|
117
|
-
"x": [{"name": "samy"}],
|
118
|
-
"y": [{"name": "gauss_adc2"}],
|
119
|
-
},
|
116
|
+
"signals": {"x": [{"name": "samy"}], "y": [{"name": "gauss_adc2"}]},
|
120
117
|
}
|
121
118
|
],
|
122
119
|
},
|
@@ -172,12 +169,7 @@ CONFIG_SCAN_MODE = {
|
|
172
169
|
class ConfigDialog(QWidget, Ui_Form):
|
173
170
|
config_updated = pyqtSignal(dict)
|
174
171
|
|
175
|
-
def __init__(
|
176
|
-
self,
|
177
|
-
client=None,
|
178
|
-
default_config=None,
|
179
|
-
skip_validation: bool = False,
|
180
|
-
):
|
172
|
+
def __init__(self, client=None, default_config=None, skip_validation: bool = False):
|
181
173
|
super(ConfigDialog, self).__init__()
|
182
174
|
self.setupUi(self)
|
183
175
|
|
@@ -386,15 +378,7 @@ class ConfigDialog(QWidget, Ui_Form):
|
|
386
378
|
"plot_name": self.safe_text(ui.lineEdit_plot_title),
|
387
379
|
"x_label": self.safe_text(ui.lineEdit_x_label),
|
388
380
|
"y_label": self.safe_text(ui.lineEdit_y_label),
|
389
|
-
"sources": [
|
390
|
-
{
|
391
|
-
"type": "scan_segment",
|
392
|
-
"signals": {
|
393
|
-
"x": x_signals,
|
394
|
-
"y": y_signals,
|
395
|
-
},
|
396
|
-
}
|
397
|
-
],
|
381
|
+
"sources": [{"type": "scan_segment", "signals": {"x": x_signals, "y": y_signals}}],
|
398
382
|
}
|
399
383
|
|
400
384
|
return plot_data
|
@@ -0,0 +1,60 @@
|
|
1
|
+
plot_settings:
|
2
|
+
background_color: "black"
|
3
|
+
num_columns: 2
|
4
|
+
colormap: "viridis"
|
5
|
+
scan_types: False
|
6
|
+
|
7
|
+
plot_data:
|
8
|
+
- plot_name: "BPM4i plots vs samy"
|
9
|
+
x:
|
10
|
+
label: 'Motor Y'
|
11
|
+
signals:
|
12
|
+
- name: "samy"
|
13
|
+
entry: "samy"
|
14
|
+
y:
|
15
|
+
label: 'bpm4i'
|
16
|
+
signals:
|
17
|
+
- name: "bpm4i"
|
18
|
+
entry: "bpm4i"
|
19
|
+
|
20
|
+
- plot_name: "BPM4i plots vs samx"
|
21
|
+
x:
|
22
|
+
label: 'Motor X'
|
23
|
+
signals:
|
24
|
+
- name: "samx"
|
25
|
+
entry: "samx"
|
26
|
+
y:
|
27
|
+
label: 'bpm6b'
|
28
|
+
signals:
|
29
|
+
- name: "bpm6b"
|
30
|
+
entry: "bpm6b"
|
31
|
+
- name: "samy"
|
32
|
+
entry: "samy"
|
33
|
+
|
34
|
+
- plot_name: "Multiple Gaussian"
|
35
|
+
x:
|
36
|
+
label: 'Motor X'
|
37
|
+
signals:
|
38
|
+
- name: "samx"
|
39
|
+
entry: "samx"
|
40
|
+
y:
|
41
|
+
label: 'Gauss ADC'
|
42
|
+
signals:
|
43
|
+
- name: "gauss_adc1"
|
44
|
+
entry: "gauss_adc1"
|
45
|
+
- name: "gauss_adc2"
|
46
|
+
entry: "gauss_adc2"
|
47
|
+
- name: "gauss_adc3"
|
48
|
+
entry: "gauss_adc3"
|
49
|
+
|
50
|
+
- plot_name: "Linear Signals"
|
51
|
+
x:
|
52
|
+
label: 'Motor X'
|
53
|
+
signals:
|
54
|
+
- name: "samy"
|
55
|
+
entry: "samy"
|
56
|
+
y:
|
57
|
+
label: 'Motor Y'
|
58
|
+
signals:
|
59
|
+
- name: "samy"
|
60
|
+
entry: "samy"
|
@@ -0,0 +1,92 @@
|
|
1
|
+
plot_settings:
|
2
|
+
background_color: "black"
|
3
|
+
num_columns: 2
|
4
|
+
colormap: "plasma"
|
5
|
+
scan_types: True
|
6
|
+
|
7
|
+
plot_data:
|
8
|
+
line_scan:
|
9
|
+
|
10
|
+
- plot_name: "BPM plot"
|
11
|
+
x:
|
12
|
+
label: 'Motor X'
|
13
|
+
signals:
|
14
|
+
- name: "samx"
|
15
|
+
entry: "samx"
|
16
|
+
y:
|
17
|
+
label: 'BPM'
|
18
|
+
signals:
|
19
|
+
- name: "gauss_bpm"
|
20
|
+
entry: "gauss_bpm"
|
21
|
+
- name: "gauss_adc1"
|
22
|
+
entry: "gauss_adc1"
|
23
|
+
- name: "gauss_adc2"
|
24
|
+
entry: "gauss_adc2"
|
25
|
+
|
26
|
+
- plot_name: "Multi"
|
27
|
+
x:
|
28
|
+
label: 'Motor X'
|
29
|
+
signals:
|
30
|
+
- name: "samx"
|
31
|
+
entry: "samx"
|
32
|
+
y:
|
33
|
+
label: 'Multi'
|
34
|
+
signals:
|
35
|
+
- name: "gauss_bpm"
|
36
|
+
entry: "gauss_bpm"
|
37
|
+
- name: "samx"
|
38
|
+
entry: "samx"
|
39
|
+
|
40
|
+
grid_scan:
|
41
|
+
- plot_name: "Grid plot 1"
|
42
|
+
x:
|
43
|
+
label: 'Motor X'
|
44
|
+
signals:
|
45
|
+
- name: "samx"
|
46
|
+
entry: "samx"
|
47
|
+
y:
|
48
|
+
label: 'BPM'
|
49
|
+
signals:
|
50
|
+
- name: "gauss_bpm"
|
51
|
+
entry: "gauss_bpm"
|
52
|
+
- name: "gauss_adc1"
|
53
|
+
entry: "gauss_adc1"
|
54
|
+
|
55
|
+
- plot_name: "Grid plot 2"
|
56
|
+
x:
|
57
|
+
label: 'Motor X'
|
58
|
+
signals:
|
59
|
+
- name: "samx"
|
60
|
+
entry: "samx"
|
61
|
+
y:
|
62
|
+
label: 'BPM'
|
63
|
+
signals:
|
64
|
+
- name: "gauss_bpm"
|
65
|
+
entry: "gauss_bpm"
|
66
|
+
- name: "gauss_adc1"
|
67
|
+
entry: "gauss_adc1"
|
68
|
+
|
69
|
+
- plot_name: "Grid plot 3"
|
70
|
+
x:
|
71
|
+
label: 'Motor Y'
|
72
|
+
signals:
|
73
|
+
- name: "samy"
|
74
|
+
entry: "samy"
|
75
|
+
y:
|
76
|
+
label: 'BPM'
|
77
|
+
signals:
|
78
|
+
- name: "gauss_bpm"
|
79
|
+
entry: "gauss_bpm"
|
80
|
+
|
81
|
+
- plot_name: "Grid plot 4"
|
82
|
+
x:
|
83
|
+
label: 'Motor Y'
|
84
|
+
signals:
|
85
|
+
- name: "samy"
|
86
|
+
entry: "samy"
|
87
|
+
y:
|
88
|
+
label: 'BPM'
|
89
|
+
signals:
|
90
|
+
- name: "gauss_adc3"
|
91
|
+
entry: "gauss_adc3"
|
92
|
+
|
@@ -214,10 +214,7 @@ class MotorMap(pg.GraphicsLayoutWidget):
|
|
214
214
|
endpoints.append(MessageEndpoints.device_readback(motor))
|
215
215
|
|
216
216
|
# Connect all topics to a single slot
|
217
|
-
bec_dispatcher.connect_slot(
|
218
|
-
self.on_device_readback,
|
219
|
-
endpoints,
|
220
|
-
)
|
217
|
+
bec_dispatcher.connect_slot(self.on_device_readback, endpoints)
|
221
218
|
|
222
219
|
def _add_limits_to_plot_data(self):
|
223
220
|
"""
|
@@ -491,11 +488,7 @@ class MotorMap(pg.GraphicsLayoutWidget):
|
|
491
488
|
|
492
489
|
# Update the scatter plot
|
493
490
|
self.curves_data[plot_name]["pos"].setData(
|
494
|
-
x=motor_x_data,
|
495
|
-
y=motor_y_data,
|
496
|
-
brush=brushes,
|
497
|
-
pen=None,
|
498
|
-
size=self.scatter_size,
|
491
|
+
x=motor_x_data, y=motor_y_data, brush=brushes, pen=None, size=self.scatter_size
|
499
492
|
)
|
500
493
|
|
501
494
|
# Get last know position for crosshair
|
@@ -595,11 +588,7 @@ if __name__ == "__main__": # pragma: no cover
|
|
595
588
|
client = BECDispatcher().client
|
596
589
|
client.start()
|
597
590
|
app = QApplication(sys.argv)
|
598
|
-
motor_map = MotorMap(
|
599
|
-
config=config,
|
600
|
-
gui_id=args.id,
|
601
|
-
skip_validation=True,
|
602
|
-
)
|
591
|
+
motor_map = MotorMap(config=config, gui_id=args.id, skip_validation=True)
|
603
592
|
motor_map.show()
|
604
593
|
|
605
594
|
sys.exit(app.exec())
|
@@ -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.
|