mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 11:41:49 +02:00
refactor: improve labe of auto_update script
This commit is contained in:
@ -118,7 +118,7 @@ class AutoUpdates:
|
|||||||
if not dev_y:
|
if not dev_y:
|
||||||
return
|
return
|
||||||
fig.clear_all()
|
fig.clear_all()
|
||||||
plt = fig.plot(x_name=dev_x, y_name=dev_y)
|
plt = fig.plot(x_name=dev_x, y_name=dev_y, label=f"Scan {info.scan_number} - {dev_y}")
|
||||||
plt.set(title=f"Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
|
plt.set(title=f"Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
|
||||||
|
|
||||||
def simple_grid_scan(self, info: ScanInfo) -> None:
|
def simple_grid_scan(self, info: ScanInfo) -> None:
|
||||||
@ -132,7 +132,9 @@ class AutoUpdates:
|
|||||||
dev_y = info.scan_report_devices[1]
|
dev_y = info.scan_report_devices[1]
|
||||||
dev_z = self.get_selected_device(info.monitored_devices, self.gui.selected_device)
|
dev_z = self.get_selected_device(info.monitored_devices, self.gui.selected_device)
|
||||||
fig.clear_all()
|
fig.clear_all()
|
||||||
plt = fig.plot(x_name=dev_x, y_name=dev_y, z_name=dev_z, label=f"Scan {info.scan_number}")
|
plt = fig.plot(
|
||||||
|
x_name=dev_x, y_name=dev_y, z_name=dev_z, label=f"Scan {info.scan_number} - {dev_z}"
|
||||||
|
)
|
||||||
plt.set(title=f"Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
|
plt.set(title=f"Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
|
||||||
|
|
||||||
def best_effort(self, info: ScanInfo) -> None:
|
def best_effort(self, info: ScanInfo) -> None:
|
||||||
@ -147,5 +149,5 @@ class AutoUpdates:
|
|||||||
if not dev_y:
|
if not dev_y:
|
||||||
return
|
return
|
||||||
fig.clear_all()
|
fig.clear_all()
|
||||||
plt = fig.plot(x_name=dev_x, y_name=dev_y, label=f"Scan {info.scan_number}")
|
plt = fig.plot(x_name=dev_x, y_name=dev_y, label=f"Scan {info.scan_number} - {dev_y}")
|
||||||
plt.set(title=f"Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
|
plt.set(title=f"Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
|
||||||
|
@ -253,8 +253,14 @@ def test_auto_update(bec_client_lib, rpc_server_dock):
|
|||||||
plt_data = widgets[0].get_all_data()
|
plt_data = widgets[0].get_all_data()
|
||||||
|
|
||||||
# check plotted data
|
# check plotted data
|
||||||
assert plt_data["bpm4i-bpm4i"]["x"] == last_scan_data["samx"]["samx"].val
|
assert (
|
||||||
assert plt_data["bpm4i-bpm4i"]["y"] == last_scan_data["bpm4i"]["bpm4i"].val
|
plt_data[f"Scan {status.scan.scan_number} - bpm4i"]["x"]
|
||||||
|
== last_scan_data["samx"]["samx"].val
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
plt_data[f"Scan {status.scan.scan_number} - bpm4i"]["y"]
|
||||||
|
== last_scan_data["bpm4i"]["bpm4i"].val
|
||||||
|
)
|
||||||
|
|
||||||
status = scans.grid_scan(
|
status = scans.grid_scan(
|
||||||
dev.samx, -10, 10, 5, dev.samy, -5, 5, 5, exp_time=0.05, relative=False
|
dev.samx, -10, 10, 5, dev.samy, -5, 5, 5, exp_time=0.05, relative=False
|
||||||
@ -268,5 +274,11 @@ def test_auto_update(bec_client_lib, rpc_server_dock):
|
|||||||
last_scan_data = queue.scan_storage.storage[-1].data
|
last_scan_data = queue.scan_storage.storage[-1].data
|
||||||
|
|
||||||
# check plotted data
|
# check plotted data
|
||||||
assert plt_data[f"Scan {status.scan.scan_number}"]["x"] == last_scan_data["samx"]["samx"].val
|
assert (
|
||||||
assert plt_data[f"Scan {status.scan.scan_number}"]["y"] == last_scan_data["samy"]["samy"].val
|
plt_data[f"Scan {status.scan.scan_number} - {dock.selected_device}"]["x"]
|
||||||
|
== last_scan_data["samx"]["samx"].val
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
plt_data[f"Scan {status.scan.scan_number} - {dock.selected_device}"]["y"]
|
||||||
|
== last_scan_data["samy"]["samy"].val
|
||||||
|
)
|
||||||
|
Reference in New Issue
Block a user