diff options
author | Thomas White <taw@physics.org> | 2012-07-03 17:54:44 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-07-03 17:54:44 +0200 |
commit | 6734aced8a8b2a94e707e9e243e02675bd4c8c76 (patch) | |
tree | 93e751ec18e511c3db5762a954715c5a943b00c6 /src | |
parent | e3f98fc792c71dd128378e82e41f1457245fa6b6 (diff) |
compare_hkl: Use separate denominators when calculating R-factors in shells
If there are large changes in intensity between shells, the R-factor should reflect it.
The old formulation did not have that property. Weak resolution shells would show up
with low R-factors because they contributed very little to the overall R-factor, but
the actual correspondence between intensities could still be very poor.
Diffstat (limited to 'src')
-rw-r--r-- | src/compare_hkl.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/compare_hkl.c b/src/compare_hkl.c index b1573d56..2f846087 100644 --- a/src/compare_hkl.c +++ b/src/compare_hkl.c @@ -107,7 +107,7 @@ static void plot_shells(RefList *list1, RefList *list2, double scale, Reflection *refl1; RefListIterator *iter; FILE *fh; - double den; + double den[NBINS]; int ctot, nout; if ( cell == NULL ) { @@ -117,6 +117,7 @@ static void plot_shells(RefList *list1, RefList *list2, double scale, for ( i=0; i<NBINS; i++ ) { num[i] = 0.0; + den[i] = 0.0; cts[i] = 0; measured[i] = 0; measurements[i] = 0; @@ -162,7 +163,7 @@ static void plot_shells(RefList *list1, RefList *list2, double scale, STATUS("Shell %i: %f to %f\n", NBINS-1, rmins[NBINS-1]/1e9, rmaxs[NBINS-1]/1e9); - den = 0.0; ctot = 0; nout = 0; + ctot = 0; nout = 0; for ( refl1 = first_refl(list1, &iter); refl1 != NULL; refl1 = next_refl(refl1, iter) ) @@ -202,18 +203,18 @@ static void plot_shells(RefList *list1, RefList *list2, double scale, switch ( config_shells ) { case R_SHELL_RSPLIT : - num[bin] += fabs(i1 - scale*i2); - den += i1 + scale*i2; + num[bin] += fabs(i1 - i2); + den[bin] += i1 + i2; break; case R_SHELL_R1I : num[bin] += fabs(i1 - scale*i2); - den += i1; + den[bin] += i1; break; case R_SHELL_R1F : num[bin] += fabs(f1 - scale*f2); - den += f1; + den[bin] += f1; break; default : break; @@ -263,12 +264,12 @@ static void plot_shells(RefList *list1, RefList *list2, double scale, switch ( config_shells ) { case R_SHELL_RSPLIT : - r = (2.0*(num[i]/den)*((double)ctot/cts[i]))/sqrt(2.0); + r = 2.0*(num[i]/den[i]) / sqrt(2.0); break; case R_SHELL_R1I : case R_SHELL_R1F : - r = (num[i]/den) * ((double)ctot/cts[i]); + r = num[i]/den[i]; break; default : |