DAQ: error handling when sample.geoemtry request fails

This commit is contained in:
leonarski_f committed 2025-09-11 14:48:02 +02:00
1 parent ebd403fcf7
commit 71587a584d
1 file changed
+25 -13
+25 -13
View File
@@ -634,19 +634,31 @@ class AareDAQ:
def sample_geometry(self) -> SampleGeometryModel:
zoom = self.__devs.zoom
abr_pos = self.__cfg.abr_meas_pos
return SampleGeometryModel(
beam_location_pxl=self.__cfg.beam_mark_coeff.apply(zoom),
pixel_in_mm=self.__cfg.pixel_to_mm(zoom),
omega_deg=self.__devs.aerotech.omega,
smargon=self.__devs.smargon.readback,
beam_size_mm=self.__cfg.beam_size_mm,
aerotech=Coordinate(
x=self.__devs.gmx.value - abr_pos.x,
y=self.__devs.gmy.value - abr_pos.y,
z=self.__devs.gmz.value - abr_pos.z,
),
aerotech_meas=self.__devs.abr_pos
)
try:
return SampleGeometryModel(
beam_location_pxl=self.__cfg.beam_mark_coeff.apply(zoom),
pixel_in_mm=self.__cfg.pixel_to_mm(zoom),
omega_deg=self.__devs.aerotech.omega,
smargon=self.__devs.smargon.readback,
beam_size_mm=self.__cfg.beam_size_mm,
aerotech=Coordinate(
x=self.__devs.gmx.value - abr_pos.x,
y=self.__devs.gmy.value - abr_pos.y,
z=self.__devs.gmz.value - abr_pos.z,
),
aerotech_meas=self.__devs.abr_pos
)
except Exception as e:
print(f"Error getting sample geometry: {e}")
return SampleGeometryModel(
beam_location_pxl=Coordinate(x=0, y=0),
pixel_in_mm=Coordinate(x=0, y=0),
omega_deg=0.0,
smargon=SmargonCoordinate(sh_mm=Coordinate(x=0, y=0), phi_deg=0.0, chi_deg=0.0),
beam_size_mm=Coordinate(x=0, y=0),
aerotech=Coordinate(x=0, y=0, z=0),
aerotech_meas=self.__devs.abr_pos
)
@property
def beam_center(self) -> Tuple[float, float]: