GivenCellPopulation: the population nearest the given cell among those holding a real share of the frames

The peak nearest the given cell could be a single stray frame when the given cell is a few percent off
the crystal (a cryo cell given for room-temperature lysozyme stills): the run then merged one frame.
Every population is now found from its own peak and valleys, and of those holding at least a tenth of
the frames the one centred nearest the given cell is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-10-20 18:39:41 +02:00
1 parent 380cdf3dc7
commit 990bbaf9a7
2 files changed
+47 -13

No files matched your search

+15
View File
@@ -43,6 +43,21 @@ TEST_CASE("CellPopulation_SecondFormLeftOut", "[CellPopulation][portable]") {
CHECK(kept(r2, 0, 450) < 5);
}
TEST_CASE("CellPopulation_GivenCellOffTheCrystal", "[CellPopulation][portable]") {
// A given cell 3.5% smaller than the crystal's, and a single stray frame right at it: the crystal's
// population is kept, not the stray frame.
std::mt19937 rng(3);
std::normal_distribution<double> d(0.035, 0.003);
std::vector<double> r(2000);
for (auto &x : r) x = d(rng);
r.push_back(0.0);
const auto [low, high] = GivenCellPopulation(r);
size_t kept = 0;
for (double x : r)
kept += (x >= low && x <= high);
CHECK(kept >= 2000);
}
TEST_CASE("CellPopulation_TooFewFrames", "[CellPopulation][portable]") {
const auto [low, high] = GivenCellPopulation({0.0, 0.1, 0.2});
CHECK(std::isinf(low));