DAQ: bug fixes/tidy up of exception calls

This commit is contained in:
2026-04-15 16:25:17 +02:00
parent 5c207ed5de
commit 72fa8e11ef
+18 -18
View File
@@ -481,7 +481,7 @@ class AareDAQ:
self.__devs.aerotech_pos = new_meas_pos
self.__saved_box = None
self.__cfg.state_busy = False
except:
except Exception:
self.__cfg.state_busy = False
raise
@@ -490,7 +490,7 @@ class AareDAQ:
try:
self.__cfg.abr_meas_pos = self.__devs.aerotech_pos
self.__cfg.state_busy = False
except:
except Exception:
self.__cfg.state_busy = False
raise
@@ -499,7 +499,7 @@ class AareDAQ:
try:
self.__devs.aerotech_pos = self.__cfg.abr_meas_pos
self.__cfg.state_busy = False
except:
except Exception:
self.__cfg.state_busy = False
raise
@@ -516,7 +516,7 @@ class AareDAQ:
self.__aare.create_manual_sample(target)
self.__cfg.current_sample = target
self.__cfg.state_busy = False
except:
except Exception:
self.__cfg.state_busy = False
raise
@@ -532,7 +532,7 @@ class AareDAQ:
except Exception as e:
self.__cfg.state_busy = False
logger.error(f"Failed to park and dry: {e}")
raise e
raise
def __magnet_position_sensor_check(self, timeout: float = 1.0, repeat: bool = True):
#TODO check this works, add beamstop z controls and test.
@@ -572,8 +572,6 @@ class AareDAQ:
self.__aare.sample_unmounted(self.__cfg.current_sample)
logger.info(f"Mount result: {value}")
self.__cfg.current_sample = target
if self.__cfg.current_sample is not None and self.__cfg.current_sample.db_id is not None:
self.__aare.sample_mounted(self.__cfg.current_sample)
except Exception as e:
logger.error(f"Mount failed: {e}")
if self.__cfg.current_sample is not None and self.__cfg.current_sample.db_id is not None:
@@ -607,13 +605,13 @@ class AareDAQ:
# curr_sample_is_manual = True
#if target is not None or not curr_sample_is_manual:
logger.debug(target)
self.__mount(target)
self._execute_mount_and_prepare(target)
logger.info(f"Sample mounted: {target}")
except Exception as e:
self.__cfg.state_busy = False
logger.debug(f"Failed to mount sample: {e}")
# self.__aare.sample_failed(target, f"Mount failed due to {e}")
raise e
raise
workflows.rse2sa(devs=self.__devs, cfg=self.__cfg)
self.__cfg.state_busy = False
# if target is not None:
@@ -992,7 +990,7 @@ class AareDAQ:
raise
except Exception as e:
logger.error(f"Failed during raster: {e}")
raise Exception(f"Failed during raster: {e}") from e
raise
def measure_raster(self, r: RasterGridRequest, auto: bool) -> CompletedRasterGrid:
"""
@@ -1017,7 +1015,7 @@ class AareDAQ:
except Exception as e:
self.__set_state(BeamlineStateEnum.SampleAlignment)
self.__cfg.state_busy = False
raise e
raise
def __rotation(self, request: RotationScanRequest) -> CompletedRotationScan:
omega_start = self.omega
@@ -1105,7 +1103,7 @@ class AareDAQ:
except Exception as e:
self.__set_state(BeamlineStateEnum.SampleAlignment)
self.__cfg.state_busy = False
raise e
raise
@property
def dtz(self) -> float:
@@ -1146,7 +1144,7 @@ class AareDAQ:
self.__cfg.state_busy = False
except Exception as e:
self.__cfg.state_busy = False
raise e
raise
pass
def mark_beam(self, x_pxl: float, y_pxl: float):
@@ -1156,7 +1154,7 @@ class AareDAQ:
self.__cfg.state_busy = False
except Exception as e:
self.__cfg.state_busy = False
raise e
raise
def clear_mark_beam(self):
self.__cfg.set_busy(BeamlineStateEnum.BeamLocation)
@@ -1909,7 +1907,9 @@ class AareDAQ:
self._handle_operation_error("measure", sample, e, error_type="generic")
finally:
return self._end_operation(start)
logger.debug(f"finally at {time.perf_counter() - start}")
return self._end_operation(start)
def __set_state(self, target: BeamlineStateEnum):
"""__set_state assumes that beamline is already in busy state
@@ -1996,11 +1996,11 @@ class AareDAQ:
except TransformationInvalidException as e:
self.__cfg.state = curr_state
self.__cfg.state_busy = False
raise e
raise
except Exception as e:
self.__cfg.state = BeamlineStateEnum.Maintenance
self.__cfg.state_busy = False
raise e
raise
@property
def shutter(self) -> bool:
@@ -2199,4 +2199,4 @@ class AareDAQ:
except Exception as e:
self.__set_state(BeamlineStateEnum.SampleAlignment)
self.__cfg.state_busy = False
raise e
raise