33 lines
1016 B
C++
33 lines
1016 B
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include "CalcISigma.h"
|
|
#include "BraggIntegrationStats.h"
|
|
|
|
void CalcISigma(DataMessage &msg) {
|
|
if (msg.reflections.empty())
|
|
return;
|
|
|
|
BraggIntegrationStats stats(50.0, 1.5, 20);
|
|
for (const auto &r: msg.reflections)
|
|
stats.AddReflection(r);
|
|
|
|
stats.BFactor(); // need to do it to generate plots...
|
|
|
|
msg.integration_Isigma = stats.GetISigmaPlot();
|
|
msg.integration_Isigma_one_over_d = stats.GetOneOverDPlot();
|
|
}
|
|
|
|
void CalcWilsonBFactor(DataMessage &msg) {
|
|
if (msg.reflections.empty())
|
|
return;
|
|
|
|
BraggIntegrationStats stats(6.0, 3.0, 10); // Wilson statistics is only linear in certain resolution range
|
|
for (const auto &r: msg.reflections)
|
|
stats.AddReflection(r);
|
|
|
|
msg.b_factor = stats.BFactor();
|
|
msg.integration_B_logI = stats.GetWilsonPlot();
|
|
msg.integration_B_one_over_d = stats.GetOneOverDPlot();
|
|
}
|