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.
Files changed (48) hide show
  1. bec_widgets/cli/__init__.py +1 -1
  2. bec_widgets/cli/bec_widgets_icon.png +0 -0
  3. bec_widgets/cli/client.py +328 -5
  4. bec_widgets/cli/client_utils.py +17 -5
  5. bec_widgets/cli/generate_cli.py +7 -3
  6. bec_widgets/cli/rpc_register.py +4 -0
  7. bec_widgets/cli/rpc_wigdet_handler.py +27 -0
  8. bec_widgets/cli/server.py +34 -9
  9. bec_widgets/examples/jupyter_console/jupyter_console_window.py +54 -2
  10. bec_widgets/examples/jupyter_console/jupyter_console_window.ui +26 -2
  11. bec_widgets/examples/jupyter_console/terminal_icon.png +0 -0
  12. bec_widgets/utils/__init__.py +1 -0
  13. bec_widgets/utils/bec_connector.py +18 -3
  14. bec_widgets/utils/bec_table.py +1 -0
  15. bec_widgets/utils/container_utils.py +3 -0
  16. bec_widgets/utils/crosshair.py +1 -0
  17. bec_widgets/utils/entry_validator.py +2 -0
  18. bec_widgets/utils/layout_manager.py +121 -0
  19. bec_widgets/utils/widget_io.py +5 -0
  20. bec_widgets/utils/yaml_dialog.py +2 -0
  21. bec_widgets/validation/monitor_config_validator.py +2 -1
  22. bec_widgets/widgets/__init__.py +1 -0
  23. bec_widgets/widgets/dock/__init__.py +2 -0
  24. bec_widgets/widgets/dock/dock.py +269 -0
  25. bec_widgets/widgets/dock/dock_area.py +225 -0
  26. bec_widgets/widgets/figure/figure.py +45 -16
  27. bec_widgets/widgets/plots/__init__.py +1 -1
  28. bec_widgets/widgets/plots/image.py +46 -9
  29. bec_widgets/widgets/plots/motor_map.py +17 -3
  30. bec_widgets/widgets/plots/plot_base.py +14 -3
  31. bec_widgets/widgets/plots/waveform.py +37 -10
  32. bec_widgets/widgets/scan_control/scan_control.py +10 -2
  33. bec_widgets/widgets/toolbar/toolbar.py +1 -0
  34. {bec_widgets-0.51.0.dist-info → bec_widgets-0.52.1.dist-info}/METADATA +1 -1
  35. {bec_widgets-0.51.0.dist-info → bec_widgets-0.52.1.dist-info}/RECORD +46 -40
  36. tests/end-2-end/conftest.py +19 -4
  37. tests/end-2-end/test_bec_dock_rpc_e2e.py +145 -0
  38. tests/end-2-end/test_bec_figure_rpc_e2e.py +17 -17
  39. tests/end-2-end/test_rpc_register_e2e.py +3 -3
  40. tests/unit_tests/test_bec_dock.py +114 -0
  41. tests/unit_tests/test_bec_figure.py +20 -22
  42. tests/unit_tests/test_generate_cli_client.py +1 -1
  43. tests/unit_tests/test_waveform1d.py +1 -1
  44. bec_widgets/simulations/__init__.py +0 -0
  45. bec_widgets/utils/ctrl_c.py +0 -39
  46. {bec_widgets-0.51.0.dist-info → bec_widgets-0.52.1.dist-info}/LICENSE +0 -0
  47. {bec_widgets-0.51.0.dist-info → bec_widgets-0.52.1.dist-info}/WHEEL +0 -0
  48. {bec_widgets-0.51.0.dist-info → bec_widgets-0.52.1.dist-info}/top_level.txt +0 -0
@@ -1,27 +1,25 @@
1
1
  # pylint: disable = no-name-in-module,missing-module-docstring
2
2
  from __future__ import annotations
3
3
 
4
- import itertools
5
- import os
4
+ import uuid
6
5
  from collections import defaultdict
7
- from typing import Literal, Optional, Type
6
+ from typing import Literal, Optional
8
7
 
9
8
  import numpy as np
10
9
  import pyqtgraph as pg
11
10
  import qdarktheme
12
11
  from pydantic import Field
13
- from pyqtgraph.Qt import uic
14
12
  from qtpy.QtCore import Signal as pyqtSignal
15
- from qtpy.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget
13
+ from qtpy.QtWidgets import QWidget
16
14
 
17
- from bec_widgets.utils import BECConnector, BECDispatcher, ConnectionConfig, WidgetContainerUtils
15
+ from bec_widgets.utils import BECConnector, ConnectionConfig, WidgetContainerUtils
18
16
  from bec_widgets.widgets.plots import (
19
17
  BECImageShow,
20
18
  BECMotorMap,
21
19
  BECPlotBase,
22
20
  BECWaveform,
21
+ SubplotConfig,
23
22
  Waveform1DConfig,
24
- WidgetConfig,
25
23
  )
26
24
  from bec_widgets.widgets.plots.image import ImageConfig
27
25
  from bec_widgets.widgets.plots.motor_map import MotorMapConfig
@@ -33,7 +31,7 @@ class FigureConfig(ConnectionConfig):
33
31
  theme: Literal["dark", "light"] = Field("dark", description="The theme of the figure widget.")
34
32
  num_cols: int = Field(1, description="The number of columns in the figure widget.")
35
33
  num_rows: int = Field(1, description="The number of rows in the figure widget.")
36
- widgets: dict[str, WidgetConfig] = Field(
34
+ widgets: dict[str, SubplotConfig] = Field(
37
35
  {}, description="The list of widgets to be added to the figure widget."
38
36
  )
39
37
 
@@ -43,7 +41,7 @@ class WidgetHandler:
43
41
 
44
42
  def __init__(self):
45
43
  self.widget_factory = {
46
- "PlotBase": (BECPlotBase, WidgetConfig),
44
+ "PlotBase": (BECPlotBase, SubplotConfig),
47
45
  "Waveform1D": (BECWaveform, Waveform1DConfig),
48
46
  "ImShow": (BECImageShow, ImageConfig),
49
47
  "MotorMap": (BECMotorMap, MotorMapConfig),
@@ -166,14 +164,29 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
166
164
 
167
165
  @widget_list.setter
168
166
  def widget_list(self, value: list[BECPlotBase]):
167
+ """
168
+ Access all widget in BECFigure as a list
169
+ Returns:
170
+ list[BECPlotBase]: List of all widgets in the figure.
171
+ """
169
172
  self._axes = value
170
173
 
171
174
  @property
172
175
  def widgets(self) -> dict:
176
+ """
177
+ All widgets within the figure with gui ids as keys.
178
+ Returns:
179
+ dict: All widgets within the figure.
180
+ """
173
181
  return self._widgets
174
182
 
175
183
  @widgets.setter
176
184
  def widgets(self, value: dict):
185
+ """
186
+ All widgets within the figure with gui ids as keys.
187
+ Returns:
188
+ dict: All widgets within the figure.
189
+ """
177
190
  self._widgets = value
178
191
 
179
192
  def add_plot(
@@ -197,6 +210,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
197
210
  ) -> BECWaveform:
198
211
  """
199
212
  Add a Waveform1D plot to the figure at the specified position.
213
+
200
214
  Args:
201
215
  widget_id(str): The unique identifier of the widget. If not provided, a unique ID will be generated.
202
216
  row(int): The row coordinate of the widget in the figure. If not provided, the next empty row will be used.
@@ -204,7 +218,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
204
218
  config(dict): Additional configuration for the widget.
205
219
  **axis_kwargs(dict): Additional axis properties to set on the widget after creation.
206
220
  """
207
- widget_id = WidgetContainerUtils.generate_unique_widget_id(self._widgets)
221
+ widget_id = str(uuid.uuid4())
208
222
  waveform = self.add_widget(
209
223
  widget_type="Waveform1D",
210
224
  widget_id=widget_id,
@@ -276,6 +290,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
276
290
  ) -> BECWaveform:
277
291
  """
278
292
  Add a 1D waveform plot to the figure. Always access the first waveform widget in the figure.
293
+
279
294
  Args:
280
295
  x_name(str): The name of the device for the x-axis.
281
296
  y_name(str): The name of the device for the y-axis.
@@ -362,6 +377,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
362
377
  ) -> BECImageShow:
363
378
  """
364
379
  Add an image to the figure. Always access the first image widget in the figure.
380
+
365
381
  Args:
366
382
  monitor(str): The name of the monitor to display.
367
383
  color_bar(Literal["simple","full"]): The type of color bar to display.
@@ -415,6 +431,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
415
431
  ) -> BECImageShow:
416
432
  """
417
433
  Add an image to the figure at the specified position.
434
+
418
435
  Args:
419
436
  monitor(str): The name of the monitor to display.
420
437
  color_bar(Literal["simple","full"]): The type of color bar to display.
@@ -430,7 +447,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
430
447
  BECImageShow: The image widget.
431
448
  """
432
449
 
433
- widget_id = WidgetContainerUtils.generate_unique_widget_id(self._widgets)
450
+ widget_id = str(uuid.uuid4())
434
451
  if config is None:
435
452
  config = ImageConfig(
436
453
  widget_class="BECImageShow",
@@ -469,6 +486,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
469
486
  def motor_map(self, motor_x: str = None, motor_y: str = None, **axis_kwargs) -> BECMotorMap:
470
487
  """
471
488
  Add a motor map to the figure. Always access the first motor map widget in the figure.
489
+
472
490
  Args:
473
491
  motor_x(str): The name of the motor for the X axis.
474
492
  motor_y(str): The name of the motor for the Y axis.
@@ -513,7 +531,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
513
531
  Returns:
514
532
  BECMotorMap: The motor map widget.
515
533
  """
516
- widget_id = WidgetContainerUtils.generate_unique_widget_id(self._widgets)
534
+ widget_id = str(uuid.uuid4())
517
535
  if config is None:
518
536
  config = MotorMapConfig(
519
537
  widget_class="BECMotorMap",
@@ -545,6 +563,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
545
563
  ) -> BECPlotBase:
546
564
  """
547
565
  Add a widget to the figure at the specified position.
566
+
548
567
  Args:
549
568
  widget_type(Literal["PlotBase","Waveform1D"]): The type of the widget to add.
550
569
  widget_id(str): The unique identifier of the widget. If not provided, a unique ID will be generated.
@@ -554,7 +573,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
554
573
  **axis_kwargs(dict): Additional axis properties to set on the widget after creation.
555
574
  """
556
575
  if not widget_id:
557
- widget_id = WidgetContainerUtils.generate_unique_widget_id(self._widgets)
576
+ widget_id = str(uuid.uuid4())
558
577
  if widget_id in self._widgets:
559
578
  raise ValueError(f"Widget with ID '{widget_id}' already exists.")
560
579
 
@@ -607,6 +626,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
607
626
  ) -> None:
608
627
  """
609
628
  Remove a widget from the figure. Can be removed by its unique identifier or by its coordinates.
629
+
610
630
  Args:
611
631
  row(int): The row coordinate of the widget to remove.
612
632
  col(int): The column coordinate of the widget to remove.
@@ -625,6 +645,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
625
645
  def change_theme(self, theme: Literal["dark", "light"]) -> None:
626
646
  """
627
647
  Change the theme of the figure widget.
648
+
628
649
  Args:
629
650
  theme(Literal["dark","light"]): The theme to set for the figure widget.
630
651
  """
@@ -635,6 +656,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
635
656
  def _remove_by_coordinates(self, row: int, col: int) -> None:
636
657
  """
637
658
  Remove a widget from the figure by its coordinates.
659
+
638
660
  Args:
639
661
  row(int): The row coordinate of the widget to remove.
640
662
  col(int): The column coordinate of the widget to remove.
@@ -648,6 +670,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
648
670
  def _remove_by_id(self, widget_id: str) -> None:
649
671
  """
650
672
  Remove a widget from the figure by its unique identifier.
673
+
651
674
  Args:
652
675
  widget_id(str): The unique identifier of the widget to remove.
653
676
  """
@@ -665,6 +688,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
665
688
  def axes(self, row: int, col: int) -> BECPlotBase:
666
689
  """
667
690
  Get widget by its coordinates in the figure.
691
+
668
692
  Args:
669
693
  row(int): the row coordinate
670
694
  col(int): the column coordinate
@@ -687,6 +711,7 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
687
711
  def _change_grid(self, widget_id: str, row: int, col: int):
688
712
  """
689
713
  Change the grid to reflect the new position of the widget.
714
+
690
715
  Args:
691
716
  widget_id(str): The unique identifier of the widget.
692
717
  row(int): The new row coordinate of the widget in the figure.
@@ -767,12 +792,16 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget):
767
792
 
768
793
  def clear_all(self):
769
794
  """Clear all widgets from the figure and reset to default state"""
770
- for widget in self._widgets.values():
771
- widget.cleanup()
772
- self.clear()
795
+ for widget in list(self._widgets.values()):
796
+ widget.remove()
797
+ # self.clear()
773
798
  self._widgets = defaultdict(dict)
774
799
  self.grid = []
775
800
  theme = self.config.theme
776
801
  self.config = FigureConfig(
777
802
  widget_class=self.__class__.__name__, gui_id=self.gui_id, theme=theme
778
803
  )
804
+
805
+ def cleanup(self):
806
+ self.clear_all()
807
+ super().cleanup()
@@ -1,4 +1,4 @@
1
1
  from .image import BECImageItem, BECImageShow, ImageItemConfig
2
2
  from .motor_map import BECMotorMap, MotorMapConfig
3
- from .plot_base import AxisConfig, BECPlotBase, WidgetConfig
3
+ from .plot_base import AxisConfig, BECPlotBase, SubplotConfig
4
4
  from .waveform import BECCurve, BECWaveform, Waveform1DConfig
@@ -14,7 +14,7 @@ from qtpy.QtWidgets import QWidget
14
14
 
15
15
  from bec_widgets.utils import BECConnector, ConnectionConfig, EntryValidator
16
16
 
17
- from .plot_base import BECPlotBase, WidgetConfig
17
+ from .plot_base import BECPlotBase, SubplotConfig
18
18
 
19
19
 
20
20
  class ProcessingConfig(BaseModel):
@@ -50,7 +50,7 @@ class ImageItemConfig(ConnectionConfig):
50
50
  )
51
51
 
52
52
 
53
- class ImageConfig(WidgetConfig):
53
+ class ImageConfig(SubplotConfig):
54
54
  images: dict[str, ImageItemConfig] = Field(
55
55
  {},
56
56
  description="The configuration of the images. The key is the name of the image (source).",
@@ -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.
@@ -288,10 +301,6 @@ class BECImageItem(BECConnector, pg.ImageItem):
288
301
  else:
289
302
  raise ValueError("style should be 'simple' or 'full'")
290
303
 
291
- def cleanup(self):
292
- """Clean up widget."""
293
- self.rpc_register.remove_rpc(self)
294
-
295
304
 
296
305
  class BECImageShow(BECPlotBase):
297
306
  USER_ACCESS = [
@@ -367,6 +376,7 @@ class BECImageShow(BECPlotBase):
367
376
  def find_image_by_monitor(self, item_id: str) -> BECImageItem:
368
377
  """
369
378
  Find the widget by its gui_id.
379
+
370
380
  Args:
371
381
  item_id(str): The gui_id of the widget.
372
382
 
@@ -382,11 +392,12 @@ class BECImageShow(BECPlotBase):
382
392
  if result is not None:
383
393
  return result
384
394
 
385
- def apply_config(self, config: dict | WidgetConfig):
395
+ def apply_config(self, config: dict | SubplotConfig):
386
396
  """
387
397
  Apply the configuration to the 1D waveform widget.
398
+
388
399
  Args:
389
- config(dict|WidgetConfig): Configuration settings.
400
+ config(dict|SubplotConfig): Configuration settings.
390
401
  replot_last_scan(bool, optional): If True, replot the last scan. Defaults to False.
391
402
  """
392
403
  if isinstance(config, dict):
@@ -420,6 +431,7 @@ class BECImageShow(BECPlotBase):
420
431
  def add_image_by_config(self, config: ImageItemConfig | dict) -> BECImageItem:
421
432
  """
422
433
  Add an image to the widget by configuration.
434
+
423
435
  Args:
424
436
  config(ImageItemConfig|dict): The configuration of the image.
425
437
 
@@ -436,6 +448,7 @@ class BECImageShow(BECPlotBase):
436
448
  def get_image_config(self, image_id, dict_output: bool = True) -> ImageItemConfig | dict:
437
449
  """
438
450
  Get the configuration of the image.
451
+
439
452
  Args:
440
453
  image_id(str): The ID of the image.
441
454
  dict_output(bool): Whether to return the configuration as a dictionary. Defaults to True.
@@ -477,6 +490,7 @@ class BECImageShow(BECPlotBase):
477
490
  def get_image_dict(self) -> dict[str, dict[str, BECImageItem]]:
478
491
  """
479
492
  Get all images.
493
+
480
494
  Returns:
481
495
  dict[str, dict[str, BECImageItem]]: The dictionary of images.
482
496
  """
@@ -578,6 +592,7 @@ class BECImageShow(BECPlotBase):
578
592
  """
579
593
  Set the range of the color bar.
580
594
  If name is not specified, then set vrange for all images.
595
+
581
596
  Args:
582
597
  vmin(float): Minimum value of the color bar.
583
598
  vmax(float): Maximum value of the color bar.
@@ -589,6 +604,7 @@ class BECImageShow(BECPlotBase):
589
604
  """
590
605
  Set the color map of the image.
591
606
  If name is not specified, then set color map for all images.
607
+
592
608
  Args:
593
609
  cmap(str): The color map of the image.
594
610
  name(str): The name of the image. If None, apply to all images.
@@ -598,6 +614,7 @@ class BECImageShow(BECPlotBase):
598
614
  def set_autorange(self, enable: bool = False, name: str = None):
599
615
  """
600
616
  Set the autoscale of the image.
617
+
601
618
  Args:
602
619
  enable(bool): Whether to autoscale the color bar.
603
620
  name(str): The name of the image. If None, apply to all images.
@@ -608,6 +625,7 @@ class BECImageShow(BECPlotBase):
608
625
  """
609
626
  Set the monitor of the image.
610
627
  If name is not specified, then set monitor for all images.
628
+
611
629
  Args:
612
630
  monitor(str): The name of the monitor.
613
631
  name(str): The name of the image. If None, apply to all images.
@@ -618,6 +636,7 @@ class BECImageShow(BECPlotBase):
618
636
  """
619
637
  Set the post processing of the image.
620
638
  If name is not specified, then set post processing for all images.
639
+
621
640
  Args:
622
641
  name(str): The name of the image. If None, apply to all images.
623
642
  **kwargs: Keyword arguments for the properties to be set.
@@ -632,6 +651,7 @@ class BECImageShow(BECPlotBase):
632
651
  def set_image_properties(self, name: str = None, **kwargs):
633
652
  """
634
653
  Set the properties of the image.
654
+
635
655
  Args:
636
656
  name(str): The name of the image. If None, apply to all images.
637
657
  **kwargs: Keyword arguments for the properties to be set.
@@ -652,6 +672,7 @@ class BECImageShow(BECPlotBase):
652
672
  """
653
673
  Set the FFT of the image.
654
674
  If name is not specified, then set FFT for all images.
675
+
655
676
  Args:
656
677
  enable(bool): Whether to perform FFT on the monitor data.
657
678
  name(str): The name of the image. If None, apply to all images.
@@ -662,6 +683,7 @@ class BECImageShow(BECPlotBase):
662
683
  """
663
684
  Set the log of the image.
664
685
  If name is not specified, then set log for all images.
686
+
665
687
  Args:
666
688
  enable(bool): Whether to perform log on the monitor data.
667
689
  name(str): The name of the image. If None, apply to all images.
@@ -672,6 +694,7 @@ class BECImageShow(BECPlotBase):
672
694
  """
673
695
  Set the rotation of the image.
674
696
  If name is not specified, then set rotation for all images.
697
+
675
698
  Args:
676
699
  deg_90(int): The rotation angle of the monitor data before displaying.
677
700
  name(str): The name of the image. If None, apply to all images.
@@ -682,6 +705,7 @@ class BECImageShow(BECPlotBase):
682
705
  """
683
706
  Set the transpose of the image.
684
707
  If name is not specified, then set transpose for all images.
708
+
685
709
  Args:
686
710
  enable(bool): Whether to transpose the monitor data before displaying.
687
711
  name(str): The name of the image. If None, apply to all images.
@@ -691,6 +715,7 @@ class BECImageShow(BECPlotBase):
691
715
  def toggle_threading(self, use_threading: bool):
692
716
  """
693
717
  Toggle threading for the widgets postprocessing and updating.
718
+
694
719
  Args:
695
720
  use_threading(bool): Whether to use threading.
696
721
  """
@@ -702,6 +727,7 @@ class BECImageShow(BECPlotBase):
702
727
  def on_image_update(self, msg: dict):
703
728
  """
704
729
  Update the image of the device monitor from bec.
730
+
705
731
  Args:
706
732
  msg(dict): The message from bec.
707
733
  """
@@ -720,6 +746,7 @@ class BECImageShow(BECPlotBase):
720
746
  def update_image(self, device: str, data: np.ndarray):
721
747
  """
722
748
  Update the image of the device monitor.
749
+
723
750
  Args:
724
751
  device(str): The name of the device.
725
752
  data(np.ndarray): The data to be updated.
@@ -730,6 +757,7 @@ class BECImageShow(BECPlotBase):
730
757
  def _connect_device_monitor(self, monitor: str):
731
758
  """
732
759
  Connect to the device monitor.
760
+
733
761
  Args:
734
762
  monitor(str): The name of the monitor.
735
763
  """
@@ -764,6 +792,7 @@ class BECImageShow(BECPlotBase):
764
792
  def _check_image_id(self, val: Any, dict_to_check: dict) -> bool:
765
793
  """
766
794
  Check if val is in the values of the dict_to_check or in the values of the nested dictionaries.
795
+
767
796
  Args:
768
797
  val(Any): Value to check.
769
798
  dict_to_check(dict): Dictionary to check.
@@ -782,6 +811,7 @@ class BECImageShow(BECPlotBase):
782
811
  def _validate_monitor(self, monitor: str, validate_bec: bool = True):
783
812
  """
784
813
  Validate the monitor name.
814
+
785
815
  Args:
786
816
  monitor(str): The name of the monitor.
787
817
  validate_bec(bool): Whether to validate the monitor name with BEC.
@@ -806,7 +836,7 @@ class BECImageShow(BECPlotBase):
806
836
  for image in self.images:
807
837
  image.cleanup()
808
838
 
809
- self.rpc_register.remove_rpc(self)
839
+ super().cleanup()
810
840
 
811
841
 
812
842
  class ImageProcessor:
@@ -822,6 +852,7 @@ class ImageProcessor:
822
852
  def set_config(self, config: ProcessingConfig):
823
853
  """
824
854
  Set the configuration of the processor.
855
+
825
856
  Args:
826
857
  config(ProcessingConfig): The configuration of the processor.
827
858
  """
@@ -830,6 +861,7 @@ class ImageProcessor:
830
861
  def FFT(self, data: np.ndarray) -> np.ndarray:
831
862
  """
832
863
  Perform FFT on the data.
864
+
833
865
  Args:
834
866
  data(np.ndarray): The data to be processed.
835
867
 
@@ -841,6 +873,7 @@ class ImageProcessor:
841
873
  def rotation(self, data: np.ndarray, rotate_90: int) -> np.ndarray:
842
874
  """
843
875
  Rotate the data by 90 degrees n times.
876
+
844
877
  Args:
845
878
  data(np.ndarray): The data to be processed.
846
879
  rotate_90(int): The number of 90 degree rotations.
@@ -853,6 +886,7 @@ class ImageProcessor:
853
886
  def transpose(self, data: np.ndarray) -> np.ndarray:
854
887
  """
855
888
  Transpose the data.
889
+
856
890
  Args:
857
891
  data(np.ndarray): The data to be processed.
858
892
 
@@ -864,6 +898,7 @@ class ImageProcessor:
864
898
  def log(self, data: np.ndarray) -> np.ndarray:
865
899
  """
866
900
  Perform log on the data.
901
+
867
902
  Args:
868
903
  data(np.ndarray): The data to be processed.
869
904
 
@@ -882,6 +917,7 @@ class ImageProcessor:
882
917
  def process_image(self, data: np.ndarray) -> np.ndarray:
883
918
  """
884
919
  Process the data according to the configuration.
920
+
885
921
  Args:
886
922
  data(np.ndarray): The data to be processed.
887
923
 
@@ -918,6 +954,7 @@ class ProcessorWorker(QObject):
918
954
  def process_image(self, device: str, image: np.ndarray):
919
955
  """
920
956
  Process the image data.
957
+
921
958
  Args:
922
959
  device(str): The name of the device.
923
960
  image(np.ndarray): The image data.