aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-07-01 19:02:09 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:52 +0100
commit87d72e34a321aa53ad4e89f90058d5867cbd3261 (patch)
tree175ac7382109beb3a6c1888e6e33944dbbb8ea4f /src
parent588d243654d81e13aaee0e04ae4d9cce66acea38 (diff)
compare_hkl: Take counts into account
Diffstat (limited to 'src')
-rw-r--r--src/compare_hkl.c4
-rw-r--r--src/reflections.c13
-rw-r--r--src/reflections.h2
3 files changed, 19 insertions, 0 deletions
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index b80546c8..4c17fda3 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -110,6 +110,10 @@ int main(int argc, char *argv[])
set_count(c1, 0, 0, 0, 0);
set_count(c2, 0, 0, 0, 0);
+ /* Divide by number of counts, since we're not interested in them */
+ divide_down(ref1, c1);
+ divide_down(ref2, c2);
+
for ( h=-INDMAX; h<INDMAX; h++ ) {
for ( k=-INDMAX; k<INDMAX; k++ ) {
for ( l=-INDMAX; l<INDMAX; l++ ) {
diff --git a/src/reflections.c b/src/reflections.c
index 2711936b..e93433d6 100644
--- a/src/reflections.c
+++ b/src/reflections.c
@@ -166,3 +166,16 @@ double *ideal_intensities(double complex *sfac)
return ref;
}
+
+
+void divide_down(double *intensities, unsigned int *counts)
+{
+ int i;
+
+ for ( i=0; i<IDIM*IDIM*IDIM; i++ ) {
+ if ( counts[i] > 0 ) {
+ intensities[i] /= (double)counts[i];
+ counts[i] = 1;
+ }
+ }
+}
diff --git a/src/reflections.h b/src/reflections.h
index 060a32c8..84946f1a 100644
--- a/src/reflections.h
+++ b/src/reflections.h
@@ -29,5 +29,7 @@ extern double *read_reflections(const char *filename, unsigned int *counts,
extern double *ideal_intensities(double complex *sfac);
+extern void divide_down(double *intensities, unsigned int *counts);
+
#endif /* REFLECTIONS_H */