From a854523fee311f27754cbbf16c8efac1835944e6 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 12 Jul 2026 07:08:44 +0200 Subject: [PATCH] rugnux: fix resolution-cutoff over-extension on low-res crystals The CC1/2-logistic auto resolution cutoff extended the fall-off crossing by "one shell" = s_range/10, where s_range spans to the detector edge. On a low-res crystal read out by a high-res-configured detector (integration runs to the ~1.4 A edge), that range is dominated by high-res noise, so one "shell" is a huge step in s that overshoots the true fall-off by ~1 A: Benas_3's CC1/2=0.30 crossing at 3.77 A was pushed to 2.98 A, Benas_7's 4.04 A to 2.97 A. The logistic fit itself is accurate; only the extension was wrong. Anchor the extension to the range actually kept and reported (low-res plateau -> the crossing), (s_cross - s_lo)/10, instead of the detector-edge range. Benas_3 -> 3.60 A, Benas_7 -> 3.85 A. The change is monotonic in (crossing - edge) and always coarser (never adds noise): zero change for crystals diffracting to the edge, negligible for well-diffracting ones, and only meaningful where the detector over-reaches the diffraction limit. Co-Authored-By: Claude Opus 4.8 (1M context) --- image_analysis/scale_merge/ResolutionCutoff.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/image_analysis/scale_merge/ResolutionCutoff.cpp b/image_analysis/scale_merge/ResolutionCutoff.cpp index 65df0f44..675f645e 100644 --- a/image_analysis/scale_merge/ResolutionCutoff.cpp +++ b/image_analysis/scale_merge/ResolutionCutoff.cpp @@ -140,9 +140,13 @@ ResolutionCutoffResult ComputeCCHalfLogisticCutoff(const std::vector the fall-off crossing), NOT the full measured range: when the detector reaches far + // past where the crystal diffracts (a high-res-configured detector on a low-res crystal), the + // full range is dominated by high-res noise, so s_range/10 would be a huge over-extension. const double s_cross = s0 + std::log(1.0 / cc_target - 1.0) / k; - const double delta_s = s_range / SHELLS_FOR_EXTENSION; + const double delta_s = (s_cross - s_lo) / SHELLS_FOR_EXTENSION; const double s_final = s_cross + delta_s; // No cut if the fall-off is beyond the measured edge (CC1/2 still healthy at the highest s).