config, added lens_magnfiication to alter pixel_to_mm calculation

This commit is contained in:
appleb_m
2026-06-24 15:30:05 +02:00
parent 7c8e3e78a8
commit 2fbb86df84
3 changed files with 14 additions and 1 deletions
+1
View File
@@ -27,6 +27,7 @@ daq:
redis_url: "x06da-redis.psi.ch"
aarelc_url: "http://sls-gpu-003:9094"
dtz_safe_position: null
lens_magnification: 10 #or 5 currently
db:
aaredb_url: "https://mx-aaredb-dmz-01.psi.ch/dispatcher"
+1
View File
@@ -26,6 +26,7 @@ daq:
redis_url: "x10sa-redis.psi.ch"
aarelc_url: "http://sls-gpu-003:9090"
dtz_safe_position: 300
lens_magnification: 10 #or 5 currently
db:
aaredb_url: "https://mx-aaredb-dmz-01.psi.ch/dispatcher"
+12 -1
View File
@@ -47,6 +47,7 @@ ABR_POS_MOUNT = AerotechCoordinate(
omega_deg=0
)
ABR_OMEGA_MOUNT = 0.0
DEFAULT_LENS_MAGNIFICATION = 10.0
logger = setup_logger("aareDAQ")
@@ -608,10 +609,20 @@ class BeamlineConfig:
def pixel_to_mm(self, zoom: float) -> float:
cfg = self.settings
return 1.0 / (
base_pixel_in_mm = 1.0 / (
cfg.camera_translation_factor_b
* np.exp(cfg.camera_translation_factor_a * zoom)
)
# Apply lens magnification correction relative to the default 10x lens.
# A lower magnification lens (e.g. 5x) makes each pixel cover more physical space.
lens_magnification = cfg_get("daq.hardware.lens_magnification", DEFAULT_LENS_MAGNIFICATION)
try:
lens_magnification = float(lens_magnification)
except (TypeError, ValueError):
lens_magnification = DEFAULT_LENS_MAGNIFICATION
if lens_magnification <= 0:
lens_magnification = DEFAULT_LENS_MAGNIFICATION
return base_pixel_in_mm * (DEFAULT_LENS_MAGNIFICATION / lens_magnification)
@property
def beam_center(self) -> Tuple[float, float]: