diff options
author | Thomas White <taw@bitwiz.org.uk> | 2010-10-14 01:14:29 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:03 +0100 |
commit | 67d8cf120ba7e8140449379d0153cef93795c813 (patch) | |
tree | 24bba9a620a3e91b1ea882e11be2b88a9145930a /src/statistics.c | |
parent | e9803e863335882f161295af184d91ebd5e9e02c (diff) |
compare_hkl: Add Rinternal(I)
Diffstat (limited to 'src/statistics.c')
-rw-r--r-- | src/statistics.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/statistics.c b/src/statistics.c index 78b3f13e..d0d3ae85 100644 --- a/src/statistics.c +++ b/src/statistics.c @@ -38,6 +38,7 @@ enum { R_1_I, R_DIFF_ZERO, R_DIFF_IGNORE, + R_DIFF_INTENSITY, }; @@ -232,6 +233,35 @@ static double internal_r_i(const double *ref1, const double *ref2, } +static double internal_rdiff_intensity(const double *ref1, const double *ref2, + ReflItemList *items, double scale) +{ + double top = 0.0; + double bot = 0.0; + int i; + + for ( i=0; i<num_items(items); i++ ) { + + double i1, i2; + struct refl_item *it; + signed int h, k, l; + + it = get_item(items, i); + h = it->h; k = it->k; l = it->l; + + i1 = lookup_intensity(ref1, h, k, l); + i2 = lookup_intensity(ref2, h, k, l); + i2 *= scale; + + top += fabs(i1 - i2); + bot += i1 + i2; + + } + + return 2.0*top/bot; +} + + static double internal_rdiff_negstozero(const double *ref1, const double *ref2, ReflItemList *items, double scale) { @@ -319,6 +349,9 @@ static double calc_r(double scale, void *params) case R_DIFF_IGNORE : return internal_rdiff_ignorenegs(rp->ref1, rp->ref2, rp->items, scale); + case R_DIFF_INTENSITY : + return internal_rdiff_intensity(rp->ref1, rp->ref2, + rp->items, scale); } ERROR("No such FoM!\n"); @@ -356,6 +389,7 @@ static double r_minimised(const double *ref1, const double *ref2, break; case R_2 : case R_1_I : + case R_DIFF_INTENSITY : scale = stat_scale_intensity(ref1, ref2, items); break; } @@ -437,6 +471,12 @@ double stat_rdiff_ignore(const double *ref1, const double *ref2, } +double stat_rdiff_intensity(const double *ref1, const double *ref2, + ReflItemList *items, double *scalep) +{ + return r_minimised(ref1, ref2, items, scalep, R_DIFF_INTENSITY); +} + double stat_pearson_i(const double *ref1, const double *ref2, ReflItemList *items) { |