From 84e1ed78b48852eefd5845e72b7d6159a0a6743e Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Fri, 20 Nov 2026 22:21:03 +0100 Subject: [PATCH] Report: BEAM_CENTRE_OFF on the background alone only where no lattice refined the centre The background-only branch of the beam-centre warning was gated on the absence of rotation post-refinement, with stills taken as "a run that refined nothing". Stills refine the centre - the geometry trial on the sample and the stills geometry fit - so the warning fired on the background's word against a refined centre that agreed with the file's to a pixel or three: on 5 of 12 serial sets, one of them claiming the file 355 px off where the isotropy fit had landed in a corner between detector quadrants. The gate now also asks that the stills geometry fit used no frames; the first branch (refined centre vs file) already covers a stills run whose file is wrong. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HVeDQrPqZ52Tp6rzzZGxf3 (cherry picked from commit 33282c2e0e37ddc6e2df3f3a9d1f074992ece161) --- docs/RUGNUX_REPORT.md | 6 +++--- rugnux/ResultReport.cpp | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/RUGNUX_REPORT.md b/docs/RUGNUX_REPORT.md index 994030b29..a16df564e 100644 --- a/docs/RUGNUX_REPORT.md +++ b/docs/RUGNUX_REPORT.md @@ -181,9 +181,9 @@ height, the number the log's `Beam centre check` line states, here on the run's shift is more than three times that, a **`BEAM_CENTRE_OFF`** warning gives the file's, the refined and the background centre, the difference in pixels and millimetres, and the value to correct the beamline (or the header) to: the run itself integrated at the refined centre, but every other program given the same -file starts from the wrong one. A run that refined no centre (stills) is warned on the background -alone, where its fit resolves the difference (three sigma) and the difference exceeds three times the -tolerance, worded as a check. Between one and three times the tolerance the summary's `Beam centre` +file starts from the wrong one. A run that refined no centre - no post-refinement on a rotation run, no +geometry fit on the sample of a stills run - is warned on the background alone, where its fit resolves the +difference (three sigma) and the difference exceeds three times the tolerance, worded as a check. Between one and three times the tolerance the summary's `Beam centre` line says so and recommends correcting the beamline value, without a warning - most headers are a few pixels off. diff --git a/rugnux/ResultReport.cpp b/rugnux/ResultReport.cpp index af9350720..9223bcb80 100644 --- a/rugnux/ResultReport.cpp +++ b/rugnux/ResultReport.cpp @@ -1097,9 +1097,11 @@ ReportDocument BuildReportDocument(const std::string &output_prefix, Add(s, KeyReal("BEAM_CENTRE_TOLERANCE", need, "{:.2f}")); // The refined geometry is the evidence wherever the run refined one: the background fit can // be pulled by an asymmetric background, and where both exist and disagree the spot - // positions are what the result rests on. Only a run that refined nothing (stills, no - // post-refinement) is warned on the background alone, and only where the fit resolves the - // difference at all (three of its own sigma, as the pre-scan's check reads it). + // positions are what the result rests on. Only a run that refined nothing - no rotation + // post-refinement, no stills geometry fit on the sample - is warned on the background alone, + // and only where the fit resolves the difference at all (three of its own sigma, as the + // pre-scan's check reads it). + const bool refined_centre = result.post_refine.has_value() || result.stills_geometry_frames > 0; const bool bg_resolves = bg && bg_moved > 3.0 * bg->sigma_pxl; const std::string bg_text = bg ? fmt::format("the scattered background at ({:.2f}, {:.2f}) +- {:.2f} px", bg->beam_x_pxl, bg->beam_y_pxl, bg->sigma_pxl) @@ -1119,7 +1121,7 @@ ReportDocument BuildReportDocument(const std::string &output_prefix, result.used_direct_beam_x_pxl, result.used_direct_beam_y_pxl, bg ? ", " + bg_text : std::string(), result.used_direct_beam_x_pxl, result.used_direct_beam_y_pxl)); - } else if (std::isfinite(need) && !result.post_refine && bg_resolves && bg_moved > warn_at) { + } else if (std::isfinite(need) && !refined_centre && bg_resolves && bg_moved > warn_at) { beam_centre_row = fmt::format("the background puts it {:.1f} px ({:.2f} mm) from the file's - " "check the beamline value", bg_moved, bg_moved * pixel_mm); Warn(doc, PathologyCode::BEAM_CENTRE_OFF, fmt::format(