diff --git a/rugnux/ModelValidation.cpp b/rugnux/ModelValidation.cpp index 783b19849..cd82f123f 100644 --- a/rugnux/ModelValidation.cpp +++ b/rugnux/ModelValidation.cpp @@ -883,6 +883,10 @@ ModelValidationResult ValidateAgainstModel(const std::vector & }; std::vector shell_cc(report_shell_d_min.size()); std::vector 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 shell_sum_I(report_shell_d_min.size(), 0.0); + std::vector 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 & 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 & 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 & 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: / 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 --- diff --git a/rugnux/ModelValidation.h b/rugnux/ModelValidation.h index 7fc6831a8..831578163 100644 --- a/rugnux/ModelValidation.h +++ b/rugnux/ModelValidation.h @@ -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 cc_model_shells; double cc_model_overall = NAN; diff --git a/rugnux/ResultReport.cpp b/rugnux/ResultReport.cpp index 9e9960675..d5853db24 100644 --- a/rugnux/ResultReport.cpp +++ b/rugnux/ResultReport.cpp @@ -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 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));