// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include // Serial stills given a cell: which frames belong to that crystal. A sample can hold two crystal forms // (a polymorph, a different hydration state), and a known-cell indexer fits both to the given cell's // orientation search - the refined cells then fall into two volume populations, and merging both mixes // two structures. The frames kept are the population the given cell sits in: the peak of the histogram // of v / v_given - 1 nearest to 0, out to the valley on either side that separates it from another // population. The histogram bin follows the spread of the data, so neither the // width of a population nor its distance to the next is a fixed number. A run with one population has // no such valley and keeps every frame. // // relative_volume: v / v_given - 1 per indexed frame. Returns the [low, high] range of it to keep. std::pair GivenCellPopulation(const std::vector &relative_volume);