aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-07-12 10:07:38 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:53 +0100
commita49936db5639852019ae3da23d0e5ee13a7315c2 (patch)
tree2f2cfc6abb85302ec89dfc90fb381ad08fa16217
parentc48d6819dfadba232b077eca794e60de20bc387c (diff)
compare_hkl: Improve bookkeeping
-rw-r--r--src/compare_hkl.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index 0dffd3a0..e6caee6f 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -55,6 +55,7 @@ int main(int argc, char *argv[])
unsigned int *c2;
int i;
int nc1, nc2, ncom;
+ unsigned int *outcounts;
/* Long options */
const struct option longopts[] = {
@@ -106,6 +107,7 @@ int main(int argc, char *argv[])
return 1;
}
out = new_list_intensity();
+ outcounts = new_list_count();
/* Knock out the zero beam, in case it's present */
set_count(c1, 0, 0, 0, 0);
@@ -120,12 +122,20 @@ int main(int argc, char *argv[])
for ( l=-INDMAX; l<INDMAX; l++ ) {
double i1, i2;
+ unsigned int c1s, c2s;
+
+ c1s = lookup_count(c1, h, k, l);
+ c2s = lookup_count(c2, h, k, l);
i1 = lookup_intensity(ref1, h, k, l);
i2 = lookup_intensity(ref2, h, k, l);
- if ( (i1 != 0.0) && (i2 != 0.0) ) {
- set_intensity(out, h, k, l, i1/i2);
+ if ( c1s && c2s ) {
+ if ( (i1 != 0.0) && (i2 != 0.0) ) {
+ set_intensity(out, h, k, l,
+ (i1/(double)c1s)/i2/(double)c2s);
+ set_count(outcounts, h, k, l, 1);
+ }
}
}
@@ -149,7 +159,7 @@ int main(int argc, char *argv[])
STATUS("Pearson r = %5.4f\n", pearson);
if ( outfile != NULL ) {
- write_reflections(outfile, NULL, out, NULL, 1, cell, 1);
+ write_reflections(outfile, outcounts, out, NULL, 0, cell, 1);
}
return 0;