From c657a6ca20d74ea3ee106f5d59cf0bb976ce05f1 Mon Sep 17 00:00:00 2001 From: David Perl Date: Mon, 13 Jul 2026 10:52:05 +0200 Subject: [PATCH] fix: truncate requested detector position if request is impossible --- src/aare/daq/daq.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/aare/daq/daq.py b/src/aare/daq/daq.py index ab5ced80..d252b579 100644 --- a/src/aare/daq/daq.py +++ b/src/aare/daq/daq.py @@ -1996,13 +1996,15 @@ class AareDAQ: if request.dtz is not None: if request.dtz < self.__cfg.cached_dtz_low: - raise ValueError( - f"Requested DTZ {request.dtz} is less than low detector limit {self.__cfg.cached_dtz_low}" + logger.error( + f"Requested DTZ {request.dtz} is less than low detector limit {self.__cfg.cached_dtz_low}. Truncating to the nearest allowable value." ) + request.dtz = self.__cfg.cached_dtz_low elif request.dtz > self.__cfg.cached_dtz_high: - raise ValueError( - f"Requested DTZ {request.dtz} exceeds high detector limit {self.__cfg.cached_dtz_high}" + logger.error( + f"Requested DTZ {request.dtz} exceeds high detector limit {self.__cfg.cached_dtz_high}. Truncating to the nearest allowable value." ) + request.dtz = self.__cfg.cached_dtz_high logger.info(f"requesting dtz to move to {request.dtz}") self.__cfg.dtz = request.dtz else: