IndexAndRefine: Stabilize profile radius and mosaicity, by using moving average

This commit is contained in:
2026-01-20 11:20:35 +01:00
parent 0b9463cb0d
commit 9c5a3f5c12
5 changed files with 73 additions and 13 deletions

View File

@@ -20,8 +20,6 @@ IndexAndRefine::IndexAndRefine(const DiffractionExperiment &x, IndexerThreadPool
rotation_indexer = std::make_unique<RotationIndexer>(x, *indexer);
}
#include <iostream>
IndexAndRefine::IndexingOutcome IndexAndRefine::DetermineLatticeAndSymmetry(DataMessage &msg) {
IndexingOutcome outcome(experiment);
@@ -131,13 +129,32 @@ void IndexAndRefine::QuickPredictAndIntegrate(DataMessage &msg,
if (!outcome.lattice_candidate)
return;
float ewald_dist_cutoff = 0.001f;
CrystalLattice latt = outcome.lattice_candidate.value();
if (rotation_indexer) {
// Rotate lattice_candidate to the current image angle
auto gon = experiment.GetGoniometer();
if (gon)
latt = outcome.lattice_candidate->Multiply(gon->GetTransformation(-msg.number));
// Use moving average for mosaicity and profile_radius (also add beam center later)
if (msg.mosaicity_deg)
msg.mosaicity_deg = rotation_parameters.Mosaicity(msg.mosaicity_deg.value());
if (msg.profile_radius) {
msg.profile_radius = rotation_parameters.ProfileRadius(msg.profile_radius.value());
}
}
float ewald_dist_cutoff = 0.001f;
if (msg.profile_radius)
ewald_dist_cutoff = msg.profile_radius.value() * 2.0f;
if (experiment.GetBraggIntegrationSettings().GetFixedProfileRadius_recipA())
ewald_dist_cutoff = experiment.GetBraggIntegrationSettings().GetFixedProfileRadius_recipA().value() * 3.0f;
BraggPredictionSettings settings_prediction{
.high_res_A = experiment.GetBraggIntegrationSettings().GetDMinLimit_A(),
.ewald_dist_cutoff = ewald_dist_cutoff,
@@ -146,15 +163,6 @@ void IndexAndRefine::QuickPredictAndIntegrate(DataMessage &msg,
.image_number = static_cast<int>(msg.number)
};
CrystalLattice latt = outcome.lattice_candidate.value();
if (rotation_indexer) {
// Rotate lattice_candidate to the current image angle
auto gon = experiment.GetGoniometer();
if (gon)
latt = outcome.lattice_candidate->Multiply(gon->GetTransformation(-msg.number));
}
auto nrefl = prediction.Calc(outcome.experiment, latt, settings_prediction);
auto refl_ret = BraggIntegrate2D(outcome.experiment, image, prediction.GetReflections(), nrefl, msg.number);