rugnux: the model table reports the radial disagreement it alone can see
A scale factor shared by every symmetry equivalent of a reflection cancels out of R_meas, CC1/2, chi^2 and every cross-validation the scaling runs, because each ASU group's reference is its own mean. Nothing in the report could see one, and a wrong radial profile therefore went unnoticed while every internal statistic improved. The CC(model, data) table gains an I/I_MODEL column: the shell's mean merged intensity over the mean |F_model|^2 of the scaled model, after the model has already been given its own overall scale, anisotropic B and bulk solvent. That family is smooth and nearly exponential in s^2, so what is left is the part of the run's resolution dependence the model does not agree with. It reads 1.000 where the two agree and drifts away from it where they do not. A headline line reports the outermost shell's value. It cannot say which of the two is right - a real crystal can out-diffract or under-diffract its deposited model - only that they disagree, which is the one thing nothing else here reports. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nW6FNRP1bBJJ8pfHiByAT
This commit is contained in:
1 parent
66373edc1b
commit
2d5579e593
3 files changed
+41
-7
No files matched your search
@@ -883,6 +883,10 @@ ModelValidationResult ValidateAgainstModel(const std::vector<MergedReflection> &
|
||||
};
|
||||
std::vector<CorrelationCoefficient> shell_cc(report_shell_d_min.size());
|
||||
std::vector<int> shell_n(report_shell_d_min.size(), 0);
|
||||
// Sums for the radial mismatch: the shell's mean observed intensity against the mean
|
||||
// intensity of the already-scaled model. See ModelDataCCShell::i_over_model.
|
||||
std::vector<double> shell_sum_I(report_shell_d_min.size(), 0.0);
|
||||
std::vector<double> shell_sum_Im(report_shell_d_min.size(), 0.0);
|
||||
CorrelationCoefficient overall_cc;
|
||||
int overall_n = 0;
|
||||
for (const auto &hv : fmodel.v) {
|
||||
@@ -894,6 +898,8 @@ ModelValidationResult ValidateAgainstModel(const std::vector<MergedReflection> &
|
||||
continue;
|
||||
const double Ic = std::norm(hv.value); // |F_model|^2
|
||||
shell_cc[bin].Add(it->second.I, Ic);
|
||||
shell_sum_I[bin] += it->second.I;
|
||||
shell_sum_Im[bin] += Ic;
|
||||
++shell_n[bin];
|
||||
overall_cc.Add(it->second.I, Ic);
|
||||
++overall_n;
|
||||
@@ -907,7 +913,8 @@ ModelValidationResult ValidateAgainstModel(const std::vector<MergedReflection> &
|
||||
for (size_t i = 0; i < report_shell_d_min.size(); i++) {
|
||||
const double cc = shell_cc[i].GetCC();
|
||||
result.cc_model_shells.push_back({report_shell_d_min[i], cc, shell_n[i],
|
||||
fisher_sigma(cc, shell_n[i])});
|
||||
fisher_sigma(cc, shell_n[i]),
|
||||
shell_sum_Im[i] > 0.0 ? shell_sum_I[i] / shell_sum_Im[i] : NAN});
|
||||
}
|
||||
result.cc_model_overall = overall_cc.GetCC();
|
||||
result.cc_model_n = overall_n;
|
||||
@@ -916,6 +923,14 @@ ModelValidationResult ValidateAgainstModel(const std::vector<MergedReflection> &
|
||||
result.cc_model_overall, result.cc_model_n,
|
||||
result.cc_model_shells.back().d_min, result.cc_model_shells.back().cc,
|
||||
result.cc_model_shells.back().n, result.cc_model_shells.back().sigma);
|
||||
// The radial mismatch, reported on its own because nothing else in the run can see it.
|
||||
const double r_out = result.cc_model_shells.back().i_over_model;
|
||||
if (std::isfinite(r_out))
|
||||
logger.Info("Model validation: <I>/<I_model> after the model's own scale, anisotropic B and "
|
||||
"bulk solvent runs to {:.2f} in the outermost shell ({:.2f} A) - the part of "
|
||||
"this run's resolution dependence the model does not agree with, and the only "
|
||||
"check on it that is not blind to a factor shared by a whole ASU group",
|
||||
r_out, result.cc_model_shells.back().d_min);
|
||||
}
|
||||
|
||||
// --- sigma_A weighting: the maps are 2mFo-DFc and mFo-DFc, not 2Fo-Fc and Fo-Fc ---
|
||||
|
||||
@@ -72,6 +72,17 @@ struct ModelValidationResult {
|
||||
// are not bivariate normal, so this is the same approximation XDS makes when it calls a shell's
|
||||
// CC1/2 significant, and it is a guide to the strength of the claim rather than an exact p.
|
||||
double sigma = NAN;
|
||||
// The shell's mean merged intensity over the mean |F_model|^2 of the SCALED model - the model
|
||||
// having already been given an overall scale, an anisotropic B and a bulk solvent fitted over
|
||||
// the whole range. That family is smooth and nearly exponential in s^2, so it can follow a
|
||||
// wrong RADIAL profile only so far; what is left here is the part of the run's resolution
|
||||
// dependence the model does not agree with, and it is the only number in the report that can
|
||||
// see it. Every internal statistic - R_meas, CC1/2, chi^2, the correction surfaces' own
|
||||
// cross-validation - is blind to a factor that multiplies a whole ASU group, because each
|
||||
// group's reference is its own mean. 1.0 across the table means the two agree; a monotone
|
||||
// run away from 1.0 means one of the two radial profiles is wrong. It cannot say which: a
|
||||
// real crystal can out-diffract or under-diffract its deposited model.
|
||||
double i_over_model = NAN;
|
||||
};
|
||||
std::vector<ModelDataCCShell> cc_model_shells;
|
||||
double cc_model_overall = NAN;
|
||||
|
||||
+14
-6
@@ -1709,23 +1709,31 @@ ReportDocument BuildReportDocument(const std::string &output_prefix,
|
||||
Add(s, Prose(" CC(model, data): the correlation of the merged intensities with the placed, scaled\n"
|
||||
" model's |F_model|^2, on the same shells the merge table above reports, so a row here\n"
|
||||
" can be read straight across from that shell's CC1/2. SIGMA is how far the correlation\n"
|
||||
" sits above zero (Fisher's transform on N reflections).\n"));
|
||||
" sits above zero (Fisher's transform on N reflections). I/I_MODEL is the shell's\n"
|
||||
" mean merged intensity over the model's, AFTER the model has been given its own\n"
|
||||
" overall scale, anisotropic B and bulk solvent - so it reads 1.000 where the two\n"
|
||||
" agree on how the data fall off with resolution, and drifts away from 1.000 where\n"
|
||||
" they do not. It is the only number here that can see a scale shared by a whole\n"
|
||||
" set of symmetry equivalents; R_meas, CC1/2 and chi^2 all cancel one.\n"));
|
||||
ReportEntry e;
|
||||
e.kind = ReportEntry::Kind::Table;
|
||||
e.table.columns = {"D_MIN", "CC_MODEL", "N", "SIGMA"};
|
||||
e.table.text_header = " D_MIN CC_MODEL N SIGMA\n"
|
||||
" -------- -------- --------- --------";
|
||||
e.table.columns = {"D_MIN", "CC_MODEL", "N", "SIGMA", "I_OVER_MODEL"};
|
||||
e.table.text_header = " D_MIN CC_MODEL N SIGMA I/I_MODEL\n"
|
||||
" -------- -------- --------- -------- ---------";
|
||||
for (const auto &sh : mv.cc_model_shells) {
|
||||
if (sh.n == 0)
|
||||
continue;
|
||||
e.table.text_rows.push_back(fmt::format(
|
||||
" {:8.2f} {:8.4f} {:9d} {:>8s}", sh.d_min, sh.cc, sh.n,
|
||||
std::isfinite(sh.sigma) ? fmt::format("{:+.1f}", sh.sigma) : std::string("-")));
|
||||
" {:8.2f} {:8.4f} {:9d} {:>8s} {:>9s}", sh.d_min, sh.cc, sh.n,
|
||||
std::isfinite(sh.sigma) ? fmt::format("{:+.1f}", sh.sigma) : std::string("-"),
|
||||
std::isfinite(sh.i_over_model) ? fmt::format("{:.3f}", sh.i_over_model)
|
||||
: std::string("-")));
|
||||
std::vector<ReportValue> row;
|
||||
row.push_back(KeyReal("", sh.d_min, "{:.2f}").value);
|
||||
row.push_back(KeyReal("", sh.cc, "{:.4f}").value);
|
||||
row.push_back(KeyInt("", sh.n).value);
|
||||
row.push_back(KeyReal("", sh.sigma, "{:+.1f}").value);
|
||||
row.push_back(KeyReal("", sh.i_over_model, "{:.3f}").value);
|
||||
e.table.cells.push_back(std::move(row));
|
||||
}
|
||||
Add(s, std::move(e));
|
||||
|
||||
Reference in new issue
Block a user