IndexAndRefine: Fix using lattice at zero deg for refinement

This commit is contained in:
2026-01-20 13:28:42 +01:00
parent 3e721dc476
commit 7da28b5c9a
4 changed files with 9 additions and 17 deletions

View File

@@ -26,7 +26,11 @@ IndexAndRefine::IndexingOutcome IndexAndRefine::DetermineLatticeAndSymmetry(Data
if (rotation_indexer) {
auto result = rotation_indexer->ProcessImage(msg.number, msg.spots);
if (result) {
outcome.lattice_candidate = result->lattice;
// get rotated lattice
auto gon = experiment.GetGoniometer();
if (gon)
outcome.lattice_candidate = result->lattice.Multiply(gon->GetTransformation(-msg.number));
outcome.experiment.BeamX_pxl(result->geom.GetBeamX_pxl())
.BeamY_pxl(result->geom.GetBeamY_pxl())
@@ -132,10 +136,6 @@ void IndexAndRefine::QuickPredictAndIntegrate(DataMessage &msg,
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());
@@ -201,8 +201,7 @@ void IndexAndRefine::ProcessImage(DataMessage &msg,
if (!outcome.lattice_candidate)
return;
if (!AnalyzeIndexing(msg, outcome.experiment, *outcome.lattice_candidate,
outcome.experiment.GetGoniometer(), rotation_indexer.get() != nullptr))
if (!AnalyzeIndexing(msg, outcome.experiment, *outcome.lattice_candidate))
return;
msg.lattice_type = outcome.symmetry;

View File

@@ -133,7 +133,6 @@ std::optional<RotationIndexerResult> RotationIndexer::ProcessImage(int64_t image
.search_result = search_result_,
.geom = updated_geom_
};
return GetLattice();
}
std::optional<RotationIndexerResult> RotationIndexer::GetLattice() {

View File

@@ -165,9 +165,7 @@ namespace {
bool AnalyzeIndexing(DataMessage &message,
const DiffractionExperiment &experiment,
const CrystalLattice &latt,
const std::optional<GoniometerAxis> &rotation_axis,
bool rotation_indexed) {
const CrystalLattice &latt) {
std::vector<uint8_t> indexed_spots(message.spots.size());
// Check spots
@@ -218,9 +216,7 @@ bool AnalyzeIndexing(DataMessage &message,
nspots_ref++;
}
if (rotation_indexed
|| (nspots_indexed >= viable_cell_min_spots
&& nspots_indexed >= std::lround(min_percentage_spots * nspots_ref))) {
if (nspots_indexed >= viable_cell_min_spots && nspots_indexed >= std::lround(min_percentage_spots * nspots_ref)) {
auto uc = latt.GetUnitCell();
if (!ok(uc.a) || !ok(uc.b) || !ok(uc.c) || !ok(uc.alpha) || !ok(uc.beta) || !ok(uc.gamma))
return false;

View File

@@ -12,9 +12,7 @@ constexpr static float min_percentage_spots = 0.20f;
bool AnalyzeIndexing(DataMessage &message,
const DiffractionExperiment &experiment,
const CrystalLattice &latt,
const std::optional<GoniometerAxis> &rotation_axis,
bool rotation_indexed);
const CrystalLattice &latt);
#endif //JFJOCH_ANALYZEINDEXING_H