diff --git a/debye_bec/devices/mo1_bragg/mo1_bragg.py b/debye_bec/devices/mo1_bragg/mo1_bragg.py index 7c2f8e4..80eac66 100644 --- a/debye_bec/devices/mo1_bragg/mo1_bragg.py +++ b/debye_bec/devices/mo1_bragg/mo1_bragg.py @@ -119,6 +119,8 @@ class Mo1Bragg(PSIDeviceBase, Mo1BraggPositioner): Information about the upcoming scan can be accessed from the scan_info (self.scan_info.msg) object. """ + if not self.scan_info.msg.scan_type == "fly": + return self._check_scan_msg(ScanControlLoadMessage.PENDING) scan_name = self.scan_info.msg.scan_name @@ -196,7 +198,9 @@ class Mo1Bragg(PSIDeviceBase, Mo1BraggPositioner): mode=ScanControlMode.ADVANCED, scan_duration=self.scan_parameter.scan_duration ) else: - return + raise Mo1BraggError( + f"Scan mode {scan_name} not implemented for scan_type={self.scan_info.msg.scan_type} on device {self.name}" + ) # Load the scan parameters to the controller self.scan_control.scan_load.put(1) # Wait for params to be checked from controller @@ -321,10 +325,10 @@ class Mo1Bragg(PSIDeviceBase, Mo1BraggPositioner): timeout = self.timeout_for_pvwait start_time = time.time() while time.time() - start_time < timeout: + if self.stopped is True: + raise DeviceStopError(f"Device {self.name} was stopped while waiting for signal") if signal.get() == value: return None - if self.stopped is True: # Should this check be optional or configurable?! - raise DeviceStopError(f"Device {self.name} was stopped while waiting for signal") time.sleep(0.1) # If we end up here, the status did not resolve raise TimeoutError( @@ -438,9 +442,6 @@ class Mo1Bragg(PSIDeviceBase, Mo1BraggPositioner): def _update_scan_parameter(self): """Get the scan_info parameters for the scan.""" - for key, value in self.scan_info.msg.request_inputs["inputs"].items(): - if hasattr(self.scan_parameter, key): - setattr(self.scan_parameter, key, value) for key, value in self.scan_info.msg.request_inputs["kwargs"].items(): if hasattr(self.scan_parameter, key): setattr(self.scan_parameter, key, value) diff --git a/debye_bec/devices/mo1_bragg/mo1_bragg_utils.py b/debye_bec/devices/mo1_bragg/mo1_bragg_utils.py index 38d8409..1e7148b 100644 --- a/debye_bec/devices/mo1_bragg/mo1_bragg_utils.py +++ b/debye_bec/devices/mo1_bragg/mo1_bragg_utils.py @@ -1,4 +1,4 @@ -"""Module for additional utils of the Mo1 Bragg Positioner""" +""" Module for additional utils of the Mo1 Bragg Positioner""" import numpy as np from scipy.interpolate import BSpline