rugnux: print ISa as undetermined when the error model's b is not resolved from zero
The (a, b) error-model fit already refuses to report ISa when its top intensity bin has no leverage on b. It still printed 1/b when b had leverage but came out at zero within its own error - the strongest bins scatter no more than counting statistics say (the fitted b^2 is negative and clamps to 0), or there are too few samples for the bin medians to mean anything. ISa then reports the noise in b as an I/sigma: on one low-resolution sweep consecutive merges of the same data gave ISa 0, 28, 46, 113 and 130. The standard error of b^2 is taken from the 16 bins' own scatter about the fitted line, and when b^2 is less than two standard errors above zero the merge result carries isa_resolved = false. Only what is printed follows it: the report's ISA key reads "undetermined", the summary line says so, the asymptote is not printed and the mmCIF carries "?". The fitted ISa itself is unchanged and is still what the space-group search's present-reflection cut and the refused-point-group arbitration read, so no decision moves. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3d7891c347
commit
aa87fb8bde
7 files changed
+81
-11
No files matched your search
@@ -3548,6 +3548,7 @@ RotationScaleMerge::Result RotationScaleMerge::MergeAndStats(int n_groups, bool
|
||||
const std::vector<Sample> *chi2_pool = nullptr;
|
||||
double chi2_a = 0.0, chi2_b2 = 0.0;
|
||||
bool error_model_b_unmeasured = false; // b had no leverage; ISa is not reported
|
||||
bool error_model_b_resolved = true; // b^2 stood clear of its own standard error
|
||||
std::vector<Sample> &samples = em_samples;
|
||||
samples.clear();
|
||||
constexpr int n_bins = 16;
|
||||
@@ -3659,10 +3660,29 @@ RotationScaleMerge::Result RotationScaleMerge::MergeAndStats(int n_groups, bool
|
||||
chi2_pool = ∈ chi2_a = error_model_a; chi2_b2 = 0.0;
|
||||
}
|
||||
} else if (det > 1e-10 * Ass * AII) {
|
||||
error_model_a = std::clamp((Bs * AII - BI * AsI) / det, 0.25, 100.0);
|
||||
const double b2 = std::max((Ass * BI - AsI * Bs) / det, 0.0);
|
||||
const double a_fit = (Bs * AII - BI * AsI) / det;
|
||||
const double b2_fit = (Ass * BI - AsI * Bs) / det;
|
||||
error_model_a = std::clamp(a_fit, 0.25, 100.0);
|
||||
const double b2 = std::max(b2_fit, 0.0);
|
||||
error_model_b = std::sqrt(b2);
|
||||
error_model_b_unmeasured = false;
|
||||
// Leverage is not enough: b^2 can have it and still come out at zero within its own error -
|
||||
// the strong bins scatter no more than counting says, or there are too few samples for a
|
||||
// bin median to mean anything. 1/b then reads the noise in b as an I/sigma, any value from
|
||||
// ~30 to infinity between merges of the same data. The standard error of b^2 is taken from
|
||||
// the bins' own scatter about the fitted line; the fit and the sigmas are left as they are,
|
||||
// and so is the fitted ISa every decision reads - this only decides what is printed.
|
||||
// Measured: z = 13.6 and 22 on two crystals whose b is plainly visible, 0.1-0.5 on a
|
||||
// 3000-sample low-multiplicity set and -1.2 to -6 on one whose strongest bins scatter
|
||||
// LESS than counting says (both printed ISa 96-130).
|
||||
double chi = 0.0;
|
||||
for (int bin = 0; bin < n_bins; ++bin) {
|
||||
const double d2w = std::max(bd2[bin], dev2_floor);
|
||||
const double r = bd2[bin] - a_fit * bs2[bin] - b2_fit * bI2[bin];
|
||||
chi += r * r / (d2w * d2w);
|
||||
}
|
||||
const double b2_se = std::sqrt(chi / (n_bins - 2) * Ass / det);
|
||||
error_model_b_resolved = b2_fit >= 2.0 * b2_se;
|
||||
error_model_active = true;
|
||||
chi2_pool = ∈ chi2_a = error_model_a; chi2_b2 = b2;
|
||||
}
|
||||
@@ -4069,6 +4089,7 @@ RotationScaleMerge::Result RotationScaleMerge::MergeAndStats(int n_groups, bool
|
||||
{
|
||||
const auto em = ToXdsErrorModel(error_model_a, error_model_b);
|
||||
result.isa = em.isa;
|
||||
result.isa_resolved = error_model_b_resolved;
|
||||
result.error_model_a = em.a;
|
||||
result.error_model_b = em.b;
|
||||
}
|
||||
@@ -4099,6 +4120,10 @@ RotationScaleMerge::Result RotationScaleMerge::MergeAndStats(int n_groups, bool
|
||||
"not reach far enough for a systematic error to be seen, not that there is "
|
||||
"none; a resolution range matched to the signal would measure it",
|
||||
em.a, error_model_chi2);
|
||||
else if (!error_model_b_resolved)
|
||||
logger.Info("Error model (XDS convention): a={:.3f} b={:.3e} - b is not resolved from zero "
|
||||
"(under two standard errors), so ISa is undetermined (1/b = {:.1f})",
|
||||
em.a, em.b, em.isa);
|
||||
else if (!full_stats)
|
||||
// Neither the asymptote nor the chi2 median was measured on this merge, so neither is
|
||||
// reported for it.
|
||||
|
||||
Reference in new issue
Block a user