DAQ: change exposure and gain based of off zoom. Interpolates gain and exposure if zoom value is not in redis.

This commit is contained in:
leonarski_f committed 2025-07-07 11:36:04 +02:00
1 parent 7c03965302
commit 6fb53e9bbd
3 files changed
+73 -6

No files matched your search

+13 -1
View File
@@ -14,7 +14,7 @@ from aaredaqlib.models import (
def_loop_centering_zoom,
SampleShortInfo,
SessionStatus,
BeamlineStateEnum, SessionsStateEnum, SampleShortInfoList, CryojetSettingsModel,
BeamlineStateEnum, SessionsStateEnum, SampleShortInfoList, CryojetSettingsModel, ZoomModel, def_zoom,
)
from aaredaqlib.beamline import MXBeamline
@@ -352,6 +352,18 @@ class BeamlineConfig:
def alc_zoom_settings(self, data: LoopCenteringZoomModel):
self.__client.set(f"{self.__bl}:alc_zoom_settings", data.model_dump_json())
@property
def zoom_settings(self) -> ZoomModel:
tmp = self.__client.get(f"{self.__bl}:zoom_settings")
if tmp is None:
return def_zoom()
data_dict = json.loads(tmp)
return ZoomModel(**data_dict)
@zoom_settings.setter
def zoom_settings(self, data: ZoomModel):
self.__client.set(f"{self.__bl}:zoom_settings", data.model_dump_json())
@property
def abr_meas_pos(self) -> Coordinate:
tmp = self.__client.get(f"{self.__bl}:abr_meas_pos")
+4 -2
View File
@@ -97,6 +97,8 @@ class AareDAQ:
def zoom(self, val: float):
self.__saved_box = None
self.__devs.zoom = val
self.samcam_settings = self.__cfg.zoom_settings.get_camera_settings(val)
#elf.__cfg.state_busy = False
@property
def light(self) -> float:
@@ -226,7 +228,7 @@ class AareDAQ:
self.__cfg.current_sample = None
else:
# reset zoom
self.__devs.zoom = 280
self.zoom = 280
# mount sample
self.__aare.sample_unmounted(curr_sample)
self.__devs.tell.mount(
@@ -414,7 +416,7 @@ class AareDAQ:
for s in self.__cfg.alc_zoom_settings.z:
self.__devs.samcam_settings = SampleCameraSettings(exposure=s.sam_cam_exp, gain=s.sam_cam_gain)
self.__devs.zoom = s.zoom_value
self.zoom = s.zoom_value
time.sleep(5.0) # Wait for settings to stabilize
image = self.__devs.sample_cam.get_image(gray=False)