aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-12-12 13:17:30 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:42 +0100
commit8c40aed1b3ab66fbab2a0b457ccf8286bc1a3b05 (patch)
tree3a491e2cd4b63b9b80ead4fbe01e81d03ad05e18
parent2318ae07fa5baaead4c1bc55bc4e63694c1942dc (diff)
indexamajig: Optional I/sigma(I) cutoff during integration
-rw-r--r--libcrystfel/src/peaks.c5
-rw-r--r--libcrystfel/src/peaks.h3
-rw-r--r--src/indexamajig.c12
3 files changed, 17 insertions, 3 deletions
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c
index 0d72e514..34e0b8ca 100644
--- a/libcrystfel/src/peaks.c
+++ b/libcrystfel/src/peaks.c
@@ -564,7 +564,7 @@ int peak_sanity_check(struct image *image)
/* Integrate the list of predicted reflections in "image" */
void integrate_reflections(struct image *image, int polar, int use_closer,
- int bgsub)
+ int bgsub, double min_snr)
{
Reflection *refl;
RefListIterator *iter;
@@ -606,6 +606,9 @@ void integrate_reflections(struct image *image, int polar, int use_closer,
&intensity, &bg, &max, &sigma, polar, 0,
bgsub);
+ /* I/sigma(I) cutoff */
+ if ( intensity/sigma < min_snr ) r = 0;
+
/* Record intensity and set redundancy to 1 on success */
if ( r == 0 ) {
set_int(refl, intensity);
diff --git a/libcrystfel/src/peaks.h b/libcrystfel/src/peaks.h
index 88dab26d..d52c75e4 100644
--- a/libcrystfel/src/peaks.h
+++ b/libcrystfel/src/peaks.h
@@ -25,7 +25,8 @@ extern void search_peaks(struct image *image, float threshold,
float min_gradient, float min_snr);
extern void integrate_reflections(struct image *image,
- int polar, int use_closer, int bgsub);
+ int polar, int use_closer, int bgsub,
+ double min_snr);
extern int peak_sanity_check(struct image * image);
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 361d0514..293ebe58 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -69,6 +69,7 @@ struct static_index_args
float threshold;
float min_gradient;
float min_snr;
+ double min_int_snr;
struct detector *det;
IndexingMethod *indm;
IndexingPrivate **ipriv;
@@ -185,6 +186,8 @@ static void show_help(const char *s)
" Default: 100,000.\n"
" --min-snr=<n> Minimum signal-to-noise ratio for peaks.\n"
" Default: 5.\n"
+" --min-integration-snr=<n> Minimum signal-to-noise ratio for peaks\n"
+" during integration. Default: -infinity.\n"
" -e, --image=<element> Use this image from the HDF5 file.\n"
" Example: /data/data0.\n"
" Default: The first one found.\n"
@@ -363,7 +366,8 @@ static void process_image(void *pp, int cookie)
integrate_reflections(&image, config_polar,
pargs->static_args.config_closer,
- pargs->static_args.config_bgsub);
+ pargs->static_args.config_bgsub,
+ pargs->static_args.min_int_snr);
estimate_resolution(image.reflections,
image.indexed_cell, &min, &max);
@@ -544,6 +548,7 @@ int main(int argc, char *argv[])
float threshold = 800.0;
float min_gradient = 100000.0;
float min_snr = 5.0;
+ double min_int_snr = -INFINITY;
struct detector *det;
char *geometry = NULL;
IndexingMethod *indm;
@@ -602,6 +607,7 @@ int main(int argc, char *argv[])
{"threshold", 1, NULL, 't'},
{"min-gradient", 1, NULL, 4},
{"min-snr", 1, NULL, 11},
+ {"min-integration-snr",1, NULL, 12},
{"no-check-prefix", 0, &config_checkprefix, 0},
{"no-closer-peak", 0, &config_closer, 0},
{"insane", 0, &config_insane, 1},
@@ -684,6 +690,10 @@ int main(int argc, char *argv[])
min_snr = strtof(optarg, NULL);
break;
+ case 12 :
+ min_int_snr = strtof(optarg, NULL);
+ break;
+
case 'e' :
element = strdup(optarg);
break;