Rugnux: walk the goniometer rotation scale to its fixed point, decided on the whole sweep
The pass-1 post-refinement fits the rotation scale k only on the frames the stored angles still track, and a rate error is exactly what stops them tracking the rest: on a sweep whose stage turned ~3 % slow the fit read 0.979 over 94 deg, failed its leave-a-fifth-out test and was thrown away, leaving half the frames unscaled. The pass no longer decides. Between the passes, at the pass-2 detector geometry, the lattice is indexed (index-only probe) under the stored angles and under the fitted k and scored on the validation frames of the whole sweep: share of the spots on the lattice beyond the wrong-spindle null. k is adopted only where it scores higher by more than the binomial noise of the two (ValidationEvidencePrefers - the test the beam-centre arms already used, now one function); the run then integrates and post-refines at k (post-refine-only probe), fits again on top of it and repeats until the next k no longer scores better (WalkRotationScale). The stored angles are the first hypothesis. Measured: 1.000 25.1 %, 0.97874 58.9 %, 0.97041 90.0 %, 0.97006 90.7 % (not significant) -> 0.97041 adopted. Probes restore the experiment, the pass-2 geometry, pass-1 mosaicity and the beam-centre-search flag; a probe opens no beam-centre search. Forced pass-1 results get their axis scaled; the header revert drops the scale. GONIOMETER_ROTATION_SCALE reports the adopted k (SUSPECT = adopted). The leave-a-fifth-out figure stays in the log only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D1G8gJVAy6gp1K5Dz3NE5C
This commit is contained in:
1 parent
9b6736dbda
commit
032bf9fe2b
7 files changed
+316
-98
No files matched your search
@@ -1080,50 +1080,19 @@ PostRefineResult PostRefineRotationGeometry(PostRefineObservations observations,
|
||||
const double k_fit = solve_scale(-1);
|
||||
result.rotation_scale = k_fit;
|
||||
|
||||
// ----- Whether to COMMIT it. A stage fault is rare - 36 of 37 rotation datasets sit at 1.0000
|
||||
// on a direct scan - and a 1 % angle correction applied to a healthy dataset would damage it
|
||||
// silently, so every test below has to pass.
|
||||
// Preconditions: below these the fit is reported but never acted on. Under ~30 deg of sweep k
|
||||
// entangles with the axis direction and 10-20 deg truncations of a perfect dataset wander by
|
||||
// +-0.6 %; a screening wedge must not trigger a correction.
|
||||
constexpr int MIN_SCALE_EVENTS = 5000;
|
||||
constexpr double MIN_SCALE_SWEEP_DEG = 30.0;
|
||||
// T1 significance: 0.5 % is 18 sigma on the between-dataset scatter of healthy stages
|
||||
// (robust sd 2.8e-4) and still 3.5x below the one measured fault.
|
||||
constexpr double ROTATION_SCALE_TOL = 0.005;
|
||||
// T2 relevance: the misorientation the error produces at each end of the sweep. A large k over
|
||||
// a short sweep moves nothing and is not worth correcting.
|
||||
constexpr double MIN_SCALE_END_ERROR_DEG = 0.5;
|
||||
// T3 uniformity: a stage error is a ramp present in EVERY part of the sweep, so dropping any
|
||||
// fifth of it must leave the same k. A second lattice that dominates ONE END of the sweep -
|
||||
// exactly what happens where the primary stops indexing - fakes a k indistinguishable from a
|
||||
// real fault on T1 and T2, and is the reason this test is not optional. It replaces the
|
||||
// hkl-hash split used elsewhere here, which cannot see it: both halves of that split sit at
|
||||
// the same angles, so anything structured in phi survives in both folds.
|
||||
constexpr double MIN_SCALE_JACKKNIFE_FRAC = 0.5;
|
||||
const double end_error_deg = std::fabs(k_fit - 1.0) * sweep_deg / 2.0;
|
||||
const bool enough_data = static_cast<int>(n_events) >= MIN_SCALE_EVENTS
|
||||
&& sweep_deg >= MIN_SCALE_SWEEP_DEG;
|
||||
const bool big_enough = enough_data && std::fabs(k_fit - 1.0) >= ROTATION_SCALE_TOL
|
||||
&& end_error_deg >= MIN_SCALE_END_ERROR_DEG;
|
||||
// Whether the same k comes back with any fifth of the sweep left out, as the smallest share
|
||||
// of the fitted excess the folds keep: a stage error is a ramp present in EVERY part of the
|
||||
// sweep. Reported, not acted on - the fit only sees the frames the angles it was measured at
|
||||
// still track, and a rate error is exactly what stops them tracking the rest, so the part
|
||||
// it sees can be too short to agree with itself. What acts on k is the caller, which walks
|
||||
// it to its fixed point and decides it on the whole sweep (rugnux WalkRotationScale).
|
||||
double jackknife = 1.0;
|
||||
if (big_enough)
|
||||
for (int f = 0; f < 5; ++f)
|
||||
jackknife = std::min(jackknife, (solve_scale(f) - 1.0) / (k_fit - 1.0));
|
||||
result.rotation_scale_suspect = big_enough && jackknife >= MIN_SCALE_JACKKNIFE_FRAC;
|
||||
for (int f = 0; f < 5; ++f)
|
||||
jackknife = std::min(jackknife, (solve_scale(f) - 1.0) / (k_fit - 1.0));
|
||||
logger.Info("Post-refine rotation SCALE: k = {:.5f} over {:.0f} deg of sweep centred on {:.1f} "
|
||||
"deg ({} events): end error {:.2f} deg, leave-a-fifth-out {:.2f} => {}",
|
||||
k_fit, sweep_deg, phi_c * 180.0 / PI, n_events, end_error_deg, jackknife,
|
||||
result.rotation_scale_suspect ? "COMMIT"
|
||||
: !enough_data ? "report only (too little sweep or too few events)"
|
||||
: "reject (kept the stored angles)");
|
||||
if (result.rotation_scale_suspect)
|
||||
logger.Warning("Goniometer rotation scale looks off by {:+.2f} % (fitted {:.5f}): the stage "
|
||||
"appears to have turned {} than the angles stored in the file, which are the "
|
||||
"COMMANDED values. This is a hardware calibration fault, not a data problem - "
|
||||
"left uncorrected it inflates mosaicity, biases the cell and loses "
|
||||
"high-resolution reflections",
|
||||
100.0 * (k_fit - 1.0), k_fit, k_fit > 1.0 ? "further" : "less far");
|
||||
"deg ({} events): end error {:.2f} deg, leave-a-fifth-out {:.2f}",
|
||||
k_fit, sweep_deg, phi_c * 180.0 / PI, n_events,
|
||||
std::fabs(k_fit - 1.0) * sweep_deg / 2.0, jackknife);
|
||||
|
||||
// Assemble the committed geometry.
|
||||
result.distance_after_mm = dist[0];
|
||||
|
||||
Reference in new issue
Block a user