// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #include "SpotAnalysis.h" void CountSpots(DataMessage &msg, const DiffractionExperiment& experiment, const std::vector &spots, float d_min_A) { int64_t low_res = 0; int64_t ice_ring = 0; auto geom = experiment.GetDiffractionGeometry(); for (auto &s: spots) { double d = s.GetResolution(geom); // Ice ring resolution taken from: // Moreau, Atakisi, Thorne, Acta Cryst D77, 2021, 540,554 // https://journals.iucr.org/d/issues/2021/04/00/tz5104/index.html double tol = 0.05; if (fabs(d - 3.895) < tol || fabs(d - 3.661) < tol || fabs(d - 3.438) < tol || fabs(d - 2.667) < tol || fabs(d - 2.249) < tol || fabs(d - 2.068) < tol) { ice_ring++; } if (d > d_min_A) low_res++; } msg.spot_count = spots.size(); msg.spot_count_low_res = low_res; msg.spot_count_ice_rings = ice_ring; }