diff options
author | Thomas White <taw@physics.org> | 2018-08-30 16:50:28 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-08-30 17:18:54 +0200 |
commit | 2c649850385d4feba72e545b8cdd8364a9da187e (patch) | |
tree | d706d7d1f2b3be4f2a294658d36fff3558545a60 /src/rejection.c | |
parent | 8aa8564ecb48341aa44aa2b044797e95496dfaa9 (diff) |
Add Bessel correction
Diffstat (limited to 'src/rejection.c')
-rw-r--r-- | src/rejection.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rejection.c b/src/rejection.c index 46e7a2f2..cb3bede5 100644 --- a/src/rejection.c +++ b/src/rejection.c @@ -116,6 +116,7 @@ static double calculate_cchalf(RefList *template, RefList *full, double refl_sumsq = 0.0; double refl_mean, refl_var; signed int h, k, l; + double bcorr; Reflection *refl; get_indices(trefl, &h, &k, &l); @@ -142,7 +143,8 @@ static double calculate_cchalf(RefList *template, RefList *full, } refl_mean = refl_sum / c->n_contrib; - refl_var = refl_sumsq - refl_sum*refl_sum; + bcorr = c->n_contrib / (c->n_contrib - 1); + refl_var = (refl_sumsq - refl_sum*refl_sum)*bcorr; all_sum_mean += refl_mean; all_sumsq_mean += refl_mean*refl_mean; @@ -152,7 +154,7 @@ static double calculate_cchalf(RefList *template, RefList *full, } sig2E = all_sum_var / n; - sig2Y = all_sumsq_mean - all_sum_mean*all_sum_mean; + sig2Y = (all_sumsq_mean - all_sum_mean*all_sum_mean)*n/(n-1); return (sig2Y - 0.5*sig2E) / (sig2Y + 0.5*sig2E); } |