From fddfbb4fd069d914865afc53053574b87ba2d552 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 26 Mar 2014 17:48:47 +0100 Subject: indexamajig: Don't check SNR with --peaks=hdf5 unless given --check-hdf5-snr --- doc/man/indexamajig.1 | 7 ++++++- libcrystfel/src/peaks.c | 5 +++-- libcrystfel/src/peaks.h | 2 +- src/indexamajig.c | 18 ++++++++++++------ src/process_image.c | 7 ++++--- src/process_image.h | 1 + 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/doc/man/indexamajig.1 b/doc/man/indexamajig.1 index cb24e916..c0ddd41f 100644 --- a/doc/man/indexamajig.1 +++ b/doc/man/indexamajig.1 @@ -315,7 +315,12 @@ Normally, peaks which contain one or more pixels above max_adu (defined in the d .PD 0 .IP \fB--no-revalidate\fR .PD -When using \fB--peaks=hdf5\fR, the peaks will be put through the same checks as if you were using \fB--peaks=zaef\fR. These checks reject peaks which are too close to panel edges, are saturated (unless you use \fB--use-saturated\fR), fall short of the minimum SNR value given by \fB--min-snr\fR, have other nearby peaks (closer than twice the inner integration radius, see \fB--int-radius\fR), or have any part in a bad region. Using this option skips this validation step, and uses the peaks directly. +When using \fB--peaks=hdf5\fR, the peaks will be put through some of the same checks as if you were using \fB--peaks=zaef\fR. These checks reject peaks which are too close to panel edges, are saturated (unless you use \fB--use-saturated\fR), have other nearby peaks (closer than twice the inner integration radius, see \fB--int-radius\fR), or have any part in a bad region. Using this option skips this validation step, and uses the peaks directly. + +.PD 0 +.IP \fB--check-hdf5-snr\fR +.PD +With this option with \fB--peaks=hdf5\fR, the peaks will additionally be checked to see that they satisfy the minimum SNR specified with \fB--min-snr\fR. .PD 0 .IP \fB--no-peaks-in-stream\fR diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index 0f5d96a6..6e5d09dd 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -661,7 +661,8 @@ int peak_sanity_check(struct image *image, Crystal **crystals, int n_cryst) void validate_peaks(struct image *image, double min_snr, - int ir_inn, int ir_mid, int ir_out, int use_saturated) + int ir_inn, int ir_mid, int ir_out, int use_saturated, + int check_snr) { int i, n; ImageFeatureList *flist; @@ -718,7 +719,7 @@ void validate_peaks(struct image *image, double min_snr, continue; } - if ( fabs(intensity)/sigma < min_snr ) { + if ( check_snr && (fabs(intensity)/sigma < min_snr) ) { n_snr++; continue; } diff --git a/libcrystfel/src/peaks.h b/libcrystfel/src/peaks.h index 09ad5245..433f7d1f 100644 --- a/libcrystfel/src/peaks.h +++ b/libcrystfel/src/peaks.h @@ -50,7 +50,7 @@ extern int peak_sanity_check(struct image *image, Crystal **crystals, extern void validate_peaks(struct image *image, double min_snr, int ir_inn, int ir_mid, int ir_out, - int use_saturated); + int use_saturated, int check_snr); extern int integrate_peak(struct image *image, int cfs, int css, double *pfs, double *pss, diff --git a/src/indexamajig.c b/src/indexamajig.c index 3f010b12..019d55a1 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -3,13 +3,13 @@ * * Index patterns, output hkl+intensity etc. * - * Copyright © 2012-2013 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * Copyright © 2012 Richard Kirian * Copyright © 2012 Lorenzo Galli * * Authors: - * 2010-2013 Thomas White + * 2010-2014 Thomas White * 2011 Richard Kirian * 2012 Lorenzo Galli * 2012 Chunhong Yoon @@ -121,6 +121,7 @@ static void show_help(const char *s) " Default: 100,000.\n" " --min-snr= Minimum signal-to-noise ratio for peaks.\n" " Default: 5.\n" +" --check-hdf5-snr Check SNR for peaks from --peaks=hdf5.\n" " --int-radius= Set the integration radii. Default: 4,5,7.\n" "-e, --image= Use this image from the HDF5 file.\n" " Example: /data/data0.\n" @@ -211,6 +212,7 @@ int main(int argc, char *argv[]) iargs.threshold = 800.0; iargs.min_gradient = 100000.0; iargs.min_snr = 5.0; + iargs.check_hdf5_snr = 0; iargs.det = NULL; iargs.peaks = PEAK_ZAEF; iargs.beam = NULL; @@ -251,18 +253,22 @@ int main(int argc, char *argv[]) /* Long-only options with no arguments */ {"filter-noise", 0, &iargs.noisefilter, 1}, - {"no-sat-corr", 0, &iargs.satcorr, 0}, - {"sat-corr", 0, &iargs.satcorr, 1}, {"no-check-prefix", 0, &config_checkprefix, 0}, - {"no-closer-peak", 0, &iargs.closer, 0}, {"closer-peak", 0, &iargs.closer, 1}, {"basename", 0, &config_basename, 1}, {"no-peaks-in-stream", 0, &iargs.stream_peaks, 0}, {"no-refls-in-stream", 0, &iargs.stream_refls, 0}, {"integrate-saturated",0, &integrate_saturated, 1}, - {"use-saturated", 0, &iargs.use_saturated, 1}, {"no-use-saturated", 0, &iargs.use_saturated, 0}, {"no-revalidate", 0, &iargs.no_revalidate, 1}, + {"check-hdf5-snr", 0, &iargs.check_hdf5_snr, 1}, + + /* Long-only options which don't actually do anything */ + {"no-sat-corr", 0, &iargs.satcorr, 0}, + {"sat-corr", 0, &iargs.satcorr, 1}, + {"no-closer-peak", 0, &iargs.closer, 0}, + {"no-check-hdf5-snr", 0, &iargs.check_hdf5_snr, 0}, + {"use-saturated", 0, &iargs.use_saturated, 1}, /* Long-only options with arguments */ {"peaks", 1, NULL, 2}, diff --git a/src/process_image.c b/src/process_image.c index d1e3a7de..9c4c740d 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -3,11 +3,11 @@ * * The processing pipeline for one image * - * Copyright © 2012-2013 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: - * 2010-2013 Thomas White + * 2010-2014 Thomas White * * This file is part of CrystFEL. * @@ -128,7 +128,8 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, if ( !iargs->no_revalidate ) { validate_peaks(&image, iargs->min_snr, iargs->ir_inn, iargs->ir_mid, - iargs->ir_out, iargs->use_saturated); + iargs->ir_out, iargs->use_saturated, + iargs->check_hdf5_snr); } break; diff --git a/src/process_image.h b/src/process_image.h index 90113ff9..20e6fe2e 100644 --- a/src/process_image.h +++ b/src/process_image.h @@ -55,6 +55,7 @@ struct index_args float threshold; float min_gradient; float min_snr; + int check_hdf5_snr; struct detector *det; IndexingMethod *indm; IndexingPrivate **ipriv; -- cgit v1.2.3