diff options
author | Thomas White <taw@physics.org> | 2014-04-08 17:03:00 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-04-08 17:08:53 +0200 |
commit | 1d6fdfc003f46ea5cf618459d215a032390afc15 (patch) | |
tree | 104745e8ef17bf9c022ed7512e73f2537adc4205 | |
parent | 54176de692b7709e1148904089229f09758436f1 (diff) |
process_hkl: Add --min-res
-rw-r--r-- | doc/man/process_hkl.1 | 5 | ||||
-rw-r--r-- | libcrystfel/src/stream.c | 7 | ||||
-rw-r--r-- | src/process_hkl.c | 23 |
3 files changed, 31 insertions, 4 deletions
diff --git a/doc/man/process_hkl.1 b/doc/man/process_hkl.1 index e4a3dd8f..6aeaa2a8 100644 --- a/doc/man/process_hkl.1 +++ b/doc/man/process_hkl.1 @@ -114,6 +114,11 @@ Use a particular individual reflection intensity measurement only if it exceeds .PD Include reflections only if their peak values were less than \fIn\fR. That means, \fIn\fR is the saturation value of the detector. The default is infinity, i.e. no cutoff. +.PD 0 +.IP \fB--min-res=\fR\fIn\fR +.PD +Merge crystals only if they diffract to beyond \fIn\fR Angstroms resolution. The default is zero, i.e. no cutoff. The resolution is taken from the diffraction_resolution_limit line in the stream. + .SH CHOICE OF POINT GROUP FOR MERGING diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index 7860209f..09bb1631 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -500,7 +500,7 @@ void read_crystal(Stream *st, struct image *image) do { - float u, v, w; + float u, v, w, lim; char c; rval = fgets(line, 1023, st->fh); @@ -556,6 +556,11 @@ void read_crystal(Stream *st, struct image *image) crystal_set_num_saturated_reflections(cr, n); } + if ( sscanf(line, "diffraction_resolution_limit = %f nm^-1", + &lim) == 1 ) { + crystal_set_resolution_limit(cr, lim*1e9); + } + if ( strcmp(line, REFLECTION_START_MARKER) == 0 ) { RefList *reflist; 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=<n> Require individual intensity measurements to\n" " have I > n * sigma(I). Default: -infinity.\n" " --max-adu=<n> Maximum peak value. Default: infinity.\n" +" --min-res=<n> Merge only crystals which diffract above <n> 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"); |