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) <noreply@anthropic.com>
This commit is contained in:
2026-07-12 07:08:44 +02:00
co-authored by Claude Opus 4.8
parent 27802a30a3
commit a854523fee
@@ -140,9 +140,13 @@ ResolutionCutoffResult ComputeCCHalfLogisticCutoff(const std::vector<MergedRefle
if (step_s0 < 1e-6 * s_range && step_k < 1e-6 * best_k) break;
}
// s where the fitted CC1/2 crosses cc_target, then "one shell too far".
// s where the fitted CC1/2 crosses cc_target, then "one shell too far". The extension is one
// reported-shell width, measured over the range that is actually kept and reported (low-res
// plateau -> 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).