From 1ea31bb393d7f39fd19ea1f34de12de02a32f1b8 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 22 Jan 2021 17:06:34 +0100 Subject: compare_hkl: Remove --intensity-shells No-one uses it, it doubles the complexity of the code, and the manual even warns not to use it. --- libcrystfel/src/fom.c | 122 +++++++++----------------------------------------- libcrystfel/src/fom.h | 7 +-- 2 files changed, 21 insertions(+), 108 deletions(-) (limited to 'libcrystfel/src') diff --git a/libcrystfel/src/fom.c b/libcrystfel/src/fom.c index 35d5c5e3..19f35a86 100644 --- a/libcrystfel/src/fom.c +++ b/libcrystfel/src/fom.c @@ -427,47 +427,6 @@ double fom_shell(struct fom_context *fctx, int i) } -struct fom_shells *fom_make_intensity_shells(double min_I, double max_I, - int nshells) -{ - struct fom_shells *s; - int i; - - if ( min_I >= max_I ) { - ERROR("Invalid intensity range.\n"); - return NULL; - } - - /* Adjust minimum and maximum intensities to get the most densely - * populated part of the reflections */ - max_I = min_I + (max_I-min_I)/5000.0; - - s = malloc(sizeof(struct fom_shells)); - if ( s == NULL ) return NULL; - - s->rmins = malloc(nshells*sizeof(double)); - s->rmaxs = malloc(nshells*sizeof(double)); - - if ( (s->rmins==NULL) || (s->rmaxs==NULL) ) { - ERROR("Couldn't allocate memory for shells.\n"); - free(s); - return NULL; - } - - s->config_intshells = 1; - s->nshells = nshells; - - for ( i=0; irmins[i] = min_I + i*(max_I - min_I)/nshells;; - s->rmaxs[i] = min_I + (i+1)*(max_I - min_I)/nshells;; - - } - - return s; -} - - struct fom_shells *fom_make_resolution_shells(double rmin, double rmax, int nshells) { @@ -487,7 +446,6 @@ struct fom_shells *fom_make_resolution_shells(double rmin, double rmax, return NULL; } - s->config_intshells = 0; s->nshells = nshells; total_vol = pow(rmax, 3.0) - pow(rmin, 3.0); @@ -513,60 +471,33 @@ struct fom_shells *fom_make_resolution_shells(double rmin, double rmax, double fom_shell_label(struct fom_shells *s, int i) { - if ( s->config_intshells ) { - return (i+0.5) / s->nshells; - } else { - return s->rmins[i] + (s->rmaxs[i] - s->rmins[i])/2.0; - } + return s->rmins[i] + (s->rmaxs[i] - s->rmins[i])/2.0; } static int get_bin(struct fom_shells *s, Reflection *refl, UnitCell *cell) { - if ( s->config_intshells ) { - - double intensity; - int bin, j; - - intensity = get_intensity(refl); - - bin = -1; - for ( j=0; jnshells; j++ ) { - if ( (intensity>s->rmins[j]) - && (intensity<=s->rmaxs[j]) ) - { - bin = j; - break; - } - } - - return bin; - - } else { - - double d; - int bin, j; - signed int h, k, l; - - get_indices(refl, &h, &k, &l); - d = 2.0 * resolution(cell, h, k, l); - - bin = -1; - for ( j=0; jnshells; j++ ) { - if ( (d>s->rmins[j]) && (d<=s->rmaxs[j]) ) { - bin = j; - break; - } + double d; + int bin, j; + signed int h, k, l; + + get_indices(refl, &h, &k, &l); + d = 2.0 * resolution(cell, h, k, l); + + bin = -1; + for ( j=0; jnshells; j++ ) { + if ( (d>s->rmins[j]) && (d<=s->rmaxs[j]) ) { + bin = j; + break; } + } - /* Allow for slight rounding errors */ - if ( (bin == -1) && (d <= s->rmins[0]) ) bin = 0; - if ( (bin == -1) && (d >= s->rmaxs[s->nshells-1]) ) bin = 0; - assert(bin != -1); - - return bin; + /* Allow for slight rounding errors */ + if ( (bin == -1) && (d <= s->rmins[0]) ) bin = 0; + if ( (bin == -1) && (d >= s->rmaxs[s->nshells-1]) ) bin = 0; + assert(bin != -1); - } + return bin; } @@ -795,14 +726,11 @@ int fom_select_reflections(RefList *list1, RefList *list2, UnitCell *cell, SymOpList *sym, int anom, double rmin_fix, double rmax_fix, double sigma_cutoff, int ignore_negs, - int zero_negs, int mul_cutoff, - double *pmin_I, double *pmax_I) + int zero_negs, int mul_cutoff) { Reflection *refl1; RefListIterator *iter; int ncom, nrej, nmul, nneg, nres, nbij, ncen; - double min_I = +INFINITY; - double max_I = -INFINITY; /* Select reflections to be used */ ncom = 0; @@ -892,9 +820,6 @@ int fom_select_reflections(RefList *list1, RefList *list2, copy_data(refl2_acc, refl2); set_intensity(refl2_acc, val2); - if ( val1 > max_I ) max_I = val1; - if ( val1 < min_I ) min_I = val1; - ncom++; } @@ -908,8 +833,6 @@ int fom_select_reflections(RefList *list1, RefList *list2, list1_acc = reflist_new(); list2_acc = reflist_new(); - min_I = +INFINITY; - max_I = -INFINITY; ncom = 0; for ( refl1 = first_refl(list1, &iter); @@ -963,9 +886,6 @@ int fom_select_reflections(RefList *list1, RefList *list2, copy_data(refl2_acc, refl2); set_intensity(refl2_acc, val2); - if ( val1 > max_I ) max_I = val1; - if ( val1 < min_I ) min_I = val1; - ncom++; } } @@ -1005,7 +925,5 @@ int fom_select_reflections(RefList *list1, RefList *list2, " centric.\n", ncen); } - *pmin_I = min_I; - *pmax_I = max_I; return ncom; } diff --git a/libcrystfel/src/fom.h b/libcrystfel/src/fom.h index 1adb940f..d3373044 100644 --- a/libcrystfel/src/fom.h +++ b/libcrystfel/src/fom.h @@ -56,7 +56,6 @@ enum fom_type struct fom_shells { - int config_intshells; int nshells; double *rmins; double *rmaxs; @@ -91,8 +90,7 @@ extern int fom_select_reflections(RefList *list1, RefList *list2, UnitCell *cell, SymOpList *sym, int anom, double rmin_fix, double rmax_fix, double sigma_cutoff, int ignore_negs, - int zero_negs, int mul_cutoff, - double *pmin_I, double *pmax_I); + int zero_negs, int mul_cutoff); extern struct fom_context *fom_calculate(RefList *list1, RefList *list2, UnitCell *cell, @@ -103,9 +101,6 @@ extern struct fom_context *fom_calculate(RefList *list1, RefList *list2, extern struct fom_shells *fom_make_resolution_shells(double rmin, double rmax, int nshells); -extern struct fom_shells *fom_make_intensity_shells(double min_I, double max_I, - int nshells); - extern double fom_shell_label(struct fom_shells *s, int i); extern double fom_shell(struct fom_context *fctx, int i); -- cgit v1.2.3