diff options
author | Thomas White <taw@physics.org> | 2019-09-06 11:02:48 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2019-09-06 11:02:48 +0200 |
commit | 170391d34095b8a0439f987dd08fda7cb8213aba (patch) | |
tree | 1324b83e262f6da557023c728df12f32444530ae | |
parent | 6d931c8495cba9589a03c64c91a9fb58d5cfea44 (diff) |
Use new peak check only when doing multi-lattice indexing
-rw-r--r-- | libcrystfel/src/index.c | 3 | ||||
-rw-r--r-- | libcrystfel/src/peaks.c | 35 | ||||
-rw-r--r-- | libcrystfel/src/peaks.h | 3 |
3 files changed, 36 insertions, 5 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index 36d7b84b..4c82e868 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -663,7 +663,8 @@ static int try_indexer(struct image *image, IndexingMethod indm, /* Peak alignment check if requested */ if ( ipriv->flags & INDEXING_CHECK_PEAKS ) { - if ( !peak_sanity_check(image, &cr, 1) ) { + int mm = ipriv->flags & INDEXING_MULTI; + if ( !indexing_peak_check(image, &cr, 1, mm) ) { crystal_set_user_flag(cr, 1); continue; } diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index 989f2e72..ea524210 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -675,7 +675,20 @@ int search_peaks_peakfinder9(struct image *image, float min_snr_biggest_pix, #endif // HAVE_FDIP -int peak_sanity_check(struct image *image, Crystal **crystals, int n_cryst) +/** + * \param image An \ref image structure + * \param crystals Pointer to array of pointers to crystals + * \param n_cryst The number of crystals + * \param multi_mode Whether the thresholds should be set for multi-lattice indexing + * + * Checks whether the peaks in \p image appear to be explained by the crystals + * provided. + * + * Returns 1 if the peaks appear to be well-explained by the crystals. + * Otherwise, if the indexing solutions appear to be "bad", returns 0. + */ +int indexing_peak_check(struct image *image, Crystal **crystals, int n_cryst, + int multi_mode) { int n_feat = 0; int n_sane = 0; @@ -733,9 +746,23 @@ int peak_sanity_check(struct image *image, Crystal **crystals, int n_cryst) } /* 0 means failed test, 1 means passed test */ - return (n_sane > 70) - || ((n_sane > 25) && (n_sane > 0.3*n_feat)) - || (n_sane > 0.4*n_feat); + + if ( multi_mode ) { + return (n_sane > 70) + || ((n_sane > 25) && (n_sane > 0.3*n_feat)) + || (n_sane > 0.4*n_feat); + } else { + return ((double)n_sane / n_feat) >= 0.5; + } +} + + +/** + * Deprecated: use indexing_peak_check instead + */ +int peak_sanity_check(struct image *image, Crystal **crystals, int n_cryst) +{ + return indexing_peak_check(image, crystals, n_cryst, 1); } diff --git a/libcrystfel/src/peaks.h b/libcrystfel/src/peaks.h index b08defcd..65c3a1ef 100644 --- a/libcrystfel/src/peaks.h +++ b/libcrystfel/src/peaks.h @@ -68,6 +68,9 @@ extern int search_peaks_peakfinder9(struct image *image, float min_peak_over_neighbour, int window_radius); +extern int indexing_peak_check(struct image *image, Crystal **crystals, + int n_cryst, int multi_mode); + extern int peak_sanity_check(struct image *image, Crystal **crystals, int n_cryst); |