bec-widgets 0.54.0__py3-none-any.whl → 0.56.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.
- .gitlab-ci.yml +113 -8
- CHANGELOG.md +32 -21
- PKG-INFO +3 -1
- bec_widgets/cli/client.py +252 -0
- bec_widgets/cli/generate_cli.py +4 -1
- bec_widgets/cli/rpc_wigdet_handler.py +2 -1
- bec_widgets/examples/jupyter_console/jupyter_console_window.py +29 -37
- bec_widgets/examples/motor_movement/motor_control_compilations.py +1 -7
- bec_widgets/utils/__init__.py +1 -0
- bec_widgets/utils/crosshair.py +13 -9
- bec_widgets/utils/ui_loader.py +58 -0
- bec_widgets/widgets/__init__.py +1 -0
- bec_widgets/widgets/motor_control/motor_table/motor_table.py +44 -43
- bec_widgets/widgets/motor_control/movement_absolute/movement_absolute.py +25 -23
- bec_widgets/widgets/motor_control/movement_relative/movement_relative.py +51 -48
- bec_widgets/widgets/spiral_progress_bar/__init__.py +1 -0
- bec_widgets/widgets/spiral_progress_bar/ring.py +184 -0
- bec_widgets/widgets/spiral_progress_bar/spiral_progress_bar.py +594 -0
- {bec_widgets-0.54.0.dist-info → bec_widgets-0.56.0.dist-info}/METADATA +3 -1
- {bec_widgets-0.54.0.dist-info → bec_widgets-0.56.0.dist-info}/RECORD +29 -46
- docs/user/apps.md +1 -26
- pyproject.toml +2 -1
- tests/end-2-end/test_bec_dock_rpc_e2e.py +81 -0
- tests/unit_tests/test_client_utils.py +2 -2
- tests/unit_tests/test_crosshair.py +5 -5
- tests/unit_tests/test_motor_control.py +49 -45
- tests/unit_tests/test_spiral_progress_bar.py +338 -0
- bec_widgets/examples/eiger_plot/__init__.py +0 -0
- bec_widgets/examples/eiger_plot/eiger_plot.py +0 -307
- bec_widgets/examples/eiger_plot/eiger_plot.ui +0 -207
- bec_widgets/examples/mca_readout/__init__.py +0 -0
- bec_widgets/examples/mca_readout/mca_plot.py +0 -159
- bec_widgets/examples/mca_readout/mca_sim.py +0 -28
- bec_widgets/examples/modular_app/___init__.py +0 -0
- bec_widgets/examples/modular_app/modular.ui +0 -92
- bec_widgets/examples/modular_app/modular_app.py +0 -197
- bec_widgets/examples/motor_movement/config_example.yaml +0 -17
- bec_widgets/examples/motor_movement/csax_bec_config.yaml +0 -10
- bec_widgets/examples/motor_movement/csaxs_config.yaml +0 -17
- bec_widgets/examples/motor_movement/motor_example.py +0 -1344
- bec_widgets/examples/stream_plot/__init__.py +0 -0
- bec_widgets/examples/stream_plot/line_plot.ui +0 -155
- bec_widgets/examples/stream_plot/stream_plot.py +0 -337
- docs/user/apps/modular_app.md +0 -6
- docs/user/apps/motor_app.md +0 -34
- docs/user/apps/motor_app_10fps.gif +0 -0
- docs/user/apps/plot_app.md +0 -6
- tests/unit_tests/test_eiger_plot.py +0 -115
- tests/unit_tests/test_stream_plot.py +0 -158
- {bec_widgets-0.54.0.dist-info → bec_widgets-0.56.0.dist-info}/WHEEL +0 -0
- {bec_widgets-0.54.0.dist-info → bec_widgets-0.56.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,207 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<ui version="4.0">
|
3
|
-
<class>Form</class>
|
4
|
-
<widget class="QWidget" name="Form">
|
5
|
-
<property name="geometry">
|
6
|
-
<rect>
|
7
|
-
<x>0</x>
|
8
|
-
<y>0</y>
|
9
|
-
<width>874</width>
|
10
|
-
<height>762</height>
|
11
|
-
</rect>
|
12
|
-
</property>
|
13
|
-
<property name="windowTitle">
|
14
|
-
<string>Form</string>
|
15
|
-
</property>
|
16
|
-
<layout class="QVBoxLayout" name="verticalLayout_2">
|
17
|
-
<item>
|
18
|
-
<layout class="QHBoxLayout" name="horizontalLayout">
|
19
|
-
<item>
|
20
|
-
<widget class="QGroupBox" name="groupBox">
|
21
|
-
<property name="title">
|
22
|
-
<string>Plot Control</string>
|
23
|
-
</property>
|
24
|
-
<layout class="QGridLayout" name="gridLayout">
|
25
|
-
<item row="0" column="0">
|
26
|
-
<widget class="QLabel" name="label">
|
27
|
-
<property name="text">
|
28
|
-
<string>Histogram MIN</string>
|
29
|
-
</property>
|
30
|
-
</widget>
|
31
|
-
</item>
|
32
|
-
<item row="0" column="1">
|
33
|
-
<widget class="QDoubleSpinBox" name="doubleSpinBox_hist_min">
|
34
|
-
<property name="minimum">
|
35
|
-
<double>-100000.000000000000000</double>
|
36
|
-
</property>
|
37
|
-
<property name="maximum">
|
38
|
-
<double>100000.000000000000000</double>
|
39
|
-
</property>
|
40
|
-
</widget>
|
41
|
-
</item>
|
42
|
-
<item row="1" column="0">
|
43
|
-
<widget class="QLabel" name="label_2">
|
44
|
-
<property name="text">
|
45
|
-
<string>Histogram MAX</string>
|
46
|
-
</property>
|
47
|
-
</widget>
|
48
|
-
</item>
|
49
|
-
<item row="1" column="1">
|
50
|
-
<widget class="QDoubleSpinBox" name="doubleSpinBox_hist_max">
|
51
|
-
<property name="minimum">
|
52
|
-
<double>-100000.000000000000000</double>
|
53
|
-
</property>
|
54
|
-
<property name="maximum">
|
55
|
-
<double>100000.000000000000000</double>
|
56
|
-
</property>
|
57
|
-
<property name="value">
|
58
|
-
<double>2.000000000000000</double>
|
59
|
-
</property>
|
60
|
-
</widget>
|
61
|
-
</item>
|
62
|
-
</layout>
|
63
|
-
</widget>
|
64
|
-
</item>
|
65
|
-
<item>
|
66
|
-
<widget class="QGroupBox" name="groupBox_2">
|
67
|
-
<property name="title">
|
68
|
-
<string>Data Control</string>
|
69
|
-
</property>
|
70
|
-
<layout class="QVBoxLayout" name="verticalLayout">
|
71
|
-
<item>
|
72
|
-
<widget class="QCheckBox" name="checkBox_FFT">
|
73
|
-
<property name="enabled">
|
74
|
-
<bool>true</bool>
|
75
|
-
</property>
|
76
|
-
<property name="text">
|
77
|
-
<string>FFT</string>
|
78
|
-
</property>
|
79
|
-
</widget>
|
80
|
-
</item>
|
81
|
-
<item>
|
82
|
-
<widget class="QCheckBox" name="checkBox_log">
|
83
|
-
<property name="text">
|
84
|
-
<string>log</string>
|
85
|
-
</property>
|
86
|
-
</widget>
|
87
|
-
</item>
|
88
|
-
<item>
|
89
|
-
<widget class="QPushButton" name="pushButton_mask">
|
90
|
-
<property name="text">
|
91
|
-
<string>Load Mask</string>
|
92
|
-
</property>
|
93
|
-
</widget>
|
94
|
-
</item>
|
95
|
-
<item>
|
96
|
-
<widget class="QPushButton" name="pushButton_delete_mask">
|
97
|
-
<property name="text">
|
98
|
-
<string>Delete Mask</string>
|
99
|
-
</property>
|
100
|
-
</widget>
|
101
|
-
</item>
|
102
|
-
</layout>
|
103
|
-
</widget>
|
104
|
-
</item>
|
105
|
-
<item>
|
106
|
-
<widget class="QGroupBox" name="groupBox_3">
|
107
|
-
<property name="title">
|
108
|
-
<string>Orientation</string>
|
109
|
-
</property>
|
110
|
-
<layout class="QGridLayout" name="gridLayout_2">
|
111
|
-
<item row="2" column="1">
|
112
|
-
<widget class="QComboBox" name="comboBox_rotation">
|
113
|
-
<item>
|
114
|
-
<property name="text">
|
115
|
-
<string>0</string>
|
116
|
-
</property>
|
117
|
-
</item>
|
118
|
-
<item>
|
119
|
-
<property name="text">
|
120
|
-
<string>90</string>
|
121
|
-
</property>
|
122
|
-
</item>
|
123
|
-
<item>
|
124
|
-
<property name="text">
|
125
|
-
<string>180</string>
|
126
|
-
</property>
|
127
|
-
</item>
|
128
|
-
<item>
|
129
|
-
<property name="text">
|
130
|
-
<string>270</string>
|
131
|
-
</property>
|
132
|
-
</item>
|
133
|
-
</widget>
|
134
|
-
</item>
|
135
|
-
<item row="2" column="0">
|
136
|
-
<widget class="QLabel" name="label_3">
|
137
|
-
<property name="text">
|
138
|
-
<string>Rotation</string>
|
139
|
-
</property>
|
140
|
-
</widget>
|
141
|
-
</item>
|
142
|
-
<item row="0" column="0" colspan="2">
|
143
|
-
<widget class="QCheckBox" name="checkBox_transpose">
|
144
|
-
<property name="text">
|
145
|
-
<string>Transpose</string>
|
146
|
-
</property>
|
147
|
-
</widget>
|
148
|
-
</item>
|
149
|
-
</layout>
|
150
|
-
</widget>
|
151
|
-
</item>
|
152
|
-
<item>
|
153
|
-
<widget class="QGroupBox" name="groupBox_4">
|
154
|
-
<property name="title">
|
155
|
-
<string>Help</string>
|
156
|
-
</property>
|
157
|
-
<layout class="QVBoxLayout" name="verticalLayout_3">
|
158
|
-
<item>
|
159
|
-
<widget class="QLabel" name="label_mask">
|
160
|
-
<property name="text">
|
161
|
-
<string>No Mask</string>
|
162
|
-
</property>
|
163
|
-
<property name="alignment">
|
164
|
-
<set>Qt::AlignCenter</set>
|
165
|
-
</property>
|
166
|
-
</widget>
|
167
|
-
</item>
|
168
|
-
<item>
|
169
|
-
<widget class="QPushButton" name="pushButton_help">
|
170
|
-
<property name="text">
|
171
|
-
<string>Help</string>
|
172
|
-
</property>
|
173
|
-
</widget>
|
174
|
-
</item>
|
175
|
-
</layout>
|
176
|
-
</widget>
|
177
|
-
</item>
|
178
|
-
<item>
|
179
|
-
<spacer name="horizontalSpacer">
|
180
|
-
<property name="orientation">
|
181
|
-
<enum>Qt::Horizontal</enum>
|
182
|
-
</property>
|
183
|
-
<property name="sizeHint" stdset="0">
|
184
|
-
<size>
|
185
|
-
<width>40</width>
|
186
|
-
<height>20</height>
|
187
|
-
</size>
|
188
|
-
</property>
|
189
|
-
</spacer>
|
190
|
-
</item>
|
191
|
-
</layout>
|
192
|
-
</item>
|
193
|
-
<item>
|
194
|
-
<widget class="GraphicsLayoutWidget" name="glw"/>
|
195
|
-
</item>
|
196
|
-
</layout>
|
197
|
-
</widget>
|
198
|
-
<customwidgets>
|
199
|
-
<customwidget>
|
200
|
-
<class>GraphicsLayoutWidget</class>
|
201
|
-
<extends>QGraphicsView</extends>
|
202
|
-
<header>pyqtgraph.h</header>
|
203
|
-
</customwidget>
|
204
|
-
</customwidgets>
|
205
|
-
<resources/>
|
206
|
-
<connections/>
|
207
|
-
</ui>
|
File without changes
|
@@ -1,159 +0,0 @@
|
|
1
|
-
# import simulation_progress as SP
|
2
|
-
import numpy as np
|
3
|
-
import pyqtgraph as pg
|
4
|
-
from bec_lib import messages
|
5
|
-
from bec_lib.endpoints import MessageEndpoints
|
6
|
-
from qtpy.QtCore import Signal as pyqtSignal
|
7
|
-
from qtpy.QtCore import Slot as pyqtSlot
|
8
|
-
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
9
|
-
|
10
|
-
|
11
|
-
class StreamApp(QWidget):
|
12
|
-
update_signal = pyqtSignal()
|
13
|
-
new_scan_id = pyqtSignal(str)
|
14
|
-
|
15
|
-
def __init__(self, device, sub_device):
|
16
|
-
super().__init__()
|
17
|
-
pg.setConfigOptions(background="w", foreground="k")
|
18
|
-
self.init_ui()
|
19
|
-
|
20
|
-
self.setWindowTitle("MCA readout")
|
21
|
-
|
22
|
-
self.data = None
|
23
|
-
self.scan_id = None
|
24
|
-
self.stream_consumer = None
|
25
|
-
|
26
|
-
self.device = device
|
27
|
-
self.sub_device = sub_device
|
28
|
-
|
29
|
-
self.start_device_consumer()
|
30
|
-
|
31
|
-
# self.start_device_consumer(self.device) # for simulation
|
32
|
-
|
33
|
-
self.new_scan_id.connect(self.create_new_stream_consumer)
|
34
|
-
self.update_signal.connect(self.plot_new)
|
35
|
-
|
36
|
-
def init_ui(self):
|
37
|
-
# Create layout and add widgets
|
38
|
-
self.layout = QVBoxLayout()
|
39
|
-
self.setLayout(self.layout)
|
40
|
-
|
41
|
-
# Create plot
|
42
|
-
self.glw = pg.GraphicsLayoutWidget()
|
43
|
-
self.layout.addWidget(self.glw)
|
44
|
-
|
45
|
-
# Create Plot and add ImageItem
|
46
|
-
self.plot_item = pg.PlotItem()
|
47
|
-
self.plot_item.setAspectLocked(False)
|
48
|
-
self.imageItem = pg.ImageItem()
|
49
|
-
# self.plot_item1D = pg.PlotItem()
|
50
|
-
# self.plot_item.addItem(self.imageItem)
|
51
|
-
# self.plot_item.addItem(self.plot_item1D)
|
52
|
-
|
53
|
-
# Setting up histogram
|
54
|
-
# self.hist = pg.HistogramLUTItem()
|
55
|
-
# self.hist.setImageItem(self.imageItem)
|
56
|
-
# self.hist.gradient.loadPreset("magma")
|
57
|
-
# self.update_hist()
|
58
|
-
|
59
|
-
# Adding Items to Graphical Layout
|
60
|
-
self.glw.addItem(self.plot_item)
|
61
|
-
# self.glw.addItem(self.hist)
|
62
|
-
|
63
|
-
@pyqtSlot(str)
|
64
|
-
def create_new_stream_consumer(self, scan_id: str):
|
65
|
-
print(f"Creating new stream consumer for scan_id: {scan_id}")
|
66
|
-
|
67
|
-
self.connect_stream_consumer(scan_id, self.device)
|
68
|
-
|
69
|
-
def connect_stream_consumer(self, scan_id, device):
|
70
|
-
if self.stream_consumer is not None:
|
71
|
-
self.stream_consumer.shutdown()
|
72
|
-
|
73
|
-
self.stream_consumer = connector.stream_consumer(
|
74
|
-
topics=MessageEndpoints.device_async_readback(scan_id=scan_id, device=device),
|
75
|
-
cb=self._streamer_cb,
|
76
|
-
parent=self,
|
77
|
-
)
|
78
|
-
|
79
|
-
self.stream_consumer.start()
|
80
|
-
|
81
|
-
def start_device_consumer(self):
|
82
|
-
self.device_consumer = connector.consumer(
|
83
|
-
topics=MessageEndpoints.scan_status(), cb=self._device_cv, parent=self
|
84
|
-
)
|
85
|
-
|
86
|
-
self.device_consumer.start()
|
87
|
-
|
88
|
-
# def start_device_consumer(self, device): #for simulation
|
89
|
-
# self.device_consumer = connector.consumer(
|
90
|
-
# topics=MessageEndpoints.device_status(device), cb=self._device_cv, parent=self
|
91
|
-
# )
|
92
|
-
#
|
93
|
-
# self.device_consumer.start()
|
94
|
-
|
95
|
-
def plot_new(self):
|
96
|
-
print(f"Printing data from plot update: {self.data}")
|
97
|
-
self.plot_item.plot(self.data[0])
|
98
|
-
# self.imageItem.setImage(self.data, autoLevels=False)
|
99
|
-
|
100
|
-
@staticmethod
|
101
|
-
def _streamer_cb(msg, *, parent, **_kwargs) -> None:
|
102
|
-
msgMCS = msg.value
|
103
|
-
print(msgMCS)
|
104
|
-
row = msgMCS.content["signals"][parent.sub_device]
|
105
|
-
metadata = msgMCS.metadata
|
106
|
-
|
107
|
-
# Check if the current number of rows is odd
|
108
|
-
# if parent.data is not None and parent.data.shape[0] % 2 == 1:
|
109
|
-
# row = np.flip(row) # Flip the row
|
110
|
-
print(f"Printing data from callback update: {row}")
|
111
|
-
parent.data = np.array([row])
|
112
|
-
# if parent.data is None:
|
113
|
-
# parent.data = np.array([row])
|
114
|
-
# else:
|
115
|
-
# parent.data = np.vstack((parent.data, row))
|
116
|
-
|
117
|
-
parent.update_signal.emit()
|
118
|
-
|
119
|
-
@staticmethod
|
120
|
-
def _device_cv(msg, *, parent, **_kwargs) -> None:
|
121
|
-
print("Getting ScanID")
|
122
|
-
|
123
|
-
msgDEV = msg.value
|
124
|
-
|
125
|
-
current_scan_id = msgDEV.content["scan_id"]
|
126
|
-
|
127
|
-
if parent.scan_id is None:
|
128
|
-
parent.scan_id = current_scan_id
|
129
|
-
parent.new_scan_id.emit(current_scan_id)
|
130
|
-
print(f"New scan_id: {current_scan_id}")
|
131
|
-
|
132
|
-
if current_scan_id != parent.scan_id:
|
133
|
-
parent.scan_id = current_scan_id
|
134
|
-
# parent.data = None
|
135
|
-
# parent.imageItem.clear()
|
136
|
-
parent.new_scan_id.emit(current_scan_id)
|
137
|
-
|
138
|
-
print(f"New scan_id: {current_scan_id}")
|
139
|
-
|
140
|
-
|
141
|
-
if __name__ == "__main__":
|
142
|
-
import argparse
|
143
|
-
|
144
|
-
from bec_lib.redis_connector import RedisConnector
|
145
|
-
|
146
|
-
parser = argparse.ArgumentParser(description="Stream App.")
|
147
|
-
parser.add_argument("--port", type=str, default="pc15543:6379", help="Port for RedisConnector")
|
148
|
-
parser.add_argument("--device", type=str, default="mcs", help="Device name")
|
149
|
-
parser.add_argument("--sub_device", type=str, default="mca4", help="Sub-device name")
|
150
|
-
|
151
|
-
args = parser.parse_args()
|
152
|
-
|
153
|
-
connector = RedisConnector(args.port)
|
154
|
-
|
155
|
-
app = QApplication([])
|
156
|
-
streamApp = StreamApp(device=args.device, sub_device=args.sub_device)
|
157
|
-
|
158
|
-
streamApp.show()
|
159
|
-
app.exec()
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import time
|
2
|
-
|
3
|
-
from bec_lib import messages
|
4
|
-
from bec_lib.endpoints import MessageEndpoints
|
5
|
-
from bec_lib.redis_connector import RedisConnector
|
6
|
-
|
7
|
-
connector = RedisConnector("localhost:6379")
|
8
|
-
metadata = {}
|
9
|
-
|
10
|
-
scan_id = "ScanID1"
|
11
|
-
|
12
|
-
metadata.update(
|
13
|
-
{"scan_id": scan_id, "async_update": "append"} # this will be different for each scan
|
14
|
-
)
|
15
|
-
for ii in range(20):
|
16
|
-
data = {"mca1": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "mca2": [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]}
|
17
|
-
msg = messages.DeviceMessage(signals=data, metadata=metadata).dumps()
|
18
|
-
|
19
|
-
connector.xadd(
|
20
|
-
topic=MessageEndpoints.device_async_readback(
|
21
|
-
scan_id=scan_id, device="mca"
|
22
|
-
), # scan_id will be different for each scan
|
23
|
-
msg={"data": msg}, # TODO should be msg_dict
|
24
|
-
expire=1800,
|
25
|
-
)
|
26
|
-
|
27
|
-
print(f"Sent {ii}")
|
28
|
-
time.sleep(0.5)
|
File without changes
|
@@ -1,92 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<ui version="4.0">
|
3
|
-
<class>MainWindow</class>
|
4
|
-
<widget class="QMainWindow" name="MainWindow">
|
5
|
-
<property name="geometry">
|
6
|
-
<rect>
|
7
|
-
<x>0</x>
|
8
|
-
<y>0</y>
|
9
|
-
<width>1433</width>
|
10
|
-
<height>689</height>
|
11
|
-
</rect>
|
12
|
-
</property>
|
13
|
-
<property name="windowTitle">
|
14
|
-
<string>MainWindow</string>
|
15
|
-
</property>
|
16
|
-
<widget class="QWidget" name="centralwidget">
|
17
|
-
<layout class="QGridLayout" name="gridLayout">
|
18
|
-
<item row="1" column="2">
|
19
|
-
<widget class="QLabel" name="label_3">
|
20
|
-
<property name="text">
|
21
|
-
<string>Plot Config 2</string>
|
22
|
-
</property>
|
23
|
-
</widget>
|
24
|
-
</item>
|
25
|
-
<item row="3" column="0" colspan="2">
|
26
|
-
<widget class="BECMonitor" name="plot_1"/>
|
27
|
-
</item>
|
28
|
-
<item row="1" column="3">
|
29
|
-
<widget class="QPushButton" name="pushButton_setting_2">
|
30
|
-
<property name="text">
|
31
|
-
<string>Setting Plot 2</string>
|
32
|
-
</property>
|
33
|
-
</widget>
|
34
|
-
</item>
|
35
|
-
<item row="3" column="2" colspan="2">
|
36
|
-
<widget class="BECMonitor" name="plot_2"/>
|
37
|
-
</item>
|
38
|
-
<item row="1" column="4">
|
39
|
-
<widget class="QLabel" name="label_2">
|
40
|
-
<property name="text">
|
41
|
-
<string>Plot Scan Types = True</string>
|
42
|
-
</property>
|
43
|
-
</widget>
|
44
|
-
</item>
|
45
|
-
<item row="1" column="1">
|
46
|
-
<widget class="QPushButton" name="pushButton_setting_1">
|
47
|
-
<property name="text">
|
48
|
-
<string>Setting Plot 1</string>
|
49
|
-
</property>
|
50
|
-
</widget>
|
51
|
-
</item>
|
52
|
-
<item row="1" column="0">
|
53
|
-
<widget class="QLabel" name="label">
|
54
|
-
<property name="text">
|
55
|
-
<string>Plot Config 1</string>
|
56
|
-
</property>
|
57
|
-
</widget>
|
58
|
-
</item>
|
59
|
-
<item row="1" column="5">
|
60
|
-
<widget class="QPushButton" name="pushButton_setting_3">
|
61
|
-
<property name="text">
|
62
|
-
<string>Setting Plot 3</string>
|
63
|
-
</property>
|
64
|
-
</widget>
|
65
|
-
</item>
|
66
|
-
<item row="3" column="4" colspan="2">
|
67
|
-
<widget class="BECMonitor" name="plot_3"/>
|
68
|
-
</item>
|
69
|
-
</layout>
|
70
|
-
</widget>
|
71
|
-
<widget class="QMenuBar" name="menubar">
|
72
|
-
<property name="geometry">
|
73
|
-
<rect>
|
74
|
-
<x>0</x>
|
75
|
-
<y>0</y>
|
76
|
-
<width>1433</width>
|
77
|
-
<height>37</height>
|
78
|
-
</rect>
|
79
|
-
</property>
|
80
|
-
</widget>
|
81
|
-
<widget class="QStatusBar" name="statusbar"/>
|
82
|
-
</widget>
|
83
|
-
<customwidgets>
|
84
|
-
<customwidget>
|
85
|
-
<class>BECMonitor</class>
|
86
|
-
<extends>QGraphicsView</extends>
|
87
|
-
<header location="global">bec_widgets.widgets.h</header>
|
88
|
-
</customwidget>
|
89
|
-
</customwidgets>
|
90
|
-
<resources/>
|
91
|
-
<connections/>
|
92
|
-
</ui>
|
@@ -1,197 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
|
3
|
-
from qtpy import uic
|
4
|
-
from qtpy.QtWidgets import QApplication, QMainWindow
|
5
|
-
|
6
|
-
from bec_widgets.utils.bec_dispatcher import BECDispatcher
|
7
|
-
from bec_widgets.widgets import BECMonitor
|
8
|
-
|
9
|
-
# some default configs for demonstration purposes
|
10
|
-
CONFIG_SIMPLE = {
|
11
|
-
"plot_settings": {
|
12
|
-
"background_color": "black",
|
13
|
-
"num_columns": 2,
|
14
|
-
"colormap": "plasma",
|
15
|
-
"scan_types": False,
|
16
|
-
},
|
17
|
-
"plot_data": [
|
18
|
-
{
|
19
|
-
"plot_name": "BPM4i plots vs samx",
|
20
|
-
"x_label": "Motor X",
|
21
|
-
"y_label": "bpm4i",
|
22
|
-
"sources": [
|
23
|
-
{
|
24
|
-
"type": "scan_segment",
|
25
|
-
"signals": {
|
26
|
-
"x": [{"name": "samx"}],
|
27
|
-
"y": [{"name": "bpm4i", "entry": "bpm4i"}],
|
28
|
-
},
|
29
|
-
},
|
30
|
-
# {
|
31
|
-
# "type": "history",
|
32
|
-
# "signals": {
|
33
|
-
# "x": [{"name": "samx"}],
|
34
|
-
# "y": [{"name": "bpm4i", "entry": "bpm4i"}],
|
35
|
-
# },
|
36
|
-
# },
|
37
|
-
# {
|
38
|
-
# "type": "dap",
|
39
|
-
# 'worker':'some_worker',
|
40
|
-
# "signals": {
|
41
|
-
# "x": [{"name": "samx"}],
|
42
|
-
# "y": [{"name": "bpm4i", "entry": "bpm4i"}],
|
43
|
-
# },
|
44
|
-
# },
|
45
|
-
],
|
46
|
-
},
|
47
|
-
{
|
48
|
-
"plot_name": "Gauss plots vs samx",
|
49
|
-
"x_label": "Motor X",
|
50
|
-
"y_label": "Gauss",
|
51
|
-
"sources": [
|
52
|
-
{
|
53
|
-
"type": "scan_segment",
|
54
|
-
"signals": {
|
55
|
-
"x": [{"name": "samx", "entry": "samx"}],
|
56
|
-
"y": [{"name": "gauss_bpm"}, {"name": "gauss_adc1"}],
|
57
|
-
},
|
58
|
-
}
|
59
|
-
],
|
60
|
-
},
|
61
|
-
],
|
62
|
-
}
|
63
|
-
|
64
|
-
|
65
|
-
CONFIG_SCAN_MODE = {
|
66
|
-
"plot_settings": {
|
67
|
-
"background_color": "white",
|
68
|
-
"num_columns": 3,
|
69
|
-
"colormap": "plasma",
|
70
|
-
"scan_types": True,
|
71
|
-
},
|
72
|
-
"plot_data": {
|
73
|
-
"grid_scan": [
|
74
|
-
{
|
75
|
-
"plot_name": "Grid plot 1",
|
76
|
-
"x_label": "Motor X",
|
77
|
-
"y_label": "BPM",
|
78
|
-
"sources": [
|
79
|
-
{
|
80
|
-
"type": "scan_segment",
|
81
|
-
"signals": {
|
82
|
-
"x": [{"name": "samx", "entry": "samx"}],
|
83
|
-
"y": [{"name": "gauss_bpm"}],
|
84
|
-
},
|
85
|
-
}
|
86
|
-
],
|
87
|
-
},
|
88
|
-
{
|
89
|
-
"plot_name": "Grid plot 2",
|
90
|
-
"x_label": "Motor X",
|
91
|
-
"y_label": "BPM",
|
92
|
-
"sources": [
|
93
|
-
{
|
94
|
-
"type": "scan_segment",
|
95
|
-
"signals": {
|
96
|
-
"x": [{"name": "samx", "entry": "samx"}],
|
97
|
-
"y": [{"name": "gauss_adc1"}],
|
98
|
-
},
|
99
|
-
}
|
100
|
-
],
|
101
|
-
},
|
102
|
-
{
|
103
|
-
"plot_name": "Grid plot 3",
|
104
|
-
"x_label": "Motor X",
|
105
|
-
"y_label": "BPM",
|
106
|
-
"sources": [
|
107
|
-
{
|
108
|
-
"type": "scan_segment",
|
109
|
-
"signals": {"x": [{"name": "samy"}], "y": [{"name": "gauss_adc2"}]},
|
110
|
-
}
|
111
|
-
],
|
112
|
-
},
|
113
|
-
{
|
114
|
-
"plot_name": "Grid plot 4",
|
115
|
-
"x_label": "Motor X",
|
116
|
-
"y_label": "BPM",
|
117
|
-
"sources": [
|
118
|
-
{
|
119
|
-
"type": "scan_segment",
|
120
|
-
"signals": {
|
121
|
-
"x": [{"name": "samy", "entry": "samy"}],
|
122
|
-
"y": [{"name": "gauss_adc3"}],
|
123
|
-
},
|
124
|
-
}
|
125
|
-
],
|
126
|
-
},
|
127
|
-
],
|
128
|
-
"line_scan": [
|
129
|
-
{
|
130
|
-
"plot_name": "BPM plots vs samx",
|
131
|
-
"x_label": "Motor X",
|
132
|
-
"y_label": "Gauss",
|
133
|
-
"sources": [
|
134
|
-
{
|
135
|
-
"type": "scan_segment",
|
136
|
-
"signals": {
|
137
|
-
"x": [{"name": "samx", "entry": "samx"}],
|
138
|
-
"y": [{"name": "bpm4i"}],
|
139
|
-
},
|
140
|
-
}
|
141
|
-
],
|
142
|
-
},
|
143
|
-
{
|
144
|
-
"plot_name": "Gauss plots vs samx",
|
145
|
-
"x_label": "Motor X",
|
146
|
-
"y_label": "Gauss",
|
147
|
-
"sources": [
|
148
|
-
{
|
149
|
-
"type": "scan_segment",
|
150
|
-
"signals": {
|
151
|
-
"x": [{"name": "samx", "entry": "samx"}],
|
152
|
-
"y": [{"name": "gauss_bpm"}, {"name": "gauss_adc1"}],
|
153
|
-
},
|
154
|
-
}
|
155
|
-
],
|
156
|
-
},
|
157
|
-
],
|
158
|
-
},
|
159
|
-
}
|
160
|
-
|
161
|
-
|
162
|
-
class ModularApp(QMainWindow):
|
163
|
-
def __init__(self, client=None, parent=None):
|
164
|
-
super(ModularApp, self).__init__(parent)
|
165
|
-
|
166
|
-
# Client and device manager from BEC
|
167
|
-
self.client = BECDispatcher().client if client is None else client
|
168
|
-
|
169
|
-
# Loading UI
|
170
|
-
current_path = os.path.dirname(__file__)
|
171
|
-
uic.loadUi(os.path.join(current_path, "modular.ui"), self)
|
172
|
-
|
173
|
-
self._init_plots()
|
174
|
-
|
175
|
-
def _init_plots(self):
|
176
|
-
"""Initialize plots and connect the buttons to the config dialogs"""
|
177
|
-
plots = [self.plot_1, self.plot_2, self.plot_3]
|
178
|
-
configs = [CONFIG_SIMPLE, CONFIG_SCAN_MODE, CONFIG_SCAN_MODE]
|
179
|
-
buttons = [self.pushButton_setting_1, self.pushButton_setting_2, self.pushButton_setting_3]
|
180
|
-
|
181
|
-
# hook plots, configs and buttons together
|
182
|
-
for plot, config, button in zip(plots, configs, buttons):
|
183
|
-
plot.on_config_update(config)
|
184
|
-
button.clicked.connect(plot.show_config_dialog)
|
185
|
-
|
186
|
-
|
187
|
-
if __name__ == "__main__":
|
188
|
-
# BECclient global variables
|
189
|
-
client = BECDispatcher().client
|
190
|
-
client.start()
|
191
|
-
|
192
|
-
app = QApplication([])
|
193
|
-
modularApp = ModularApp(client=client)
|
194
|
-
|
195
|
-
window = modularApp
|
196
|
-
window.show()
|
197
|
-
app.exec()
|