Commit f588d275 authored by Thomas White's avatar Thomas White
Browse files

process_hkl: Add --min-measurements

parent ad8bcbff
......@@ -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
......
......@@ -74,6 +74,8 @@ static void show_help(const char *s)
" --reference=<file> Compare against intensities from <file> when\n"
" scaling. \n"
" --no-polarisation Disable polarisation correction.\n"
" --min-measurements=<n> Require at least <n> 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");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment