RotationScaleMerge: scaling loops run to an rms step of 1e-5, accelerated from 1e-2 (RESULT-CHANGING)

The per-frame scaling tolerance goes from 1e-3 to 1e-5, and the Anderson onset (also the round the
fulls loop keeps its cross-validated lambda) becomes an absolute 1e-2 instead of 10x the tolerance.

Evaluated on 35 merged sets (ci tier + scaling-audit sets), on top of the loop fixes:
- plain 1e-3: 8913 iterations, 38 s of loop time on GPU, 7 loops at the 100-round cap;
- plain 1e-5: 35212 iterations, 120 s, 17 loops at the cap;
- Anderson 1e-3 (previous default): 3715 iterations, 16 s, merged intensities as far from
  the converged ones as plain 1e-3 (median 0.13%, max 4.3%);
- Anderson 1e-5 (this commit): 6507 iterations, 27 s, longest loop 89 rounds, merged
  intensities within 0.2% of plain 1e-5 and identical SG, d_min, CC1/2, ISa, R_meas, R_free.
No space group or verdict changes in any mode. The converged merge is not measurably better
against the references, but it no longer depends on where a loop happened to stop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXc1zD1yxHqaR1DGdCTHL4
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-10-20 02:18:19 +02:00
1 parent 97ef0936b2
commit 4620130f71
2 files changed
+8 -6

No files matched your search

@@ -59,15 +59,17 @@ namespace {
constexpr double MIN_EVENTS_PER_FRAME_SCALE_PARTIALS = 50.0;
constexpr int64_t MIN_REFLECTIONS_FOR_IMAGE_CC = 20; // below this a frame's CC means nothing
// The per-frame scaling loop has settled when the scales moved less than this between two
// iterations, as the rms of |log(G_new/G_old)| over the frames fitted in both.
constexpr double SCALING_TOLERANCE = 1e-3;
// iterations, as the rms of |log(G_new/G_old)| over the frames fitted in both. Tight enough that the
// merge no longer depends on where a loop stopped: with Anderson mixing a loop gets here in fewer
// rounds than a plain one took to 1e-3.
constexpr double SCALING_TOLERANCE = 1e-5;
// The rounds of history the per-frame scaling loops are accelerated with (AndersonMixing). Their slow
// directions are a few smooth modes over the sweep: measured on a 4nwv-class sweep, 3, 5 and 8 rounds
// take its ten loops in 92, 91 and 90 iterations, against 364 without.
constexpr int SCALING_ANDERSON_DEPTH = 5;
// The loops are accelerated only once their step is within this of the tolerance: Anderson mixing
// models the map near its fixed point, and a loop still further out is as likely to be walking.
constexpr double SCALING_ANDERSON_ONSET = 10.0 * SCALING_TOLERANCE;
// The loops are accelerated only once their step is below this: Anderson mixing models the map near
// its fixed point, and a loop still further out is as likely to be walking.
constexpr double SCALING_ANDERSON_ONSET = 1e-2;
// A scaling loop has stopped settling when the trend of log(step) over its last this many rounds is
// not falling (StepsStoppedFalling): a steady slow fall is a loop still contracting, a flat or
// rising trend is not.