From 90b1b7a65913faeecfd43d1476dd632052ffa287 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Wed, 21 Oct 2026 19:58:22 +0200 Subject: [PATCH] Stills given a cell: the written cell is the mean over the frames that are merged GetConsensusUnitCell averaged every indexed frame within 5% of the -C cell. The given-cell population filter runs after it, so the MTZ, report and model-validation cell was a mixture of both forms. Frames whose retained outcome is empty now do not count, and the consensus cell is read again once the population filter has cleared the other form's frames. Two-form P21 serial data (LCLS): - T run: 93.85/93.66/49.98/92.00 -> 95.21/94.50/50.42/91.09 (kept population ~95.5/94.1/50.3/91.2) - S run: 92.38/93.29/49.59/93.26 -> 91.90/93.06/49.45/93.65 (deposited 92.04/93.02/49.01) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu --- image_analysis/IndexAndRefine.cpp | 7 ++++++- rugnux/RugnuxScaleMerge.cpp | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/image_analysis/IndexAndRefine.cpp b/image_analysis/IndexAndRefine.cpp index f56aa0b26..8d899bec1 100644 --- a/image_analysis/IndexAndRefine.cpp +++ b/image_analysis/IndexAndRefine.cpp @@ -983,11 +983,16 @@ std::optional IndexAndRefine::GetConsensusUnitCell() const { return result->lattice.GetUnitCell(); } + // The cell of the frames that are merged: where the per-image outcomes are kept, a frame the merge + // has left out (its reflections cleared, e.g. by the given-cell population filter) does not count. std::vector cells; { std::unique_lock ul(reflections_mutex); cells.reserve(unit_cells.size()); - for (const auto &cell: unit_cells) { + for (size_t i = 0; i < unit_cells.size(); i++) { + const auto &cell = unit_cells[i]; + if (retain_outcomes_ && integration_outcome[i].reflections.empty()) + continue; if (cell && cell->is_finite()) cells.emplace_back(*cell); } diff --git a/rugnux/RugnuxScaleMerge.cpp b/rugnux/RugnuxScaleMerge.cpp index b4d19bc2b..815b0edec 100644 --- a/rugnux/RugnuxScaleMerge.cpp +++ b/rugnux/RugnuxScaleMerge.cpp @@ -537,10 +537,14 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) { (r < low ? below : above)++; } } - if (below + above > 0) + if (below + above > 0) { logger.Info("Given cell: {} of {} indexed frames refined to a cell outside its population " "({:+.1f}% to {:+.1f}% in volume) and are left out of the merge - {} smaller, {} larger", below + above, rel.size(), 100 * low, 100 * high, below, above); + // The cell written is the mean over the frames merged, not over the other form's as well. + result.consensus_cell = indexer->GetConsensusUnitCell(); + end_msg.unit_cell = result.consensus_cell; + } } size_t ice_flagged = 0, ice_total = 0; {