aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-11-17 14:35:50 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:06 +0100
commite2ff3965b0f43e3750d13e375d7a1dae72ac90ff (patch)
tree3cd95fea41bd3fe8eae797f6ff3a511ec186c40a
parent2f942f0a3096242ce5623cf5aae8d33253766bad (diff)
Fix stability of SNRs
-rw-r--r--src/check_hkl.c2
-rw-r--r--src/process_hkl.c9
2 files changed, 8 insertions, 3 deletions
diff --git a/src/check_hkl.c b/src/check_hkl.c
index 650895ec..bf2a0ba1 100644
--- a/src/check_hkl.c
+++ b/src/check_hkl.c
@@ -243,6 +243,8 @@ static void plot_shells(const double *ref, ReflItemList *items, UnitCell *cell,
continue;
}
+ if ( !isfinite(val/esd) ) continue;
+
/* measured[bin] was done earlier */
measurements[bin] += lookup_count(counts, h, k, l);
snr[bin] += val / esd;
diff --git a/src/process_hkl.c b/src/process_hkl.c
index b1fcad51..162b0bd6 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -813,9 +813,12 @@ int main(int argc, char *argv[])
dev = lookup_intensity(devs, h, k, l);
count = lookup_count(counts, h, k, l);
- if ( count < 2 ) continue;
-
- esd = sqrt(dev) / (double)count;
+ if ( count < 2 ) {
+ /* If we have only one measurement, the error is 100% */
+ esd = lookup_intensity(model, h, k, l);
+ } else {
+ esd = sqrt(dev) / (double)count;
+ }
set_intensity(esds, h, k, l, esd);
}