diff options
-rw-r--r-- | libcrystfel/src/index.c | 9 | ||||
-rw-r--r-- | libcrystfel/src/index.h | 5 | ||||
-rw-r--r-- | libcrystfel/src/taketwo.c | 2 | ||||
-rw-r--r-- | libcrystfel/src/taketwo.h | 22 | ||||
-rw-r--r-- | src/indexamajig.c | 51 | ||||
-rw-r--r-- | src/process_image.h | 2 |
6 files changed, 79 insertions, 12 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index bdabb062..b00f13aa 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -64,6 +64,8 @@ struct _indexingprivate UnitCell *target_cell; float tolerance[4]; + struct taketwo_options *ttopts; + int n_methods; IndexingMethod *methods; void **engine_private; @@ -157,7 +159,8 @@ static void *prepare_method(IndexingMethod *m, UnitCell *cell, IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, struct detector *det, float *ltl, - int no_refine, const char *options) + int no_refine, const char *options, + struct taketwo_options *ttopts) { int i, n; char **method_strings; @@ -216,6 +219,8 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, } for ( i=0; i<4; i++ ) ipriv->tolerance[i] = ltl[i]; + ipriv->ttopts = ttopts; + return ipriv; } @@ -339,7 +344,7 @@ static int try_indexer(struct image *image, IndexingMethod indm, break; case INDEXING_TAKETWO : - r = taketwo_index(image, mpriv); + r = taketwo_index(image, ipriv->ttopts, mpriv); break; default : diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h index 2107ed80..8b3aadeb 100644 --- a/libcrystfel/src/index.h +++ b/libcrystfel/src/index.h @@ -157,10 +157,13 @@ extern IndexingMethod get_indm_from_string(const char *method); #include "detector.h" #include "cell.h" #include "image.h" +#include "taketwo.h" + extern IndexingPrivate *setup_indexing(const char *methods, UnitCell *cell, struct detector *det, float *ltl, - int no_refine, const char *options); + int no_refine, const char *options, + struct taketwo_options *ttopts); extern void index_pattern(struct image *image, IndexingPrivate *ipriv); diff --git a/libcrystfel/src/taketwo.c b/libcrystfel/src/taketwo.c index 7ae77f4a..307c6737 100644 --- a/libcrystfel/src/taketwo.c +++ b/libcrystfel/src/taketwo.c @@ -1511,7 +1511,7 @@ static UnitCell *run_taketwo(UnitCell *cell, struct rvec *rlps, int rlp_count) /* CrystFEL interface hooks */ -int taketwo_index(struct image *image, void *priv) +int taketwo_index(struct image *image, struct taketwo_options *opts, void *priv) { Crystal *cr; UnitCell *cell; diff --git a/libcrystfel/src/taketwo.h b/libcrystfel/src/taketwo.h index 4c06e334..a03292a8 100644 --- a/libcrystfel/src/taketwo.h +++ b/libcrystfel/src/taketwo.h @@ -3,13 +3,13 @@ * * Rewrite of TakeTwo algorithm (Acta D72 (8) 956-965) for CrystFEL * - * Copyright © 2016 Helen Ginn - * Copyright © 2016 Deutsches Elektronen-Synchrotron DESY, - * a research centre of the Helmholtz Association. + * Copyright © 2016-2017 Helen Ginn + * Copyright © 2016-2017 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. * * Authors: - * 2016 Helen Ginn <helen@strubi.ox.ac.uk> - * 2016 Thomas White <taw@physics.org> + * 2016 Helen Ginn <helen@strubi.ox.ac.uk> + * 2016-2017 Thomas White <taw@physics.org> * * This file is part of CrystFEL. * @@ -32,10 +32,20 @@ #define TAKETWO_H #include "cell.h" +#include "index.h" + +struct taketwo_options +{ + int member_thresh; + double len_tol; + double angle_tol; + double trace_tol; +}; + extern void *taketwo_prepare(IndexingMethod *indm, UnitCell *cell, struct detector *det, float *ltl); -extern int taketwo_index(struct image *image, void *priv); +extern int taketwo_index(struct image *image, struct taketwo_options *opts, void *priv); extern void taketwo_cleanup(IndexingPrivate *pp); #endif /* TAKETWO_H */ diff --git a/src/indexamajig.c b/src/indexamajig.c index ce87fde6..33eed81f 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -62,7 +62,7 @@ #include "reflist-utils.h" #include "cell-utils.h" #include "integration.h" - +#include "taketwo.h" #include "im-sandbox.h" @@ -171,6 +171,11 @@ static void show_help(const char *s) " Given as a list of comma separated list of \n" " indexer specific, key word arguments.\n" " Example: \"arg1=10,arg2=500\" \n" +"\nLow-level options for the TakeTwo indexer:\n\n" +" --taketwo-member-threshold Minimum number of members in network\n" +" --taketwo-len-tolerance Reciprocal space length tolerance (1/A)\n" +" --taketwo-angle-tolerance Reciprocal space angle tolerance (in degrees)\n" +" --taketwo-trace-tolerance Rotation matrix trace tolerance\n" ); } @@ -276,6 +281,10 @@ int main(int argc, char *argv[]) iargs.fix_divergence = -1.0; iargs.felix_options = NULL; iargs.profile = 0; + iargs.taketwo_opts.member_thresh = -1; + iargs.taketwo_opts.len_tol = -1.0; + iargs.taketwo_opts.angle_tol = -1.0; + iargs.taketwo_opts.trace_tol = -1.0; /* Long options */ const struct option longopts[] = { @@ -344,6 +353,10 @@ int main(int argc, char *argv[]) {"min-res", 1, NULL, 29}, {"max-res", 1, NULL, 30}, {"min-peaks", 1, NULL, 31}, + {"taketwo-member-thresh", 1, NULL, 32}, + {"taketwo-len-tol", 1, NULL, 33}, + {"taketwo-angle-tol", 1, NULL, 34}, + {"taketwo-trace-tol", 1, NULL, 35}, {0, 0, NULL, 0} }; @@ -551,6 +564,39 @@ int main(int argc, char *argv[]) iargs.min_peaks = atoi(optarg); break; + case 32: + if ( sscanf(optarg, "%i", &iargs.taketwo_opts.member_thresh) != 1 ) + { + ERROR("Invalid value for --taketwo-member-threshold\n"); + return 1; + } + break; + + case 33: + if ( sscanf(optarg, "%lf", &iargs.taketwo_opts.len_tol) != 1 ) + { + ERROR("Invalid value for --taketwo-len-tolerance\n"); + return 1; + } + break; + + case 34: + if ( sscanf(optarg, "%lf", &iargs.taketwo_opts.angle_tol) != 1 ) + { + ERROR("Invalid value for --taketwo-angle-tolerance\n"); + return 1; + } + break; + + + case 35: + if ( sscanf(optarg, "%lf", &iargs.taketwo_opts.trace_tol) != 1 ) + { + ERROR("Invalid value for --taketwo-trace-tolerance\n"); + return 1; + } + break; + case 0 : break; @@ -803,7 +849,8 @@ int main(int argc, char *argv[]) iargs.ipriv = setup_indexing(indm_str, iargs.cell, iargs.det, iargs.tols, no_refine, - iargs.felix_options); + iargs.felix_options, + &iargs.taketwo_opts); if ( iargs.ipriv == NULL ) { ERROR("Failed to set up indexing system\n"); return 1; diff --git a/src/process_image.h b/src/process_image.h index ec51c188..3e87b922 100644 --- a/src/process_image.h +++ b/src/process_image.h @@ -39,6 +39,7 @@ struct index_args; #include "integration.h" #include "im-sandbox.h" #include "time-accounts.h" +#include "taketwo.h" enum { @@ -100,6 +101,7 @@ struct index_args float fix_divergence; char *felix_options; int profile; /* Whether or not to do wall clock profiling */ + struct taketwo_options taketwo_opts; }; |