aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-01-22 17:06:34 +0100
committerThomas White <taw@physics.org>2021-01-22 17:06:34 +0100
commit1ea31bb393d7f39fd19ea1f34de12de02a32f1b8 (patch)
treefb8f650eb0e0bfb7277e102c7653e0cb3adad476
parent28253276c24cc129047b4435c58d2bd600a1354c (diff)
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.
-rw-r--r--doc/man/compare_hkl.17
-rw-r--r--libcrystfel/src/fom.c122
-rw-r--r--libcrystfel/src/fom.h7
-rw-r--r--src/compare_hkl.c87
4 files changed, 48 insertions, 175 deletions
diff --git a/doc/man/compare_hkl.1 b/doc/man/compare_hkl.1
index 8c54b4c9..22de7df7 100644
--- a/doc/man/compare_hkl.1
+++ b/doc/man/compare_hkl.1
@@ -125,13 +125,6 @@ High resolution cutoff, as 1/d in m<sup>-1</sup>. Use this or \fB--highres\fR,
.IP \fB--highres=\fR\fId\fR
High resolution cutoff in Angstroms. Use this or \fB--rmax\fR, but not both.
-.PD 0
-.IP \fB--intensity-shells\fR
-.PD
-Use intensity shells instead of resolution shells. The range of shells will start at the intensity of the least intense reflection, and extend from there by 1/5000th of the intensity of the difference between the strongest and weakest reflection in the first reflection list. The pairs of reflections will also be assigned their bins according to the intensity of the reflection in the first list.
-.sp
-Because of the hardcoded factor of 1/5000, needed to avoid a very uneven distribution of the number of reflection pairs in each bin, you are advised not to draw strong conclusions from the results of using this option.
-
.SH AUTHOR
This page was written by Thomas White.
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; i<nshells; i++ ) {
-
- s->rmins[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; j<s->nshells; 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; j<s->nshells; 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; j<s->nshells; 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);
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index 1c7865d8..dedef82e 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -74,7 +74,6 @@ static void show_help(const char *s)
" --rmax=<res> High resolution cutoff (1/d in m^-1).\n"
" --lowres=<n> Low resolution cutoff in (d in A).\n"
" --highres=<n> High resolution cutoff in (d in A).\n"
-" --intensity-shells Use shells of intensity instead of resolution.\n"
"\n"
" -h, --help Display this help message.\n"
" --version Print CrystFEL version number and exit.\n"
@@ -85,7 +84,6 @@ static void show_help(const char *s)
static void do_fom(RefList *list1, RefList *list2, UnitCell *cell,
double rmin, double rmax, enum fom_type fom,
int config_unity, int nshells, const char *filename,
- int config_intshells, double min_I, double max_I,
SymOpList *sym)
{
struct fom_shells *shells;
@@ -95,11 +93,7 @@ static void do_fom(RefList *list1, RefList *list2, UnitCell *cell,
const char *t1, *t2;
/* Calculate the bins */
- if ( config_intshells ) {
- shells = fom_make_intensity_shells(min_I, max_I, nshells);
- } else {
- shells = fom_make_resolution_shells(rmin, rmax, nshells);
- }
+ shells = fom_make_resolution_shells(rmin, rmax, nshells);
if ( shells == NULL ) {
ERROR("Failed to set up shells.\n");
@@ -170,13 +164,8 @@ static void do_fom(RefList *list1, RefList *list2, UnitCell *cell,
return;
}
- if ( config_intshells ) {
- t1 = "Relative I ";
- t2 = "";
- } else {
- t1 = " 1/d centre";
- t2 = " d / A Min 1/nm Max 1/nm";
- }
+ t1 = " 1/d centre";
+ t2 = " d / A Min 1/nm Max 1/nm";
switch ( fom ) {
@@ -244,61 +233,41 @@ static void do_fom(RefList *list1, RefList *list2, UnitCell *cell,
case FOM_R2 :
case FOM_RSPLIT :
case FOM_RANO :
- if ( config_intshells ) {
- fprintf(fh, "%10.3f %10.2f %10i\n",
- cen, r*100.0, fctx->cts[i]);
- } else {
- fprintf(fh, "%10.3f %10.2f %10i %10.2f "
- "%10.3f %10.3f\n",
- cen*1.0e-9, r*100.0, fctx->cts[i],
- (1.0/cen)*1e10,
- shells->rmins[i]*1.0e-9,
- shells->rmaxs[i]*1.0e-9);
- }
+ fprintf(fh, "%10.3f %10.2f %10i %10.2f "
+ "%10.3f %10.3f\n",
+ cen*1.0e-9, r*100.0, fctx->cts[i],
+ (1.0/cen)*1e10,
+ shells->rmins[i]*1.0e-9,
+ shells->rmaxs[i]*1.0e-9);
break;
case FOM_CC :
case FOM_CCSTAR :
case FOM_CCANO :
case FOM_CRDANO :
- if ( config_intshells ) {
- fprintf(fh, "%10.3f %10.7f %10i\n",
- cen, r, fctx->cts[i]);
- } else {
- fprintf(fh, "%10.3f %10.7f %10i %10.2f "
- "%10.3f %10.3f\n",
- cen*1.0e-9, r, fctx->cts[i], (1.0/cen)*1e10,
- shells->rmins[i]*1.0e-9,
- shells->rmaxs[i]*1.0e-9);
- }
+ fprintf(fh, "%10.3f %10.7f %10i %10.2f "
+ "%10.3f %10.3f\n",
+ cen*1.0e-9, r, fctx->cts[i], (1.0/cen)*1e10,
+ shells->rmins[i]*1.0e-9,
+ shells->rmaxs[i]*1.0e-9);
break;
case FOM_RANORSPLIT :
- if ( config_intshells ) {
- fprintf(fh, "%10.3f %10.7f %10i\n",
- cen, r, fctx->cts[i]);
- } else {
- fprintf(fh, "%10.3f %10.7f %10i %10.2f "
- "%10.3f %10.3f\n",
- cen*1.0e-9, r, fctx->cts[i], (1.0/cen)*1e10,
- shells->rmins[i]*1.0e-9,
- shells->rmaxs[i]*1.0e-9);
- }
+ fprintf(fh, "%10.3f %10.7f %10i %10.2f "
+ "%10.3f %10.3f\n",
+ cen*1.0e-9, r, fctx->cts[i], (1.0/cen)*1e10,
+ shells->rmins[i]*1.0e-9,
+ shells->rmaxs[i]*1.0e-9);
break;
case FOM_D1SIG :
case FOM_D2SIG :
- if ( config_intshells ) {
- fprintf(fh, "%10.3f %10.2f %10i\n",
- cen, r*100.0, fctx->cts[i]);
- } else {
- fprintf(fh, "%10.3f %10.2f %10i %10.2f "
- "%10.3f %10.3f\n",
- cen*1.0e-9, r*100.0, fctx->cts[i],
- (1.0/cen)*1e10,
- shells->rmins[i]*1.0e-9,
- shells->rmaxs[i]*1.0e-9);
- }
+ fprintf(fh, "%10.3f %10.2f %10i %10.2f "
+ "%10.3f %10.3f\n",
+ cen*1.0e-9, r*100.0, fctx->cts[i],
+ (1.0/cen)*1e10,
+ shells->rmins[i]*1.0e-9,
+ shells->rmaxs[i]*1.0e-9);
break;
}
@@ -358,7 +327,6 @@ int main(int argc, char *argv[])
int config_ignorenegs = 0;
int config_zeronegs = 0;
int config_unity = 0;
- int config_intshells = 0;
int nshells = 10;
char *shell_file = NULL;
double min_I = +INFINITY;
@@ -384,7 +352,6 @@ int main(int argc, char *argv[])
{"min-measurements", 1, NULL, 11},
{"ignore-negs", 0, &config_ignorenegs, 1},
{"zero-negs", 0, &config_zeronegs, 1},
- {"intensity-shells", 0, &config_intshells, 1},
{0, 0, NULL, 0}
};
@@ -665,7 +632,7 @@ int main(int argc, char *argv[])
cell, sym,
anom, rmin_fix, rmax_fix, sigma_cutoff,
config_ignorenegs, config_zeronegs,
- mul_cutoff, &min_I, &max_I);
+ mul_cutoff);
reflist_free(list1);
reflist_free(list2);
@@ -691,7 +658,7 @@ int main(int argc, char *argv[])
rmin/1e9, rmax/1e9, 1e10/rmin, 1e10/rmax);
}
do_fom(list1_acc, list2_acc, cell, rmin, rmax, fom, config_unity,
- nshells, shell_file, config_intshells, min_I, max_I, sym);
+ nshells, shell_file, sym);
free(shell_file);
reflist_free(list1_acc);