// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include #include "../common/DiffractionGeometry.h" #include "../common/UnitCell.h" #include "../image_analysis/geom_refinement/GeometryRefiner.h" // Tests of whether a module placement is the detector's metrology or something else absorbed module by // module (--refine-modules=diagnose): the placement against the modules' radius and resolution, its global // patterns, frame-bootstrap errors, fits on low- and high-resolution spots apart, a perturbed start, inner // against outer modules, a placement of synthetic spots with no module error (and with parallax added), // the cell set free and the tilt refined. Everything goes to the log, one line per number, under the // "ModuleDiag" tag, for a script to tabulate. struct ModuleDiagnosticsInput { DiffractionGeometry nominal; UnitCell cell; std::vector frames; // the placement's frames, each spot's module assigned std::vector centres; // the modules, unmoved std::vector start; // where the placement started (after the coarse search) GeometryRefinerSettings settings; // as the placement ran GeometryRefinerResult placed; // the placement std::string sensor_material; double sensor_thickness_um = 0; }; void RunModuleDiagnostics(const ModuleDiagnosticsInput &in);