From 796b72f8b7f1e3c28d6f56dd85c0e4e4d6aa8a69 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 1 Nov 2026 08:56:31 +0100 Subject: [PATCH] rugnux: the header line and console summary print the wavelength --wavelength set The "Header:" log line and the console note under it printed the input file's wavelength (or the reader's 1 A placeholder where the file states none) even when --wavelength overrode it, so a run that processed, refined and wrote everything at the given wavelength announced another one at the top of its log. They now print the wavelength used, naming the file's value beside it when the option replaced it. --mode scale keeps the wavelength its reflections were integrated at, so it still prints the file's. The report (WAVELENGTH=, XDS.INP block), the merged and unmerged MTZ, the mmCIF and the _process.h5 were already written from the overridden experiment. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HVeDQqN9qRD57vnShzTC37 --- rugnux/rugnux_cli.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/rugnux/rugnux_cli.cpp b/rugnux/rugnux_cli.cpp index cc30c1bb5..9fb9bac46 100644 --- a/rugnux/rugnux_cli.cpp +++ b/rugnux/rugnux_cli.cpp @@ -2163,15 +2163,22 @@ int RugnuxInputRun::PrepareRugnuxInput() { output_provenance.collection_date = dataset->arm_date; { // The header as the file states it, before anything is measured: what a question about a run - // is answered from first. + // is answered from first. The wavelength is the one used: --wavelength, where given, is not + // refined later, so the file's value would be printed for a run that never used it (--mode scale + // keeps the wavelength its reflections were integrated at). const auto &x = dataset->experiment; const auto gonio = x.GetGoniometer(); const auto [direct_x, direct_y] = x.GetDiffractionGeometry().GetDirectBeam_pxl(); - logger.Info("Header: {} images, detector {} {} x {} px of {:.4f} mm, wavelength {:.5f} A, distance " + const bool wavelength_given = wavelength_A && mode != RugnuxMode::Scale; + const float used_wavelength_A = wavelength_given ? *wavelength_A : x.GetWavelength_A(); + const std::string wavelength_source = + wavelength_given ? fmt::format(" (--wavelength; the file states {:.5f} A)", x.GetWavelength_A()) : ""; + logger.Info("Header: {} images, detector {} {} x {} px of {:.4f} mm, wavelength {:.5f} A{}, distance " "{:.3f} mm, beam {:.2f} {:.2f} px (direct beam {:.2f} {:.2f}), tilt {:.4f} {:.4f} deg, {}, " "polarization {}", reader.GetNumberOfImages(), x.GetDetectorDescription(), x.GetXPixelsNum(), x.GetYPixelsNum(), - x.GetPixelSize_mm(), x.GetWavelength_A(), x.GetDetectorDistance_mm(), x.GetBeamX_pxl(), + x.GetPixelSize_mm(), used_wavelength_A, wavelength_source, x.GetDetectorDistance_mm(), + x.GetBeamX_pxl(), x.GetBeamY_pxl(), direct_x, direct_y, x.GetPoniRot1_rad() * 180.0 / PI, x.GetPoniRot2_rad() * 180.0 / PI, gonio ? fmt::format("rotation from {:.3f} deg by {:.4f} deg per image", gonio->GetStart_deg(), @@ -2181,7 +2188,7 @@ int RugnuxInputRun::PrepareRugnuxInput() { : std::string("not stated")); console->OnNote(fmt::format("{} images, {} {} x {} px", reader.GetNumberOfImages(), x.GetDetectorDescription(), x.GetXPixelsNum(), x.GetYPixelsNum())); - console->OnNote(fmt::format("{:.4f} A, {:.1f} mm, {}", x.GetWavelength_A(), x.GetDetectorDistance_mm(), + console->OnNote(fmt::format("{:.4f} A, {:.1f} mm, {}", used_wavelength_A, x.GetDetectorDistance_mm(), gonio ? fmt::format("{:.3f} deg per image", gonio->GetIncrement_deg()) : std::string("no rotation axis"))); }