aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/cell.c7
-rw-r--r--libcrystfel/src/cell.h2
-rw-r--r--libcrystfel/src/index.c6
-rw-r--r--libcrystfel/src/index.h2
-rw-r--r--src/indexamajig.c26
5 files changed, 33 insertions, 10 deletions
diff --git a/libcrystfel/src/cell.c b/libcrystfel/src/cell.c
index c31697bc..a6df931b 100644
--- a/libcrystfel/src/cell.c
+++ b/libcrystfel/src/cell.c
@@ -669,7 +669,7 @@ static int same_vector(struct cvec a, struct cvec b)
/* Attempt to make 'cell' fit into 'template' somehow */
UnitCell *match_cell(UnitCell *cell, UnitCell *template, int verbose,
- int reduce)
+ float *tols, int reduce)
{
signed int n1l, n2l, n3l;
double asx, asy, asz;
@@ -683,8 +683,7 @@ UnitCell *match_cell(UnitCell *cell, UnitCell *template, int verbose,
float best_fom = +999999999.9; /* Large number.. */
int ncand[3] = {0,0,0};
signed int ilow, ihigh;
- float ltl = 5.0; /* percent */
- float angtol = deg2rad(1.5);
+ float angtol = deg2rad(tols[3]);
if ( cell_get_reciprocal(template, &asx, &asy, &asz,
&bsx, &bsy, &bsz,
@@ -753,7 +752,7 @@ UnitCell *match_cell(UnitCell *cell, UnitCell *template, int verbose,
/* Test modulus for agreement with moduli of template */
for ( i=0; i<3; i++ ) {
- if ( !within_tolerance(lengths[i], tlen, ltl) )
+ if ( !within_tolerance(lengths[i], tlen, tols[i]) )
continue;
cand[i][ncand[i]].vec.u = tx;
diff --git a/libcrystfel/src/cell.h b/libcrystfel/src/cell.h
index 72c0b6df..e69ce721 100644
--- a/libcrystfel/src/cell.h
+++ b/libcrystfel/src/cell.h
@@ -96,7 +96,7 @@ extern UnitCell *rotate_cell(UnitCell *in, double omega, double phi,
extern void cell_print(UnitCell *cell);
extern UnitCell *match_cell(UnitCell *cell, UnitCell *tempcell, int verbose,
- int reduce);
+ float *ltl, int reduce);
extern UnitCell *match_cell_ab(UnitCell *cell, UnitCell *tempcell);
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index 34a5dda3..56b34baa 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -139,7 +139,7 @@ void map_all_peaks(struct image *image)
void index_pattern(struct image *image, UnitCell *cell, IndexingMethod *indm,
int cellr, int verbose, IndexingPrivate **ipriv,
- int config_insane)
+ int config_insane, float *ltl)
{
int i;
int n = 0;
@@ -191,10 +191,10 @@ void index_pattern(struct image *image, UnitCell *cell, IndexingMethod *indm,
new_cell = cell_new_from_cell(cand);
break;
case CELLR_REDUCE :
- new_cell = match_cell(cand, cell, verbose, 1);
+ new_cell = match_cell(cand, cell, verbose, ltl, 1);
break;
case CELLR_COMPARE :
- new_cell = match_cell(cand, cell, verbose, 0);
+ new_cell = match_cell(cand, cell, verbose, ltl, 0);
break;
case CELLR_COMPARE_AB :
new_cell = match_cell_ab(cand, cell);
diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h
index 9d4b69bd..1457e93f 100644
--- a/libcrystfel/src/index.h
+++ b/libcrystfel/src/index.h
@@ -54,7 +54,7 @@ extern void map_all_peaks(struct image *image);
extern void index_pattern(struct image *image, UnitCell *cell,
IndexingMethod *indm, int cellr, int verbose,
- IndexingPrivate **priv, int config_insane);
+ IndexingPrivate **priv, int config_insane, float *ltl);
extern void cleanup_indexing(IndexingPrivate **priv);
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 7feb3968..6f3704bc 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -75,6 +75,7 @@ struct static_index_args
IndexingPrivate **ipriv;
int peaks; /* Peak detection method */
int cellr;
+ float tols[4];
struct beam_params *beam;
const char *element;
const char *hdf5_peak_path;
@@ -171,6 +172,9 @@ static void show_help(const char *s)
" compare : match by at most changing the order of\n"
" the indices.\n"
" compare_ab : compare 'a' and 'b' lengths only.\n"
+" --tolerance=<a,b,c,angl> Set the tolerance for a,b,c axis (in %%)\n"
+" and for the angles (in deg) when reducing\n"
+" or comparing (default is 5%% and 1.5deg)\n"
" --filter-cm Perform common-mode noise subtraction on images\n"
" before proceeding. Intensities will be extracted\n"
" from the image as it is after this processing.\n"
@@ -354,7 +358,7 @@ static void process_image(void *pp, int cookie)
image.profile_radius = 0.0001e9;
index_pattern(&image, cell, indm, pargs->static_args.cellr,
config_verbose, pargs->static_args.ipriv,
- pargs->static_args.config_insane);
+ pargs->static_args.config_insane, pargs->static_args.tols);
if ( image.indexed_cell != NULL ) {
@@ -555,6 +559,8 @@ int main(int argc, char *argv[])
char *prefix = NULL;
char *speaks = NULL;
char *scellr = NULL;
+ char *toler = NULL;
+ float tols[4] = {5.0, 5.0, 5.0, 1.5}; /* for a,b,c in % and for the angles in deg */
int cellr;
int peaks;
int nthreads = 1;
@@ -587,6 +593,7 @@ int main(int argc, char *argv[])
{"no-index", 0, &config_noindex, 1},
{"peaks", 1, NULL, 2},
{"cell-reduction", 1, NULL, 3},
+ {"tolerance", 1, NULL, 13},
{"indexing", 1, NULL, 'z'},
{"geometry", 1, NULL, 'g'},
{"beam", 1, NULL, 'b'},
@@ -676,6 +683,10 @@ int main(int argc, char *argv[])
scellr = strdup(optarg);
break;
+ case 13 :
+ toler = strdup(optarg);
+ break;
+
case 4 :
min_gradient = strtof(optarg, NULL);
break;
@@ -868,6 +879,15 @@ int main(int argc, char *argv[])
/* No indexing -> no reduction */
if ( indm == NULL ) reduction_needs_cell = 0;
+ if ( toler != NULL ) {
+ int ttt;
+ ttt = sscanf(toler, "%f,%f,%f,%f", &tols[0], &tols[1], &tols[2], &tols[3] );
+ if ( ttt != 4 ) {
+ ERROR("Invalid parameters for '--tolerance'\n");
+ return 1;
+ }
+ }
+
if ( geometry == NULL ) {
ERROR("You need to specify a geometry file with --geometry\n");
return 1;
@@ -944,6 +964,10 @@ int main(int argc, char *argv[])
qargs.static_args.config_insane = config_insane;
qargs.static_args.config_bgsub = config_bgsub;
qargs.static_args.cellr = cellr;
+ qargs.static_args.tols[0] = tols[0];
+ qargs.static_args.tols[1] = tols[1];
+ qargs.static_args.tols[2] = tols[2];
+ qargs.static_args.tols[3] = tols[3];
qargs.static_args.threshold = threshold;
qargs.static_args.min_gradient = min_gradient;
qargs.static_args.min_snr = min_snr;