From 503bd367387c1d2affb831fc8f1b8995ea23e868 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Fri, 24 Jul 2026 08:41:48 +0200 Subject: [PATCH] Apply --min-image-cc merge-consistency filter on the stills merge path The per-image CC-to-reference filter (--min-image-cc) was only honoured on the rotation merge; the stills merge added every crystal unconditionally. Extend it to stills so the flag is meaningful there too: on flooded frames that produce many spurious lattices (large-cell serial data), the crystals whose per-image CC to the reference falls below the limit are dropped, keeping only the coherent ones in the merge. Opt-in and default-off (limit 0 -> the loop passes cc_filter=false and the merge is bit-identical to before), so no existing behaviour changes. Co-Authored-By: Claude Opus 4.8 (1M context) --- rugnux/Rugnux.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rugnux/Rugnux.cpp b/rugnux/Rugnux.cpp index 172a6d76..3d4c4bce 100644 --- a/rugnux/Rugnux.cpp +++ b/rugnux/Rugnux.cpp @@ -1008,8 +1008,13 @@ ProcessResult Rugnux::RunPipeline(RugnuxObserver *observer, bool write_output, b merge_engine.ErrorModelB(), merge_engine.ErrorModelB() > 0 ? 1.0 / merge_engine.ErrorModelB() : 0.0, merge_engine.ErrorModelChi2()); + // Merge-consistency filter: on floods with many spurious lattices (e.g. XFEL large cells) + // most indexed crystals do not correlate with the true structure; --min-image-cc drops the + // crystals whose per-image CC to the reference is below the limit, so the merge keeps only + // the coherent (real) ones. + const bool cc_filter = !for_search && experiment_.GetScalingSettings().GetMinCCForImage() > 0.0; for (size_t i = 0; i < merge_input.size(); ++i) - merge_engine.AddImage(merge_input[i], static_cast(i)); + merge_engine.AddImage(merge_input[i], static_cast(i), cc_filter); ScaleMergeResult out; out.merged = merge_engine.ExportReflections();