Tests: the stills rocking width - the window at a reflection's resolution, _process.h5 round trip
StillsPartialityRefine_MeasureRunWidth_WindowAtReflectionResolution, JFJochReader_StillsRunWidth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu (cherry picked from commit dafb8d1bf996d1000741eecf019aee780dd91ebe)
This commit is contained in:
1 parent
8a123e794d
commit
e6b550fe42
2 files changed
+97
No files matched your search
@@ -1078,6 +1078,48 @@ TEST_CASE("StillsPartialityRefine_MeasureRunWidth_WideWindowFramesIgnored") {
|
||||
CHECK(width->gamma_e == Catch::Approx(GAMMA_E).epsilon(0.15));
|
||||
}
|
||||
|
||||
// Frames predicted through the run's width (2 sigma(d*) of its formula) have a window at every reflection's
|
||||
// own resolution; measured with that window, the table gives the width back at each shell.
|
||||
TEST_CASE("StillsPartialityRefine_MeasureRunWidth_WindowAtReflectionResolution") {
|
||||
constexpr double GAMMA0 = 1.0e-4, GAMMA_E = 0.035 * M_PI / 180.0;
|
||||
DiffractionExperiment x;
|
||||
x.SetSpaceGroup(gemmi::get_spacegroup_by_name("P 1"));
|
||||
const StillsPartialityRefine::RunWidth window{.gamma0 = GAMMA0, .gamma_e = GAMMA_E};
|
||||
auto sigma = [&](double dstar) { return std::sqrt(GAMMA0 * GAMMA0 + GAMMA_E * GAMMA_E * dstar * dstar); };
|
||||
|
||||
std::mt19937 rng(11);
|
||||
std::uniform_real_distribution<double> unit(0.0, 1.0);
|
||||
std::exponential_distribution<double> wilson(1.0);
|
||||
std::normal_distribution<double> gauss(0.0, 1.0);
|
||||
std::vector<IntegrationOutcome> outcomes(400);
|
||||
for (auto &o: outcomes) {
|
||||
o.image_scale_g = 0.5 + unit(rng);
|
||||
for (int j = 0; j < 200; ++j) {
|
||||
const double d = 1.5 + 8.0 * unit(rng);
|
||||
const double s = sigma(1.0 / d);
|
||||
const double de = 2.0 * s * (2.0 * unit(rng) - 1.0);
|
||||
Reflection r{};
|
||||
r.h = j; r.k = 1; r.l = 1;
|
||||
r.d = static_cast<float>(d);
|
||||
r.dist_ewald = static_cast<float>(std::fabs(de));
|
||||
r.I = static_cast<float>(*o.image_scale_g * 1000.0 * wilson(rng) * std::exp(-0.5 * de * de / (s * s))
|
||||
+ 5.0 * gauss(rng));
|
||||
r.sigma = 5.0f;
|
||||
r.prescaling_corr = 1.0f;
|
||||
r.partiality = 1.0f;
|
||||
r.image_scale_corr = static_cast<float>(1.0 / *o.image_scale_g);
|
||||
o.reflections.push_back(r);
|
||||
}
|
||||
}
|
||||
const auto width = StillsPartialityRefine(x).MeasureRunWidth(outcomes, std::nullopt, 1.0, &window);
|
||||
REQUIRE(width.has_value());
|
||||
REQUIRE(width->table_s.size() >= 3);
|
||||
for (size_t i = 0; i < width->table_s.size(); ++i) {
|
||||
INFO("d* = " << width->table_dstar[i]);
|
||||
CHECK(width->table_s[i] == Catch::Approx(sigma(width->table_dstar[i])).epsilon(0.15));
|
||||
}
|
||||
}
|
||||
|
||||
// Outlier rejection on the stills merge: one observation at ten times its reflection's intensity among
|
||||
// nineteen consistent ones is dropped, and nothing else is.
|
||||
TEST_CASE("MergeOnTheFly_RejectsAnOutlierInTheBand") {
|
||||
|
||||
Reference in new issue
Block a user