From b925bc42dd86073b06dc5f8146ad1babc27741ef Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 10 Apr 2010 18:22:21 +0100 Subject: process_hkl: Minimum ten counts before writing a reflection --- src/compare_hkl.c | 2 +- src/get_hkl.c | 2 +- src/process_hkl.c | 6 +++--- src/reflections.c | 5 +++-- src/reflections.h | 3 ++- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/compare_hkl.c b/src/compare_hkl.c index bc224195..bb07d17e 100644 --- a/src/compare_hkl.c +++ b/src/compare_hkl.c @@ -149,7 +149,7 @@ int main(int argc, char *argv[]) STATUS("R2 = %5.4f %% (scale=%5.2f)\n", R*100.0, scale); if ( outfile != NULL ) { - write_reflections(outfile, NULL, out, 1, cell); + write_reflections(outfile, NULL, out, 1, cell, 1); } return 0; diff --git a/src/get_hkl.c b/src/get_hkl.c index 1b69199f..ae279a8e 100644 --- a/src/get_hkl.c +++ b/src/get_hkl.c @@ -230,7 +230,7 @@ int main(int argc, char *argv[]) } - write_reflections(output, counts, ideal_ref, config_za, mol->cell); + write_reflections(output, counts, ideal_ref, config_za, mol->cell, 1); return 0; } diff --git a/src/process_hkl.c b/src/process_hkl.c index 78c6b1fc..4982961d 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -168,7 +168,7 @@ static void process_reflections(double *ref, double *trueref, if ( do_zoneaxis ) { char name[64]; snprintf(name, 63, "ZA-%u.dat", n_patterns); - write_reflections(name, counts, ref, 1, cell); + write_reflections(name, counts, ref, 1, cell, 1); } fh = fopen("results/convergence.dat", "a"); @@ -346,13 +346,13 @@ int main(int argc, char *argv[]) } if ( output != NULL ) { - write_reflections(output, counts, ref, 0, cell); + write_reflections(output, counts, ref, 0, cell, 1); } if ( config_zoneaxis ) { char name[64]; snprintf(name, 63, "ZA-%u.dat", n_patterns); - write_reflections(name, counts, ref, 1, cell); + write_reflections(name, counts, ref, 1, cell, 10); } STATUS("There were %u patterns.\n", n_patterns); diff --git a/src/reflections.c b/src/reflections.c index c943d014..b49b4a15 100644 --- a/src/reflections.c +++ b/src/reflections.c @@ -22,7 +22,8 @@ void write_reflections(const char *filename, unsigned int *counts, - double *ref, int zone_axis, UnitCell *cell) + double *ref, int zone_axis, UnitCell *cell, + unsigned int min_counts) { FILE *fh; signed int h, k, l; @@ -59,7 +60,7 @@ void write_reflections(const char *filename, unsigned int *counts, if ( counts ) { N = lookup_count(counts, h, k, l); - if ( N == 0 ) continue; + if ( N < min_counts ) continue; } else { N = 1; } diff --git a/src/reflections.h b/src/reflections.h index 8c513a64..052ddf9f 100644 --- a/src/reflections.h +++ b/src/reflections.h @@ -21,7 +21,8 @@ extern void write_reflections(const char *filename, unsigned int *counts, - double *ref, int zone_axis, UnitCell *cell); + double *ref, int zone_axis, UnitCell *cell, + unsigned int min_counts); extern double *read_reflections(const char *filename, unsigned int *counts); -- cgit v1.2.3