aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/index.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2016-01-29 18:23:48 +0100
committerThomas White <taw@physics.org>2016-01-29 21:05:03 +0100
commitc9c756db807f3ea22dcf2d01401a4ce69f73f4df (patch)
tree2d53d2355512a29976ce3ebbdd83f9a602d5bf60 /libcrystfel/src/index.c
parentf2bf00dd32e79a06410b7a95fedaa2ee3bf33ef3 (diff)
Perform prediction refinement straight after indexing
This allows indexing to be attempted again (either a new method or with "retry") if the prediction refinement fails, increasing overall indexing rate. Side-effect: there are some hoops which would need to be jumped through to store the profile radius before refinement and hence enable scripts/plot-predict-refine to work. For now, we'll ignore this as it's clear that the prediction refinement is working.
Diffstat (limited to 'libcrystfel/src/index.c')
-rw-r--r--libcrystfel/src/index.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index 2b84a621..6a74a958 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -55,6 +55,7 @@
#include "geometry.h"
#include "cell-utils.h"
#include "felix.h"
+#include "predict-refine.h"
static int debug_index(struct image *image)
@@ -234,36 +235,61 @@ void map_all_peaks(struct image *image)
static int try_indexer(struct image *image, IndexingMethod indm,
IndexingPrivate *ipriv)
{
+ int i, r, n_bad;
+
switch ( indm & INDEXING_METHOD_MASK ) {
case INDEXING_NONE :
return 0;
case INDEXING_DIRAX :
- return run_dirax(image, ipriv);
+ r = run_dirax(image, ipriv);
+ break;
case INDEXING_ASDF :
- return run_asdf(image, ipriv);
+ r = run_asdf(image, ipriv);
+ break;
case INDEXING_MOSFLM :
- return run_mosflm(image, ipriv);
+ r = run_mosflm(image, ipriv);
+ break;
case INDEXING_XDS :
- return run_xds(image, ipriv);
+ r = run_xds(image, ipriv);
+ break;
case INDEXING_DEBUG :
- return debug_index(image);
+ r = debug_index(image);
+ break;
case INDEXING_FELIX :
- return felix_index(image, ipriv);
+ r = felix_index(image, ipriv);
+ break;
default :
ERROR("Unrecognised indexing method: %i\n", indm);
- break;
+ return 0;
}
- return 0;
+ /* Attempt prediction refinement */
+ n_bad = 0;
+ for ( i=0; i<r; i++ ) {
+ Crystal *cr = image->crystals[image->n_crystals-i-1];
+ crystal_set_image(cr, image);
+ crystal_set_user_flag(cr, 0);
+ crystal_set_profile_radius(cr, 0.02e9);
+ crystal_set_mosaicity(cr, 0.0);
+ if ( refine_prediction(image, cr) != 0 ) {
+ crystal_set_user_flag(cr, 1);
+ n_bad++;
+ }
+ }
+
+ remove_flagged_crystals(image);
+
+ if ( n_bad == r ) return 0;
+ return r;
}