DAQ: attempted fix of sample_geometry bug to handle error when the ABR disconnects.

This commit is contained in:
2025-09-18 10:11:10 +02:00
parent 89f8574a6d
commit 77d81c182e
+30 -16
View File
@@ -650,30 +650,44 @@ class AareDAQ:
zoom = self.__devs.zoom
abr_pos = self.__cfg.abr_meas_pos
try:
return SampleGeometryModel(
aerotech_coord = 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,
)
sample_geom = 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=aerotech_coord,
aerotech_meas=self.__devs.abr_pos
)
return sample_geom
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
)
try:
test_x = self.__devs.gmx.value - abr_pos.x
print(f"Error creating sample geometry model: {e}")
print(f"Error not ABR, check smargon then restart server")
raise Exception(f"Error getting sample geometry {e}")
except:
print(f"Error getting sample geometry: {e}")
print(f"!!!!! ABR MAY HAVE DISCONNECTED !!!!!")
print(f"!!!!! CHECK ABR EPICS PANEL FOR ERRORS!!!!!")
print("!!!!! IF NOT RESTART GUI !!!!!")
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=0.0, y=0.0, z=0.0),
aerotech_meas=self.__devs.abr_pos
)
@property
def beam_center(self) -> Tuple[float, float]: