AnalyzeIndexing: Fix mosaicity calculation

This commit is contained in:
2026-01-30 15:03:21 +01:00
parent b338f8ea99
commit e0355f356f
+3 -12
View File
@@ -125,8 +125,6 @@ namespace {
const Coord w = axis->GetAxis().Normalize();
const Coord S0 = experiment.GetScatteringVector();
const float wedge_deg = axis->GetWedge_deg();
const float start_deg = axis->GetStart_deg();
const float inc_deg = axis->GetIncrement_deg();
double sum_sq = 0.0;
int count = 0;
@@ -135,21 +133,14 @@ namespace {
if (!s.indexed)
continue;
// Observed angle: use frame center
const float image_center = static_cast<float>(s.image) + 0.5f;
const float phi_obs_deg = start_deg + inc_deg * image_center;
// g0 at phi=0 assumption
const Coord g0 = astar * static_cast<float>(s.h)
+ bstar * static_cast<float>(s.k)
+ cstar * static_cast<float>(s.l);
const Coord pstar = astar * static_cast<float>(s.h) + bstar * static_cast<float>(s.k) + cstar * static_cast<float>(s.l);
// Local solve window: +/- 1 wedge (easy/robust first try)
const auto phi_pred_deg_opt = predict_phi_deg_local(g0, S0, w, phi_obs_deg, wedge_deg);
const auto phi_pred_deg_opt = predict_phi_deg_local(pstar, S0, w, 0.0, wedge_deg);
if (!phi_pred_deg_opt.has_value())
continue;
float dphi = wrap_deg_pm180(phi_obs_deg - phi_pred_deg_opt.value());
float dphi = wrap_deg_pm180(phi_pred_deg_opt.value());
sum_sq += static_cast<double>(dphi) * static_cast<double>(dphi);
count++;
}