From f588d275c68ceb92a4f23655bf69f14f3bec06c4 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 5 Dec 2012 16:28:50 +0100 Subject: process_hkl: Add --min-measurements --- doc/man/process_hkl.1 | 6 ++++++ src/process_hkl.c | 22 ++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/doc/man/process_hkl.1 b/doc/man/process_hkl.1 index eaf452c7..1b07dc04 100644 --- a/doc/man/process_hkl.1 +++ b/doc/man/process_hkl.1 @@ -104,6 +104,12 @@ all intensities. This is usually not useful. .PD Disable the polarisation correction. +.PD 0 +.IP \fB--min-measurements=\fR\fIn\fR +.PD +Include a reflection in the output only if it appears at least least \fIn\fR times. The default is \fB--min-measurements=2\fR. + + .SH CHOICE OF POINT GROUP FOR MERGING One of the main features of serial crystallography is that the orientations of diff --git a/src/process_hkl.c b/src/process_hkl.c index 8048cf45..cf690e9b 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -74,6 +74,8 @@ static void show_help(const char *s) " --reference= Compare against intensities from when\n" " scaling. \n" " --no-polarisation Disable polarisation correction.\n" +" --min-measurements= Require at least measurements before a\n" +" reflection appears in the output. Default: 2\n" ); } @@ -264,7 +266,7 @@ static void merge_all(FILE *fh, RefList *model, RefList *reference, int n_total_patterns, double *hist_vals, signed int hist_h, signed int hist_k, signed int hist_l, - int *hist_i, int config_nopolar) + int *hist_i, int config_nopolar, int min_measurements) { int rval; int n_patterns = 0; @@ -323,7 +325,7 @@ static void merge_all(FILE *fh, RefList *model, RefList *reference, int red; red = get_redundancy(refl); - if ( red == 1 ) { + if ( red < min_measurements ) { set_redundancy(refl, 0); continue; } @@ -365,6 +367,8 @@ int main(int argc, char *argv[]) int space_for_hist = 0; char *histo_params = NULL; int config_nopolar = 0; + char *rval; + int min_measurements = 2; /* Long options */ const struct option longopts[] = { @@ -382,6 +386,7 @@ int main(int argc, char *argv[]) {"symmetry", 1, NULL, 'y'}, {"histogram", 1, NULL, 'g'}, {"hist-parameters", 1, NULL, 'z'}, + {"min-measurements", 1, NULL, 2}, {0, 0, NULL, 0} }; @@ -423,6 +428,15 @@ int main(int argc, char *argv[]) histo_params = strdup(optarg); break; + case 2 : + errno = 0; + min_measurements = strtod(optarg, &rval); + if ( *rval != '\0' ) { + ERROR("Invalid value for --min-measurements.\n"); + return 1; + } + break; + case 0 : break; @@ -514,7 +528,7 @@ int main(int argc, char *argv[]) hist_i = 0; merge_all(fh, model, NULL, config_startafter, config_stopafter, sym, n_total_patterns, hist_vals, hist_h, hist_k, hist_l, - &hist_i, config_nopolar); + &hist_i, config_nopolar, min_measurements); if ( ferror(fh) ) { ERROR("Stream read error.\n"); return 1; @@ -538,7 +552,7 @@ int main(int argc, char *argv[]) config_startafter, config_stopafter, sym, n_total_patterns, hist_vals, hist_h, hist_k, hist_l, &hist_i, - config_nopolar); + config_nopolar, min_measurements); if ( ferror(fh) ) { ERROR("Stream read error.\n"); -- cgit v1.2.3