mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
fix(waveform): fix dap curve categorization logic
This commit is contained in:
@ -738,7 +738,9 @@ class Waveform(PlotBase):
|
|||||||
self.async_signal_update.emit()
|
self.async_signal_update.emit()
|
||||||
self.sync_signal_update.emit()
|
self.sync_signal_update.emit()
|
||||||
if config.source == "dap":
|
if config.source == "dap":
|
||||||
|
self._dap_curves.append(curve)
|
||||||
self.setup_dap_for_scan()
|
self.setup_dap_for_scan()
|
||||||
|
self.roi_enable.emit(True) # Enable the ROI toolbar action
|
||||||
self.request_dap() # Request DAP update directly without blocking proxy
|
self.request_dap() # Request DAP update directly without blocking proxy
|
||||||
|
|
||||||
return curve
|
return curve
|
||||||
@ -1023,7 +1025,7 @@ class Waveform(PlotBase):
|
|||||||
)
|
)
|
||||||
x_data = self._get_x_data(device_name, device_entry)
|
x_data = self._get_x_data(device_name, device_entry)
|
||||||
if x_data is not None:
|
if x_data is not None:
|
||||||
if isinstance(x_data, int) or (np.isscalar(x_data) and np.size(x_data) == 1):
|
if len(x_data) == 1:
|
||||||
self.clear_data()
|
self.clear_data()
|
||||||
return
|
return
|
||||||
if device_data is not None and x_data is not None:
|
if device_data is not None and x_data is not None:
|
||||||
@ -1154,8 +1156,8 @@ class Waveform(PlotBase):
|
|||||||
MessageEndpoints.dap_response(f"{self.scan_id}-{self.gui_id}"),
|
MessageEndpoints.dap_response(f"{self.scan_id}-{self.gui_id}"),
|
||||||
)
|
)
|
||||||
|
|
||||||
# @SafeSlot() #FIXME type error
|
@SafeSlot()
|
||||||
def request_dap(self):
|
def request_dap(self, _=None):
|
||||||
"""Request new fit for data"""
|
"""Request new fit for data"""
|
||||||
|
|
||||||
for dap_curve in self._dap_curves:
|
for dap_curve in self._dap_curves:
|
||||||
@ -1280,9 +1282,9 @@ class Waveform(PlotBase):
|
|||||||
x_entry = self.entry_validator.validate_signal(x_name, None)
|
x_entry = self.entry_validator.validate_signal(x_name, None)
|
||||||
# if the motor was not scanned, an empty list is returned and curves are not updated
|
# if the motor was not scanned, an empty list is returned and curves are not updated
|
||||||
if access_key == "val": # live data
|
if access_key == "val": # live data
|
||||||
x_data = data.get(x_name, {}).get(x_entry, {}).get(access_key, 0)
|
x_data = data.get(x_name, {}).get(x_entry, {}).get(access_key, [0])
|
||||||
else: # history data
|
else: # history data
|
||||||
x_data = data.get(x_name, {}).get(x_entry, {}).read().get("value", 0)
|
x_data = data.get(x_name, {}).get(x_entry, {}).read().get("value", [0])
|
||||||
new_suffix = f" [custom: {x_name}-{x_entry}]"
|
new_suffix = f" [custom: {x_name}-{x_entry}]"
|
||||||
|
|
||||||
# 2 User wants timestamp
|
# 2 User wants timestamp
|
||||||
@ -1290,7 +1292,7 @@ class Waveform(PlotBase):
|
|||||||
if access_key == "val": # live
|
if access_key == "val": # live
|
||||||
timestamps = data[device_name][device_entry].timestamps
|
timestamps = data[device_name][device_entry].timestamps
|
||||||
else: # history data
|
else: # history data
|
||||||
timestamps = data[device_name][device_entry].read().get("timestamp", 0)
|
timestamps = data[device_name][device_entry].read().get("timestamp", [0])
|
||||||
x_data = timestamps
|
x_data = timestamps
|
||||||
new_suffix = " [timestamp]"
|
new_suffix = " [timestamp]"
|
||||||
|
|
||||||
@ -1383,10 +1385,8 @@ class Waveform(PlotBase):
|
|||||||
# Reset sync/async curve lists
|
# Reset sync/async curve lists
|
||||||
self._async_curves.clear()
|
self._async_curves.clear()
|
||||||
self._sync_curves.clear()
|
self._sync_curves.clear()
|
||||||
self._dap_curves.clear()
|
|
||||||
found_async = False
|
found_async = False
|
||||||
found_sync = False
|
found_sync = False
|
||||||
found_dap = False
|
|
||||||
mode = "sync"
|
mode = "sync"
|
||||||
|
|
||||||
readout_priority_async = self._ensure_str_list(readout_priority.get("async", []))
|
readout_priority_async = self._ensure_str_list(readout_priority.get("async", []))
|
||||||
@ -1394,13 +1394,8 @@ class Waveform(PlotBase):
|
|||||||
|
|
||||||
# Iterate over all curves
|
# Iterate over all curves
|
||||||
for curve in self.curves:
|
for curve in self.curves:
|
||||||
# categorise dap curves firsts
|
|
||||||
if curve.config.source == "custom":
|
if curve.config.source == "custom":
|
||||||
continue
|
continue
|
||||||
if curve.config.source == "dap":
|
|
||||||
self._dap_curves.append(curve)
|
|
||||||
found_dap = True
|
|
||||||
continue
|
|
||||||
dev_name = curve.config.signal.name
|
dev_name = curve.config.signal.name
|
||||||
if dev_name in readout_priority_async:
|
if dev_name in readout_priority_async:
|
||||||
self._async_curves.append(curve)
|
self._async_curves.append(curve)
|
||||||
@ -1422,8 +1417,6 @@ class Waveform(PlotBase):
|
|||||||
elif found_sync:
|
elif found_sync:
|
||||||
mode = "sync"
|
mode = "sync"
|
||||||
|
|
||||||
self.roi_enable.emit(found_dap)
|
|
||||||
|
|
||||||
logger.info(f"Scan {self.scan_id} => mode={self._mode}")
|
logger.info(f"Scan {self.scan_id} => mode={self._mode}")
|
||||||
return mode
|
return mode
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user