DAQ: added a function to get parameters from the database for a given sample

This commit is contained in:
martinappleby
2025-11-05 14:21:44 +01:00
parent a08ea4bc5d
commit 190858e1fc
+39
View File
@@ -103,6 +103,45 @@ class AareDAQ:
def smart_params(self, params: SimpleScanParameters):
self.auto_params = params
def spreadsheet_params(self) -> Optional[SimpleScanParameters]:
if self.status.sample is None:
return None
aaredb_params = self.status.sample.aaredb_params if hasattr(self.status.sample, "aaredb_params") else None
if aaredb_params is None:
return None
params = SimpleScanParameters()
if (exp := getattr(aaredb_params, 'exposure', None)) is not None:
params.exp_time_s = exp
if (trans := getattr(aaredb_params, 'transmission', None)) is not None:
params.transmission = trans / 100.0 if trans > 1.0 else trans
if (res := getattr(aaredb_params, 'targetresolution', None)) is not None:
params.dtz = self.diffraction_geometry.calc_dtz_mm(res)
osc = getattr(aaredb_params, 'oscillation', None)
total = getattr(aaredb_params, 'totalrange', None)
default_osc = SimpleScanParameters().incr_omega_deg
if osc is not None:
osc = abs(osc)
if osc > 0:
params.incr_omega_deg = osc
if total is not None and abs(total) > 0:
params.steps = round(abs(total) / osc)
else:
params.steps = round(360.0 / osc)
elif total is not None and abs(total) > 0:
params.incr_omega_deg = default_osc
params.steps = round(abs(total) / default_osc)
return params
@property
def omega(self) -> float:
return self.__devs.aerotech.omega