bec-widgets 0.94.7__py3-none-any.whl → 0.95.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.
Files changed (80) hide show
  1. CHANGELOG.md +30 -34
  2. PKG-INFO +1 -1
  3. bec_widgets/cli/client.py +19 -0
  4. bec_widgets/widgets/device_browser/__init__.py +0 -0
  5. bec_widgets/widgets/device_browser/device_browser.py +107 -0
  6. bec_widgets/widgets/device_browser/device_browser.pyproject +1 -0
  7. bec_widgets/widgets/device_browser/device_browser.ui +44 -0
  8. bec_widgets/widgets/device_browser/device_browser_plugin.py +54 -0
  9. bec_widgets/widgets/device_browser/device_item/__init__.py +1 -0
  10. bec_widgets/widgets/device_browser/device_item/device_item.py +53 -0
  11. bec_widgets/widgets/device_browser/register_device_browser.py +15 -0
  12. {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.0.dist-info}/METADATA +1 -1
  13. {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.0.dist-info}/RECORD +73 -33
  14. docs/_static/custom.css +10 -10
  15. docs/assets/widget_screenshots/buttons.png +0 -0
  16. docs/assets/widget_screenshots/device_box.png +0 -0
  17. docs/assets/widget_screenshots/device_browser.png +0 -0
  18. docs/assets/widget_screenshots/device_inputs.png +0 -0
  19. docs/assets/widget_screenshots/dock_area.png +0 -0
  20. docs/assets/widget_screenshots/figure.png +0 -0
  21. docs/assets/widget_screenshots/image_widget.png +0 -0
  22. docs/assets/widget_screenshots/motor_map_widget.png +0 -0
  23. docs/assets/widget_screenshots/position_indicator.png +0 -0
  24. docs/assets/widget_screenshots/queue.png +0 -0
  25. docs/assets/widget_screenshots/ring_progress_bar.png +0 -0
  26. docs/assets/widget_screenshots/scan_controller.png +0 -0
  27. docs/assets/widget_screenshots/spinner.gif +0 -0
  28. docs/assets/widget_screenshots/status_box.png +0 -0
  29. docs/assets/widget_screenshots/text_box.png +0 -0
  30. docs/assets/widget_screenshots/toggle.png +0 -0
  31. docs/assets/widget_screenshots/waveform_widget.png +0 -0
  32. docs/assets/widget_screenshots/website.png +0 -0
  33. docs/conf.py +1 -0
  34. docs/developer/developer.md +2 -0
  35. docs/index.md +4 -0
  36. docs/requirements.txt +1 -0
  37. docs/user/user.md +4 -0
  38. docs/user/widgets/bec_figure/bec_figure.md +105 -0
  39. docs/user/widgets/bec_status_box/bec_status_box.md +38 -0
  40. docs/user/widgets/buttons/buttons.md +50 -0
  41. docs/user/widgets/device_browser/device_browser.md +36 -0
  42. docs/user/widgets/device_browser/device_browser.png +0 -0
  43. docs/user/widgets/device_input/device_input.md +100 -0
  44. docs/user/widgets/dock_area/BECDockArea.png +0 -0
  45. docs/user/widgets/dock_area/bec_dock_area.md +107 -0
  46. docs/user/widgets/image/image_widget.md +84 -0
  47. docs/user/widgets/motor_map/motor_map.md +80 -0
  48. docs/user/widgets/position_indicator/position_indicator.md +76 -0
  49. docs/user/widgets/positioner_box/positioner_box.md +63 -0
  50. docs/user/widgets/progress_bar/ring_progress_bar.md +103 -0
  51. docs/user/widgets/queue/queue.md +41 -0
  52. docs/user/widgets/scan_control/scan_control.md +46 -0
  53. docs/user/widgets/spinner/spinner.md +75 -0
  54. docs/user/widgets/text_box/text_box.md +74 -0
  55. docs/user/widgets/toggle/toggle.md +66 -0
  56. docs/user/widgets/waveform/waveform_widget.md +132 -0
  57. docs/user/widgets/website/website.md +69 -0
  58. docs/user/widgets/widgets.md +212 -12
  59. pyproject.toml +1 -1
  60. tests/unit_tests/client_mocks.py +14 -0
  61. tests/unit_tests/test_device_browser.py +83 -0
  62. docs/user/widgets/bec_figure.md +0 -146
  63. docs/user/widgets/bec_status_box.md +0 -30
  64. docs/user/widgets/buttons.md +0 -37
  65. docs/user/widgets/ring_progress_bar.md +0 -54
  66. docs/user/widgets/scan_control.md +0 -35
  67. docs/user/widgets/text_box.md +0 -33
  68. docs/user/widgets/website.md +0 -21
  69. {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.0.dist-info}/WHEEL +0 -0
  70. {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.0.dist-info}/entry_points.txt +0 -0
  71. {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.0.dist-info}/licenses/LICENSE +0 -0
  72. /docs/user/widgets/{BECFigure.png → bec_figure/BECFigure.png} +0 -0
  73. /docs/user/widgets/{bec_status_box.gif → bec_status_box/bec_status_box.gif} +0 -0
  74. /docs/user/widgets/{image_plot.gif → image/image_plot.gif} +0 -0
  75. /docs/user/widgets/{motor.gif → motor_map/motor.gif} +0 -0
  76. /docs/user/widgets/{progress_bar.gif → progress_bar/progress_bar.gif} +0 -0
  77. /docs/user/widgets/{scan_control.gif → scan_control/scan_control.gif} +0 -0
  78. /docs/user/widgets/{bec_figure_dap.gif → waveform/bec_figure_dap.gif} +0 -0
  79. /docs/user/widgets/{scatter_2D.gif → waveform/scatter_2D.gif} +0 -0
  80. /docs/user/widgets/{w1D.gif → waveform/w1D.gif} +0 -0
@@ -1,146 +0,0 @@
1
- (user.widgets.bec_figure)=
2
- # BECFigure
3
- [`BECFigure`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure) is a widget that provides a graphical user interface for creating and managing plots. It is a versatile tool that allows users to create a wide range of plots, from simple 1D waveforms to complex 2D scatter plots. BECFigure is designed to be user-friendly and interactive, enabling users to customize plots and visualize data in real-time.
4
- In the following, we describe 4 different type of widgets thaat are available in BECFigure.
5
-
6
- **Schema of the BECFigure**
7
-
8
- ![BECFigure.png](BECFigure.png)
9
-
10
- ## [1D Waveform Widget](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform)
11
-
12
- **Purpose:** This widget provides a straightforward visualization of 1D data. It is particularly useful for plotting positioner movements against detector readings, enabling users to observe correlations and patterns in a simple, linear format.
13
-
14
- **Key Features:**
15
- - Real-time plotting of positioner versus detector values.
16
- - Interactive controls for zooming and panning through the data.
17
- - Customizable visual elements such as line color and style.
18
-
19
- **Example of Use:**
20
- ![Waveform 1D](./w1D.gif)
21
-
22
- **Code example 1 - adding curves**
23
-
24
- The following code snipped demonstrates how to create a 1D waveform plot using BEC Widgets within BEC. More details about BEC Widgets in BEC can be found in the getting started section within the [introduction to the command line.](user.command_line_introduction)
25
- ```python
26
- # adds a new dock, a new BECFigure and a BECWaveForm to the dock
27
- plt = gui.add_dock().add_widget('BECFigure').plot(x_name='samx', y_name='bpm4i')
28
- # add a second curve to the same plot
29
- plt.plot(x_name='samx', y_name='bpm3i')
30
- plt.set_title("Gauss plots vs. samx")
31
- plt.set_x_label("Motor X")
32
- plt.set_y_label("Gauss Signal (A.U.")
33
- ```
34
- Note, the return value of the simulated devices *bpm4i* and *bpm3i* may not be gaussian signals, but they can be easily configured with the code snippet below. For more details please check the documentation of the [simulation](https://bec.readthedocs.io/en/latest/developer/devices/bec_sim.html).
35
- ```python
36
- # bpm4i uses GaussianModel and samx as a reference; default settings
37
- dev.bpm4i.sim.select_sim_model("GaussianModel")
38
- # bpm3i uses StepModel and samx as a reference; default settings
39
- dev.bpm3i.sim.select_sim_model("StepModel")
40
- ```
41
-
42
- **Code example 2 - Adding Data Processing Pipeline Curve with LMFit Models**
43
-
44
- Together with the scan curve, one can also add a second curve that fits the signal using a specified model
45
- from [LMFit](https://lmfit.github.io/lmfit-py/builtin_models.html). The following code snippet demonstrates how to
46
- create a 1D waveform curve with an attached DAP process, or how to add a DAP process to an existing curve using the BEC
47
- CLI. Please note that for this example, both devices were set as Gaussian signals.
48
-
49
- ```python
50
- # Add a new dock, a new BECFigure, and a BECWaveForm to the dock with a GaussianModel DAP
51
- plt = gui.add_dock().add_widget('BECFigure').plot(x_name='samx', y_name='bpm4i', dap="GaussianModel")
52
-
53
- # Add a second curve to the same plot without DAP
54
- plt.plot(x_name='samx', y_name='bpm3a')
55
-
56
- # Add DAP to the second curve
57
- plt.add_dap(x_name='samx', y_name='bpm3a', dap="GaussianModel")
58
-
59
- ```
60
-
61
- To get the parameters of the fit, one has to retrieve the curve objects and call the dap_params property.
62
-
63
- ```python
64
- # Get the curve object by name from the legend
65
- dap_bpm4i = plt.get_curve("bpm4i-bpm4i-GaussianModel")
66
- dap_bpm3a = plt.get_curve("bpm3a-bpm3a-GaussianModel")
67
-
68
- # Get the parameters of the fit
69
- print(dap_bpm4i.dap_params)
70
- # Output
71
- {'amplitude': 197.399639720862,
72
- 'center': 5.013486095404885,
73
- 'sigma': 0.9820868875739888}
74
-
75
- print(dap_bpm3a.dap_params)
76
- # Output
77
- {'amplitude': 698.3072786185278,
78
- 'center': 0.9702840866173836,
79
- 'sigma': 1.97139754785518}
80
- ```
81
-
82
- ![Waveform 1D_DAP](./bec_figure_dap.gif)
83
-
84
- (user.widgets.scatter_2d)=
85
- ## [2D Scatter Plot](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform)
86
-
87
- **Purpose:** The 2D scatter plot widget is designed for more complex data visualization. It employs a false color map to represent a third dimension (z-axis), making it an ideal tool for visualizing multidimensional data sets.
88
-
89
- **Key Features:**
90
-
91
- - 2D scatter plot with color-coded data points based on a third variable (two positioners for x/y vs. one detector for colormap).
92
- - Interactive false color map for enhanced data interpretation.
93
- - Tools for selecting and inspecting specific data points.
94
-
95
- **Example of Use:**
96
- ![Waveform 1D](./scatter_2D.gif)
97
-
98
- **Code example**
99
- The following code snipped demonstrates how to create a 2D scatter plot using BEC Widgets within BEC.
100
- ```python
101
- # adds a new dock, a new BECFigure and a BECWaveForm to the dock
102
- plt = gui.add_dock().add_widget('BECFigure').add_plot(x_name='samx', y_name='samy', z_name='bpm4i')
103
- ```
104
-
105
- (user.widgets.motor_map)=
106
- ## [Motor Position Map](/api_reference/_autosummary/bec_widgets.cli.client.BECMotorMap)
107
-
108
- **Purpose:** A specialized component derived from the Motor Alignment Tool. It's focused on tracking and visualizing the position of motors, crucial for precise alignment and movement tracking during scans.
109
-
110
- **Key Features:**
111
- - Real-time tracking of motor positions.
112
- - Visual representation of motor trajectories, aiding in alignment tasks.
113
-
114
- **Example of Use:**
115
- ![Waveform 1D](./motor.gif)
116
-
117
- **Code example**
118
- The following code snipped demonstrates how to create a motor map using BEC Widgets within BEC.
119
- ```python
120
- # add a motor map to the gui
121
- mot_map = gui.add_dock().add_widget('BECFigure').motor_map('samx', 'samy')
122
- # change the number of points displayed
123
- ```
124
-
125
- (user.widgets.image_2d)=
126
- ## [Image Plot](/api_reference/_autosummary/bec_widgets.cli.client.BECImageItem)
127
-
128
- **Purpose:** A versatile widget for visualizing 2D image data, such as camera images. It provides a detailed representation of image data, with an attached color and scale bar to dynamically adjust the image display.
129
-
130
- **Key Features:**
131
- - Live-plotting of 2D image data from cameras (*if data stream is available in BEC*).
132
- - Color maps and scale bars for customizing image display.
133
- **Example of Use:**
134
- ![Image 2D](./image_plot.gif)
135
-
136
- **Code example**
137
- The following code snipped demonstrates how to create a motor map using BEC Widgets within BEC.
138
- ```python
139
- # add a camera view for the eiger camera to the gui
140
- cam_widget = gui.add_dock().add_widget('BECFigure').image('eiger')
141
- # set the title of the camera view
142
- cam_widget.set_title("Camera Image Eiger")
143
- # change the color map range, e.g. from 0 to 100, per default it is autoscaling
144
- # Note, the simulation has hot pixels on the detector
145
- cam_widget.set_vrange(vmin=0, vmax=100)
146
- ```
@@ -1,30 +0,0 @@
1
- (user.widgets.bec_status_box)=
2
- # BEC Status Box
3
- **Purpose:**
4
-
5
- The [BECStatusBox](/api_reference/_autosummary/bec_widgets.cli.client.BECStatusBox) is a widget that allows you to monitor the status/health of the all running BEC processes. The widget generates the view automatically and updates the status of the processes in real-time. The top level indicates the overall state of the BEC core services (DeviceServer, ScanServer, SciHub, ScanBundler and FileWriter), but you can also see the status of each individual process by opening the collapsed view. In the collapsed view, you can double click on each process to get a popup window with live updates of the metrics for each process in real-time.
6
-
7
- **Key Features:**
8
-
9
- - monitor the state of individual BEC services.
10
- - automatically track BEC services, i.e. additional clients connecting.
11
- - live-updates of the metrics for each process.
12
-
13
- **Example of Use:**
14
- ![BECStatus](./bec_status_box.gif)
15
-
16
- **Code example:**
17
-
18
- The following code snipped demonstrates how to create a `BECStatusBox` widget using BEC Widgets within BEC.
19
- ```python
20
- bec_status_box = gui.add_dock().add_widget("BECStatusBox")
21
- ```
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
@@ -1,37 +0,0 @@
1
- (user.widgets.buttons)=
2
- # Buttons Widgets
3
-
4
- This section consolidates various custom buttons used within the BEC GUIs, facilitating the integration of these
5
- controls into different layouts.
6
-
7
- ## Stop Button
8
-
9
- **Purpose:**
10
-
11
- The `Stop Button` provides a user interface control to immediately halt the execution of the current operation in the
12
- BEC Client. It is designed for easy integration into any BEC GUI layout.
13
-
14
- **Key Features:**
15
-
16
- - **Immediate Termination:** Halts the execution of the current script or process.
17
- - **Queue Management:** Clears any pending operations in the scan queue, ensuring the system is ready for new tasks.
18
-
19
- **Code example:**
20
-
21
- Integrating the `StopButton` into a BEC GUI layout is straightforward. The following example demonstrates how to embed
22
- a `StopButton` within a GUI layout:
23
-
24
- ```python
25
- from qtpy.QtWidgets import QWidget, QVBoxLayout
26
- from bec_widgets.widgets.buttons import StopButton
27
-
28
-
29
- class MyGui(QWidget):
30
- def __init__(self):
31
- super().__init__()
32
- self.setLayout(QVBoxLayout(self)) # Initialize the layout for the widget
33
-
34
- # Create and add the StopButton to the layout
35
- self.stop_button = StopButton()
36
- self.layout().addWidget(self.stop_button)
37
- ```
@@ -1,54 +0,0 @@
1
- (user.widgets.spiral_progress_bar)=
2
- # [Ring Progress Bar](/api_reference/_autosummary/bec_widgets.cli.client.RingProgressBar)
3
-
4
- **Purpose:**
5
-
6
- The ring Progress Bar widget is a circular progress bar that can be used to visualize the progress of a task. The
7
- widget is designed to be used in applications where the progress of a task is represented as a percentage. The Spiral
8
- Progress Bar widget is a part of the BEC Widgets library and can be controlled directly using its API, or hooked up to
9
- the progress of a device readback or scan.
10
-
11
- **Key Features:**
12
-
13
- - circular progress bar to show updates on the progress of a task.
14
- - hooks to update the progress bar from a device readback or scan.
15
- - multiple progress rings to show different tasks in parallel.
16
-
17
- **Example of Use:**
18
- ![RingProgressBar](./progress_bar.gif)
19
-
20
- **Code example:**
21
-
22
- The following code snipped demonstrates how to create a `RingProgressBar` using BEC Widgets within BEC.
23
- ```python
24
- # adds a new dock with a ring progress bar
25
- progress = gui.add_dock().add_widget("RingProgressBar")
26
- # customize the size of the ring
27
- progress.set_line_width(20)
28
- ```
29
-
30
- By default, the Ring Progress Bar widget will display a single ring. To add more rings, use the add_ring method:
31
-
32
- ```python
33
- # adds a new dock with a ring progress bar
34
- progress.add_ring()
35
- ```
36
-
37
- To access rings and specify their properties, you can use `progress.rings` with an index specifying the ring index (
38
- starting from 0):
39
-
40
- ```python
41
- progress.rings[0].set_line_width(20) # set the width of the first ring
42
- progress.rings[1].set_line_width(10) # set the width of the second ring
43
- ```
44
-
45
- By default, the `RingProgressBar` widget is set with `progress.enable_auto_update(True)`, which will automatically
46
- update the bars in the widget. To manually set updates for each progress bar, use the set_update method. Note that
47
- manually updating a ring will disable the automatic update for the whole widget:
48
-
49
- ```python
50
- progress.rings[0].set_update("scan") # set the update of the first ring to be an overall scan progress
51
- progress.rings[1].set_update("device",
52
- "samx") # set the update of the second ring to be a device readback (in this case, samx)
53
- ```
54
-
@@ -1,35 +0,0 @@
1
- (user.widgets.scan_control)=
2
-
3
- # Scan Control
4
-
5
- **Purpose:**
6
-
7
- The `ScanControl` widget is designed to generate a graphical user interface (GUI) to control various scan operations
8
- based on the scan's signature and `gui_config`. The widget is used to control the scan operations, such as starting,
9
- stopping, and pausing the scan. The widget also provides a graphical representation of the scan progress and the scan
10
- status. The widget is designed to be used in conjunction with the `ScanServer` and `ScanBundler` services from the BEC
11
- core services.
12
-
13
- By default the widget supports only the scans which have defined `gui_config` and are inhereted from these scan classes:
14
-
15
- - [ScanBase](https://beamline-experiment-control.readthedocs.io/en/latest/api_reference/_autosummary/bec_server.scan_server.scans.ScanBase.html)
16
- - [SyncFlyScanBase](https://beamline-experiment-control.readthedocs.io/en/latest/api_reference/_autosummary/bec_server.scan_server.scans.SyncFlyScanBase.html)
17
- - [AsyncFlyScanBase](https://beamline-experiment-control.readthedocs.io/en/latest/api_reference/_autosummary/bec_server.scan_server.scans.AsyncFlyScanBase.html)
18
-
19
- **Key Features:**
20
-
21
- - Automatically generates a control interface based on scan signatures and `gui_config`.
22
- - Supports adding and removing argument bundles dynamically.
23
- - Provides a visual representation of scan parameters grouped by functionality.
24
- - Integrates start and stop controls for executing and halting scans.
25
-
26
- **Example of Use:**
27
-
28
- **Code example:**
29
- The following code snipped demonstrates how to create a `ScanControl` widget using BEC Widgets within `BECIPythonClient`
30
-
31
- ![ScanControl](./scan_control.gif)
32
-
33
- ```python
34
- scan_control = gui.add_dock().add_widget("ScanControl")
35
- ```
@@ -1,33 +0,0 @@
1
- (user.widgets.text_box)=
2
- # [Text Box Widget](/api_reference/_autosummary/bec_widgets.cli.client.TextBox)
3
- **Purpose:**
4
-
5
- The Text Box Widget is a widget that allows you to display text within the BEC GUI. The widget can be used to display plain text or HTML text.
6
-
7
- **Key Features:**
8
-
9
- - set the text to display.
10
- - automatically detects if the text is plain text or HTML text.
11
- - set background color and font color.
12
-
13
- **Code example:**
14
-
15
- The following code snipped demonstrates how to create a `TextBox` widget using BEC Widgets within BEC.
16
- ```python
17
- text_box = gui.add_dock().add_widget("TextBox")
18
- # set the text to display
19
- text_box.set_text("Hello, World!")
20
- # set the background color and font color
21
- text_box.set_color(backgroud_color="#FFF", font_color="#000")
22
- # set the text to display as HTML
23
- text_box.set_text("<h1>Welcome to BEC Widgets</h1><p>This is an example of displaying <strong>HTML</strong> text.</p>")
24
- ```
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
@@ -1,21 +0,0 @@
1
- (user.widgets.website)=
2
- # [Website Widget](/api_reference/_autosummary/bec_widgets.cli.client.WebsiteWidget)
3
- **Purpose:**
4
-
5
- The Website Widget is a widget that allows you to display a website within the BEC GUI. The widget can be used to display any website.
6
-
7
- **Key Features:**
8
-
9
- - set the URL of the website to display.
10
- - reload the website.
11
- - navigate back and forward in the website history.
12
-
13
- **Code example:**
14
-
15
- The following code snipped demonstrates how to create a `WebsiteWidget` using BEC Widgets within BEC.
16
- ```python
17
- # adds a new dock with a website widget
18
- web = gui.add_dock().add_widget("Website")
19
- # set the URL of the website to display
20
- web.set_url("https://bec.readthedocs.io/en/latest/")
21
- ```
File without changes
File without changes