From 2e4196696cc725951097afa929b580bd9ccabe9c Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sat, 19 Sep 2026 18:33:39 +0200 Subject: [PATCH] rugnux: a rotation run decides with Friedel mates merged, -A or not -A set MergeFriedel(false), and RotationScaleMerge builds one grouping for the whole pass from it, so every decision on an anomalous rotation run was taken on hand-separated groups: per-frame scaling, the correction surfaces, the outlier median, the error model, the CC1/2 half-sets and the resolution cut, the delta-CC1/2 frame ledger and the space-group search. That halves the multiplicity each of those gates was calibrated at, and flipped the bare run's symmetry, resolution and frame-rejection calls on several sets - none of them through the anomalous signal (a 422 refused on an added-operator R, a 23 refused on a chi^2 gate, a screw row read on hand rows, thin hands exempt from the outlier median letting one hot pair own a CC1/2 bin). A rotation run now always merges with Friedel's law: the Rugnux constructor turns MergeFriedel back on when the run is rotation (IsRotationIndexing, which --force-still clears), and --mode scale does the same for its rotation merge. Nothing is lost for anomalous use: the merge always keeps the Bijvoet split, and I(+)/I(-), F(+)/F(-), SigAno and CCanom are written and reported from it whether or not -A was given. -A on a rotation run is therefore a no-op on the processing, which is the point; stills keep -A as their only anomalous route. A bare run is untouched. This is step 1 of the -A design (decide with pairs merged, present with them split). The per-hand statistics table that -A should select is not built yet, so an -A rotation run now reports the Friedel-merged table (FRIEDELS_LAW= TRUE, Laue multiplicity and completeness). The thin-hand pair median of the previous commit is unreachable from rugnux on rotation data but kept for any direct MergeFriedel(false) caller of RotationScaleMerge. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_013nW6FNRP1bBJJ8pfHiByAT --- rugnux/Rugnux.cpp | 17 +++++++++++++++++ rugnux/rugnux_cli.cpp | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/rugnux/Rugnux.cpp b/rugnux/Rugnux.cpp index 8e40c0399..557c79afe 100644 --- a/rugnux/Rugnux.cpp +++ b/rugnux/Rugnux.cpp @@ -497,6 +497,23 @@ Rugnux::Rugnux(JFJochReader &reader, DiffractionExperiment experiment, LogHeaderBeamCenter(experiment_, pixel_mask_); + // Every decision on a rotation run - per-frame scaling, the correction surfaces, the outlier test, + // the error model, the CC1/2 half-sets and the resolution cut, the frame ledger, the space-group + // search - is taken with Friedel mates merged, -A or not. Splitting them halves the multiplicity + // every one of those gates was calibrated at, which is a noisier instrument rather than a more + // careful one: it flipped symmetry, resolution and frame-rejection calls against the bare run on + // several sets, none of them through the anomalous signal. It is also what XDS, AIMLESS, POINTLESS + // and DIALS decide on. The anomalous signal is not lost: the merge always keeps the Bijvoet split, + // and I(+)/I(-), SigAno and CCanom come from it in either mode. Stills keep -A as it was - their + // merge has no separate split. + if (experiment_.IsRotationIndexing() && !experiment_.GetScalingSettings().GetMergeFriedel()) { + ScalingSettings s = experiment_.GetScalingSettings(); + experiment_.ImportScalingSettings(s.MergeFriedel(true)); + Logger("Rugnux").Info("-A on rotation data: every processing decision is made with Friedel mates " + "merged; I(+)/I(-), SigAno and CCanom are reported from the Bijvoet split " + "the merge keeps, exactly as without -A"); + } + // A manually asserted stage calibration applies to everything, before anything reads an angle. if (config_.rotation_scale.has_value()) if (const auto g = experiment_.GetGoniometer()) { diff --git a/rugnux/rugnux_cli.cpp b/rugnux/rugnux_cli.cpp index 6ffbc469d..e4b6fdc9d 100644 --- a/rugnux/rugnux_cli.cpp +++ b/rugnux/rugnux_cli.cpp @@ -1577,7 +1577,8 @@ static int RunRugnux(int argc, char **argv) { if (report_resolution_arg) scaling_settings.ReportResolutionRange_A( ParseReportResolution(*report_resolution_arg, scaling_settings, logger)); - scaling_settings.MergeFriedel(!anomalous_mode); + // Rotation merges decide with Friedel mates merged, -A or not (see the Rugnux constructor). + scaling_settings.MergeFriedel(!anomalous_mode || rot); scaling_settings.MinPartiality(min_partiality); scaling_settings.MinCapturedFraction( min_captured_fraction_arg.value_or(scaling_settings.GetMinCapturedFraction()));