aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2024-06-21 11:00:34 +0200
committerThomas White <taw@physics.org>2024-06-21 11:00:34 +0200
commit17471dc1c38f77d9c5930d0cbe15e4bc8e12d16c (patch)
tree2d5d29847da813ef29a5d56ab96885618877cc41
parentecd51ad7d010177e6e5cab5f19ad357bc0327d7a (diff)
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
-rw-r--r--libcrystfel/src/index.c7
-rw-r--r--libcrystfel/src/predict-refine.c15
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;
}