From 757b17f432be24c47fed65a2dd569fc153535ff7 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 16 Nov 2010 16:03:49 +0100 Subject: check_hkl: Show mean and variance --- src/check_hkl.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/check_hkl.c b/src/check_hkl.c index 78e97a3d..650895ec 100644 --- a/src/check_hkl.c +++ b/src/check_hkl.c @@ -179,7 +179,7 @@ static void plot_shells(const double *ref, ReflItemList *items, UnitCell *cell, } free(counted); - /* Characterise the data set */ + /* Calculate means */ for ( i=0; ih; k = it->k; l = it->l; + + d = resolution(cell, h, k, l) * 2.0; + val = lookup_intensity(ref, h, k, l); + esd = lookup_intensity(sigma, h, k, l); + + bin = -1; + for ( j=0; jrmins[j]) && (d<=rmaxs[j]) ) { + bin = j; + break; + } + } + if ( bin == -1 ) { + nout++; + continue; + } + + /* measured[bin] was done earlier */ measurements[bin] += lookup_count(counts, h, k, l); - snr[bin] += (lookup_intensity(ref1, h, k, l) / - lookup_intensity(sigma, h, k, l)); - snr_total += (lookup_intensity(ref1, h, k, l) / - lookup_intensity(sigma, h, k, l)); + snr[bin] += val / esd; + snr_total += val / esd; nmeas++; nmeastot += lookup_count(counts, h, k, l); + var[bin] += pow(val-mean[bin], 2.0); + } STATUS("overall = %f\n", snr_total/(double)nmeas); STATUS("%i measurements in total.\n", nmeastot); @@ -224,15 +262,22 @@ static void plot_shells(const double *ref, ReflItemList *items, UnitCell *cell, nout); } + fprintf(fh, "1/d centre # refs Possible Compl " + "Meas Red SNR Std dev Mean\n"); for ( i=0; i