// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include #include "../../common/JFJochMessages.h" #include "../../common/Reflection.h" void CalcISigma(DataMessage &msg); void CalcWilsonBFactor(DataMessage &msg, bool replace_b = true); void CalcISigma(DataMessage &msg, const std::vector &reflections); void CalcWilsonBFactor(DataMessage &msg, const std::vector &reflections, bool replace_b = true); // Dataset-wide isotropic Wilson B-factor estimate from a log-linear fit of the shell-averaged merged // intensity against 1/d^2 (B = -2*slope). Robust because it averages over the whole dataset - the // per-image CalcWilsonBFactor above is a per-frame estimate and much noisier. Diagnostic only (like // XDS's "WILSON LINE ... B="), not used in scaling. Returns b = NaN when it cannot be determined. struct GlobalWilsonB { double b = std::numeric_limits::quiet_NaN(); // Wilson B-factor estimate (A^2) double correlation = std::numeric_limits::quiet_NaN(); // |correlation| of the log-linear fit int n_shells = 0; // resolution shells actually used }; GlobalWilsonB CalcGlobalWilsonB(const std::vector &merged);