From 574a1bdde8d514f937f6c2fdb00e25fe4d7c1e7d Mon Sep 17 00:00:00 2001 From: x01dc Date: Mon, 27 Jul 2026 16:12:04 +0200 Subject: [PATCH] fix(tomo_params): block submit/queue-add when Fermat scan is below minimum The estimated Fermat-scan point count was only ever flagged with an orange label -- Submit and Add-to-queue would both happily accept a configuration that's guaranteed to abort when actually run. Enforce the same minimum in _validate(), shared by both actions, so it's now a hard block instead of a cosmetic warning. --- .../bec_widgets/widgets/tomo_params/tomo_params.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py b/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py index 7f4ed37..f58fe23 100644 --- a/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py +++ b/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py @@ -848,6 +848,13 @@ class TomoParamsWidget(BECWidget, QWidget): rshift = params.get("single_point_random_shift_max", 0.0) if not 0 <= rshift <= 10: return "single_point_random_shift_max must be between 0 and 10 µm" + count, min_positions = self._profile["compute_fermat_positions"](params) + if count < min_positions: + return ( + f"Estimated Fermat scan points ({count}) is below the minimum of " + f"{min_positions} required for the scan to run -- increase FOV, " + "reduce step size, or adjust stitch/piezo range before submitting." + ) return None # ── type visibility ─────────────────────────────────────────────────────── @@ -911,8 +918,10 @@ class TomoParamsWidget(BECWidget, QWidget): edited fov/step/stitch/piezo-range fields (see self._profile["compute_fermat_positions"], which calls the real scan class's own position-generation algorithm -- not a - reimplementation). Warning-only: flags orange below the scan - server's own minimum, never blocks Submit/Add-to-queue.""" + reimplementation). This is just the live preview cue (flags orange + below the scan server's own minimum); the actual minimum is + enforced as a hard block in _validate(), shared by both + submit_params() and add_edited_to_queue().""" params = {} for key in self._profile["fermat_position_fields"]: widget = self._pw.get(key)