From 17471dc1c38f77d9c5930d0cbe15e4bc8e12d16c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 21 Jun 2024 11:00:34 +0200 Subject: Defer writing Mille data until crystal is accepted Previously, the Mille data was written before the final checks of the indexing solution (e.g. the peak alignment check). This added junk data to the Mille files. Fixes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/99 --- libcrystfel/src/index.c | 7 +++++++ libcrystfel/src/predict-refine.c | 15 ++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index 12cd9190..5b0f742f 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -50,6 +50,7 @@ #include "cell-utils.h" #include "predict-refine.h" #include "profile.h" +#include "crystfel-mille.h" #include "indexers/dirax.h" #include "indexers/asdf.h" #include "indexers/mosflm.h" @@ -774,6 +775,12 @@ static int try_indexer(struct image *image, IndexingMethod indm, } profile_end("cell-compare-to-others"); + if ( (mille != NULL) && !crystal_get_user_flag(cr) ) { + profile_start("mille-write"); + crystfel_mille_write_record(mille); + profile_end("mille-write"); + } + } n_bad = remove_flagged_crystals(image); diff --git a/libcrystfel/src/predict-refine.c b/libcrystfel/src/predict-refine.c index adbb418f..cc740db3 100644 --- a/libcrystfel/src/predict-refine.c +++ b/libcrystfel/src/predict-refine.c @@ -872,6 +872,7 @@ int refine_prediction(struct image *image, Crystal *cr, crystal_add_notes(cr, tmp); if ( mille != NULL ) { + crystfel_mille_delete_last_record(mille); profile_start("mille-calc"); write_mille(mille, n, crystal_get_cell(cr), rps, image, max_mille_level, Minvs); @@ -887,18 +888,10 @@ int refine_prediction(struct image *image, Crystal *cr, n = pair_peaks(image, cr, NULL, rps); free_rps_noreflist(rps, n); + if ( n < 3 ) { - if ( mille != NULL ) { - crystfel_mille_delete_last_record(mille); - } return 1; + } else { + return 0; } - - if ( mille != NULL ) { - profile_start("mille-write"); - crystfel_mille_write_record(mille); - profile_end("mille-write"); - } - - return 0; } -- cgit v1.2.3