// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include "../../common/DiffractionSpot.h" void GenerateSpotPlot(DataMessage &msg, const std::vector &spots, float d_min_A); void CountSpots(DataMessage &msg, const DiffractionExperiment& experiment, const std::vector &spots, float d_min_A); void CountSpots(DataMessage &msg, const std::vector &spots, float d_min_A); float CountIceRingControlSpots(const std::vector &spots, float half_width_q_recipA); void MarkIceRings(std::vector &spots, float tolerance_q_recipA); // Keep the strongest `count` spots. With deprioritise_ice, spots on the hexagonal ice bands are ordered // last and so are the first to go; pass false where the run has no measurable ice, in which case the // flag marks ordinary reflections and ordering on it would discard good data. void FilterSpotsByCount(std::vector &input, int64_t count, bool deprioritise_ice); void FilterSpuriousHighResolutionSpots(std::vector &spots, float threshold); // How far the SCALED AND MERGED data from a run of images like this one are expected to reach, in A, // from the spots of this one image alone. Nothing else - no lattice, no integration, no merge. // // The spots' intensity-weighted resolution distribution falls off at the crystal's own rate, and a // quantile taken near the middle of that fall-off measures that rate. The far end of the distribution // does not: the highest-resolution spot found says where DETECTION stops, which moves with the // exposure and with how many reflections the unit cell puts on the frame. Merging then reaches a fixed // factor further in 1/d than the quantile, because averaging many observations goes on measuring // intensities that one image cannot detect. // // detector_d_min_A is the corner of the detector, which the answer is never allowed to beat; pass 0 to // leave it unclamped. Returns nothing when the image has too few spots to have a fall-off at all. std::optional GetResolution(const std::vector &spots, float detector_d_min_A = 0.0f); void SpotAnalyze(const DiffractionExperiment &experiment, const SpotFindingSettings &settings, const std::vector &spots, DataMessage &message);