From 1d6fdfc003f46ea5cf618459d215a032390afc15 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 8 Apr 2014 17:03:00 +0200 Subject: process_hkl: Add --min-res --- src/process_hkl.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src/process_hkl.c') diff --git a/src/process_hkl.c b/src/process_hkl.c index c9e2c44a..54d0c8b4 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -82,6 +82,7 @@ static void show_help(const char *s) " --min-snr= Require individual intensity measurements to\n" " have I > n * sigma(I). Default: -infinity.\n" " --max-adu= Maximum peak value. Default: infinity.\n" +" --min-res= Merge only crystals which diffract above A.\n" ); } @@ -308,7 +309,7 @@ static int merge_all(Stream *st, RefList *model, RefList *reference, signed int hist_k, signed int hist_l, int *hist_i, int config_nopolar, int min_measurements, double min_snr, double max_adu, - int start_after, int stop_after) + int start_after, int stop_after, double min_res) { int rval; int n_images = 0; @@ -339,6 +340,10 @@ static int merge_all(Stream *st, RefList *model, RefList *reference, n_crystals_seen++; if ( n_crystals_seen <= start_after ) continue; + if ( crystal_get_resolution_limit(cr) < min_res ) { + continue; + } + n_crystals++; r = merge_crystal(model, &image, cr, reference, sym, hist_vals, hist_h, hist_k, hist_l, @@ -414,6 +419,7 @@ int main(int argc, char *argv[]) int stop_after = 0; double min_snr = -INFINITY; double max_adu = +INFINITY; + double min_res = 0.0; /* Long options */ const struct option longopts[] = { @@ -434,6 +440,7 @@ int main(int argc, char *argv[]) {"min-measurements", 1, NULL, 2}, {"min-snr", 1, NULL, 3}, {"max-adu", 1, NULL, 4}, + {"min-res", 1, NULL, 5}, {0, 0, NULL, 0} }; @@ -516,6 +523,16 @@ int main(int argc, char *argv[]) } break; + case 5 : + errno = 0; + min_res = strtod(optarg, &rval); + if ( *rval != '\0' ) { + ERROR("Invalid value for --min-res.\n"); + return 1; + } + min_res = 1e10/min_res; + break; + case '?' : break; @@ -597,7 +614,7 @@ int main(int argc, char *argv[]) hist_i = 0; r = merge_all(st, model, NULL, sym, &hist_vals, hist_h, hist_k, hist_l, &hist_i, config_nopolar, min_measurements, min_snr, - max_adu, start_after, stop_after); + max_adu, start_after, stop_after, min_res); fprintf(stderr, "\n"); if ( r ) { ERROR("Error while reading stream.\n"); @@ -629,7 +646,7 @@ int main(int argc, char *argv[]) r = merge_all(st, model, reference, sym, &hist_vals, hist_h, hist_k, hist_l, &hist_i, config_nopolar, min_measurements, min_snr, - max_adu, start_after, stop_after); + max_adu, start_after, stop_after, min_res); fprintf(stderr, "\n"); if ( r ) { ERROR("Error while reading stream.\n"); -- cgit v1.2.3