v1.0.0-rc.179 (#90)
Build Packages / Create release (push) Successful in 8s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m11s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 10m32s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 18m26s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 22m11s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 23m32s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 25m36s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 27m28s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 28m10s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 28m10s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 29m24s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 21m45s
Build Packages / Generate python client (push) Successful in 31s
Build Packages / Build documentation (push) Successful in 1m21s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 24m2s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 29m25s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 30m27s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 27m12s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 32m20s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 33m36s
Build Packages / Unit tests (push) Successful in 2h7m18s
Build Packages / Validation Battery (push) Successful in 33m19s

* Rugnux: Stills processing needs only the unit cell and space group beyond what the file records - detector distance, beam centre, tilt, panel placement, saturation level, gain and polarisation plane are found from the images - and is up to twice as fast.
* Rugnux: Stills can be indexed without a GPU, with a CPU implementation of the fast-feedback indexer (macOS, computers without a GPU).
* Rugnux: Rotation and stills data are integrated in the detector's own units with one gain model, improving data from CCD detectors.
* Web frontend: The Rugnux live page shows the placed model with its electron density and anomalous difference map in a Mol* viewer.

Reviewed-on: #90
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
This commit was merged in pull request #90.
This commit is contained in:
leonarski_f authored and leonarski_f committed 2026-10-24 14:52:29 +02:00
1 parent afbe844b20
commit b00c668e3a
394 files changed
+57778 -2178

No files matched your search

+115 -1
View File
@@ -720,6 +720,7 @@ TEST_CASE("StillsPartialityRefine_RecoversTheTilt") {
Reflection r{};
r.h = h; r.k = k; r.l = l;
r.d = 1.0f / dstar;
r.dist_ewald = std::fabs((q + S0).Length() - 1.0f / WAVELENGTH);
r.I = static_cast<float>(G * p_true * full_I(h, k, l));
r.sigma = static_cast<float>(1.0 + 0.01 * r.I);
r.prescaling_corr = 1.0f;
@@ -745,7 +746,7 @@ TEST_CASE("StillsPartialityRefine_RecoversTheTilt") {
const double after = mean_abs_error();
CHECK(mean_tilt > 0.015);
CHECK(mean_tilt < 0.06);
CHECK(after < 0.6 * before); // measured 0.54: the prior holds the larger tilts back
CHECK(after < 0.6 * before); // measured 0.41 (0.54 with the per-crystal window width): the prior holds the larger tilts back
}
namespace {
@@ -914,3 +915,116 @@ TEST_CASE("MergeOnTheFly_RsplitKeepsEveryFrameWhole") {
CHECK(sh.r_split == Catch::Approx(expected).epsilon(1e-5));
CHECK_FALSE(SerialShellTable(stats).empty());
}
// The run's rocking width is measured on the crystals, not on the prediction window: reflections spread
// evenly across a window four times wider than the curve, each recording I_full * p(de), give back the
// curve's gamma0 and angular width, while the plain moment of de would return the window's.
TEST_CASE("StillsPartialityRefine_MeasureRunWidth") {
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"));
std::mt19937 rng(5);
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(200);
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 dstar = 1.0 / d;
const double s = std::sqrt(GAMMA0 * GAMMA0 + GAMMA_E * GAMMA_E * dstar * dstar);
const double window = 4.0 * std::sqrt(GAMMA0 * GAMMA0 + GAMMA_E * GAMMA_E / (1.5 * 1.5));
const double de = window * (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);
REQUIRE(width.has_value());
CHECK(width->gamma0 == Catch::Approx(GAMMA0).epsilon(0.3));
CHECK(width->gamma_e == Catch::Approx(GAMMA_E).epsilon(0.1));
CHECK(width->bandwidth_sigma < 1e-3);
}
// 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") {
DiffractionExperiment x;
x.SetSpaceGroup(gemmi::get_spacegroup_by_name("P 1"));
ScalingSettings s = x.GetScalingSettings();
s.OutlierRejectNsigma(6.0);
x.ImportScalingSettings(s);
std::mt19937 rng(3);
std::normal_distribution<float> gauss(0.0f, 1.0f);
std::vector<IntegrationOutcome> outcomes(20);
for (size_t i = 0; i < outcomes.size(); ++i) {
for (int h = 1; h <= 50; ++h) {
Reflection r{};
r.h = h; r.k = 2; r.l = 3;
r.d = 2.0f;
const float I_true = 100.0f * static_cast<float>(h);
r.I = I_true * (1.0f + 0.1f * gauss(rng)) + 3.0f * gauss(rng);
if (i == 7 && h == 25)
r.I = 10.0f * I_true;
r.sigma = 3.0f;
r.prescaling_corr = 1.0f;
r.partiality = 1.0f;
r.image_scale_corr = 1.0f;
outcomes[i].reflections.push_back(r);
}
}
MergeOnTheFly merge(x);
merge.RefineErrorModel(outcomes);
REQUIRE(merge.ErrorModelActive());
merge.AddImages(outcomes);
CHECK(merge.RejectedCount() == 1);
}
// The capture term widens the sigma of a partial by (c (1 - p) <I>): a partial merges at a lower weight
// than a full of the same intensity, and not at all differently with c = 0.
TEST_CASE("MergeOnTheFly_CaptureTermDownweightsPartials") {
auto merged_I = [](double c) {
DiffractionExperiment x;
x.SetSpaceGroup(gemmi::get_spacegroup_by_name("P 1"));
ScalingSettings s = x.GetScalingSettings();
s.CaptureUncertaintyCoeff(c);
x.ImportScalingSettings(s);
std::mt19937 rng(9);
std::normal_distribution<float> gauss(0.0f, 1.0f);
std::vector<IntegrationOutcome> outcomes(40);
for (size_t i = 0; i < outcomes.size(); ++i)
for (int h = 1; h <= 40; ++h) {
Reflection r{};
r.h = h; r.k = 1; r.l = 1;
r.d = 2.0f;
// Every other image records the reflection as a 30 % partial that reads 20 % high.
const bool partial = i % 2 == 1;
r.partiality = partial ? 0.3f : 1.0f;
r.image_scale_corr = 1.0f / r.partiality;
r.I = r.partiality * 100.0f * static_cast<float>(h) * (partial ? 1.2f : 1.0f) * (1.0f + 0.05f * gauss(rng));
r.sigma = 2.0f;
r.prescaling_corr = 1.0f;
outcomes[i].reflections.push_back(r);
}
MergeOnTheFly merge(x);
merge.RefineErrorModel(outcomes);
merge.AddImages(outcomes);
const auto m = merge.ExportReflections();
return m.at(10).I / (100.0f * static_cast<float>(m.at(10).h));
};
const float without = merged_I(0.0), with = merged_I(1.0);
CHECK(with < without);
CHECK(with < 1.08f);
}