rugnux: per-batch relative-B correction + radiation-damage B monitor

Rotation scaling modelled dose-dependent scattering power with a single
global relative-B decay slope only (RefineDecay); per-frame refinement was
scale-only. Add a per-batch relative Debye-Waller B, both as an opt-in
correction and as an always-on measurement.

- FitRelativeBCurve / SolveCurvatureSmoothedB: per rotation-range batch, fit
  the s^2 slope of ln(Iref/Iobs) that the resolution-flat per-frame G leaves,
  regularised by a second-difference (curvature) penalty so a genuine smooth
  relative-B is kept while resolution-correlated noise (which an unconstrained
  per-batch fit would chase into an oscillating curve) is suppressed.

- Correction (--relative-b[=deg], default off): applied after RefineDecay,
  gated by a physical peak-to-peak floor and cross-validated by ASU-group
  parity (a per-batch parameter owns whole frames, so it is scored on held-out
  equivalents, not held-out frames). On a battery re-scaling identical stored
  reflections it is a no-op on well-behaved data and a small gain on
  radiation-damaged rotation data; never a regression.

- Radiation-damage monitor (always on for rotation, report-only): measure the
  relative-B change from the pristine low-dose start of the run to its end
  (a whole-run-mean reference inverts on damaged data) plus the per-batch
  curve, and report them on the command line (in the radiation-damage report
  and the merge statistics) and in the mmCIF (_reflns.jfjoch_radiation_damage_
  relative_B and a per-batch loop). A large magnitude flags radiation damage,
  complementing the existing per-image CC / mosaicity read.

- --scale now reproduces the de-novo rotation merge (it previously omitted
  scale-fulls and smooth-G, silently using a weaker model), and honours
  --relative-b, so an offline re-scale matches the full pipeline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-18 22:08:09 +02:00
co-authored by Claude Opus 4.8
parent e97a610091
commit c5cfdcef7e
9 changed files with 361 additions and 1 deletions
+4
View File
@@ -923,6 +923,10 @@ std::ostream &operator<<(std::ostream &output, const MergeStatistics &in) {
if (std::isfinite(in.wilson_b) && in.wilson_b > 0.0)
output << fmt::format(" Wilson B-factor estimate: {:.2f} A^2 (correlation {:.3f})",
in.wilson_b, in.wilson_b_correlation) << std::endl;
if (std::isfinite(in.radiation_damage_delta_b))
output << fmt::format(" Radiation damage: relative B-factor change over run = {:+.2f} A^2 "
"(first->last, {} batches)",
in.radiation_damage_delta_b, in.radiation_damage_b_batch.size()) << std::endl;
output << std::endl;
return output;
}