From b7d35eb3bd9a0389fa96dc49a12c37e7aeff861e Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Wed, 11 Nov 2026 15:16:25 +0100 Subject: [PATCH] rugnux: a report for a live serial merge, without claims about what it did not measure StillsLiveResult makes the ProcessResult the report is read from out of a merge of StillsLiveMerge: cell and group merged in, the merge's statistics and error model, frames analysed and indexed. ProcessResult::powder_measured (true everywhere else) lets that result say powder rings were not looked for, so the SUMMARY lists Powder as not measured instead of "no rings detected". PathologyIsSerious names the codes behind the FAILED/UNUSABLE verdicts (NO_LATTICE, UNUSABLE_MERGE). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HVeDQsU5a8AJUdJPgWevAK --- rugnux/ReportDocument.h | 6 ++++++ rugnux/ResultReport.cpp | 4 +++- rugnux/Rugnux.h | 3 +++ rugnux/StillsLiveMerge.cpp | 20 ++++++++++++++++++++ rugnux/StillsLiveMerge.h | 7 +++++++ 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/rugnux/ReportDocument.h b/rugnux/ReportDocument.h index 4c78fc801..660a83dcd 100644 --- a/rugnux/ReportDocument.h +++ b/rugnux/ReportDocument.h @@ -61,6 +61,12 @@ namespace PathologyCode { constexpr const char *OVERLAPS = "OVERLAPS"; // neighbouring spots share signal pixels } +// The pathologies that leave no result to use - no lattice, or a merge without signal: the report's verdict +// is then FAILED or UNUSABLE. Every other code needs attention, with a result there to use. +inline bool PathologyIsSerious(const std::string &code) { + return code == PathologyCode::NO_LATTICE || code == PathologyCode::UNUSABLE_MERGE; +} + // A closed type plus an open description. The type is what machinery switches on; the text is what a // person reads, and it is free-form on purpose - the vocabulary must not have to grow a code every // time a sentence gains a number. diff --git a/rugnux/ResultReport.cpp b/rugnux/ResultReport.cpp index cac4f624c..9098d6028 100644 --- a/rugnux/ResultReport.cpp +++ b/rugnux/ResultReport.cpp @@ -3455,7 +3455,9 @@ ReportDocument BuildReportDocument(const std::string &output_prefix, checked_row("Overloads", {PathologyCode::OVERLOADS}, overload_row); if (!overlap_row.empty()) checked_row("Overlaps", {PathologyCode::OVERLAPS}, overlap_row); - if (!result.powder.rings_q_recipA.empty() || result.consensus_cell) { + if (!result.powder_measured) + untested("Powder", {PathologyCode::POWDER_RINGS}); + else if (!result.powder.rings_q_recipA.empty() || result.consensus_cell) { const auto &pw = result.powder; checked_row("Powder", {PathologyCode::POWDER_RINGS}, pw.rings_q_recipA.empty() ? std::string("no rings detected") : fmt::format("{} rings holding {:.0f}% of the spots found - {} ice ({:.0f}%), {} other " diff --git a/rugnux/Rugnux.h b/rugnux/Rugnux.h index 720dba98f..05bfe2a75 100644 --- a/rugnux/Rugnux.h +++ b/rugnux/Rugnux.h @@ -829,6 +829,9 @@ struct ProcessResult { // Powder contamination measured in the pre-scan: a crystalline phase other than the crystal, // diffracting as rings among its reflections. Measured and reported on every run. PowderRings powder; + // False where nothing measured it - the live serial analysis, which has no pre-scan: then the summary + // does not say "no rings detected". + bool powder_measured = true; // Whether this run acted on it - left the rings out of indexing - and the resolution it stopped // the indexing spot list at where it did. bool powder_excluded_from_indexing = false; diff --git a/rugnux/StillsLiveMerge.cpp b/rugnux/StillsLiveMerge.cpp index 5f9de2a3b..ad8ff68da 100644 --- a/rugnux/StillsLiveMerge.cpp +++ b/rugnux/StillsLiveMerge.cpp @@ -236,3 +236,23 @@ StillsMergeOutput ReplayLiveStillsMerge(const DiffractionExperiment &experiment, outcomes = live.TakeOutcomes(); return out; } + +ProcessResult StillsLiveResult(const DiffractionExperiment &experiment, const StillsMergeOutput &out, + int64_t images_analysed, int64_t images_indexed) { + ProcessResult result; + result.images_processed = static_cast(images_analysed); + if (images_analysed > 0) + result.indexing_rate = static_cast(images_indexed) / static_cast(images_analysed); + result.consensus_cell = experiment.GetUnitCell(); + result.space_group = experiment.GetGemmiSpaceGroup(); + result.powder_measured = false; + result.has_merge_statistics = true; + result.merge_statistics = out.merge.statistics; + result.resolution_fit_A = out.merge.resolution_fit_A; + result.error_model_isa = out.merge.isa; + result.error_model_isa_resolved = out.merge.isa_resolved; + result.error_model_a = out.merge.a; + result.error_model_b = out.merge.b; + result.error_model_c = out.merge.c; + return result; +} diff --git a/rugnux/StillsLiveMerge.h b/rugnux/StillsLiveMerge.h index ee8f841b9..7804973eb 100644 --- a/rugnux/StillsLiveMerge.h +++ b/rugnux/StillsLiveMerge.h @@ -99,3 +99,10 @@ StillsMergeOutput ReplayLiveStillsMerge(const DiffractionExperiment &experiment, const std::optional &given_cell, const std::optional &run_width, bool flag_ice, float ice_width, const std::vector &checkpoints, int nthreads, Logger &logger); + +// The result the report is read from (BuildReportDocument), of a merge made here: the cell and group merged in +// (`experiment`), the merge's statistics and error model, the frames analysed and indexed. What this merge does +// not look at - powder rings, ice, further lattices, twinning, pseudo-translation, anisotropy - is left +// unmeasured, so the report's checklist says "not measured" for it, never a verdict. +ProcessResult StillsLiveResult(const DiffractionExperiment &experiment, const StillsMergeOutput &out, + int64_t images_analysed, int64_t images_indexed);