diff options
author | Thomas White <taw@physics.org> | 2019-06-05 11:15:18 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2019-07-17 09:18:11 +0200 |
commit | 2e101d99268b467c1ab900121c4fba3bbab6f4b1 (patch) | |
tree | 8422bc6f9b5cdc65c6585b810455132ba5aa837d /src/merge.c | |
parent | 62a4a8aab77be29c07edee7f3ea60847379106bc (diff) |
Allow correct_reflection() to correct anything, not just intensities
Diffstat (limited to 'src/merge.c')
-rw-r--r-- | src/merge.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/merge.c b/src/merge.c index 1ca3ccda..a2a49ccf 100644 --- a/src/merge.c +++ b/src/merge.c @@ -223,9 +223,9 @@ static void run_merge_job(void *vwargs, int cookie) /* Running mean and variance calculation */ temp = w + sumweight; if ( ln_merge ) { - delta = log(correct_reflection(refl, G, B, res)) - mean; + delta = log(correct_reflection(get_intensity(refl), refl, G, B, res)) - mean; } else { - delta = correct_reflection(refl, G, B, res) - mean; + delta = correct_reflection(get_intensity(refl), refl, G, B, res) - mean; } R = delta * w / temp; set_intensity(f, mean + R); @@ -343,21 +343,22 @@ RefList *merge_intensities(Crystal **crystals, int n, int n_threads, } -/* Correct intensity in pattern for scaling and Lorentz factors, - * but not partiality nor polarisation */ -double correct_reflection_nopart(Reflection *refl, double osf, double Bfac, - double res) +/* Correct 'val' (probably an intensity from one pattern, maybe an e.s.d.) + * for scaling and Lorentz factors but not partiality nor polarisation */ +double correct_reflection_nopart(double val, Reflection *refl, double osf, + double Bfac, double res) { double corr = osf * exp(-Bfac*res*res); - return (get_intensity(refl) / corr) / get_lorentz(refl); + return (val / corr) / get_lorentz(refl); } -/* Correct intensity in pattern for scaling, partiality and Lorentz factors, - * but not polarisation */ -double correct_reflection(Reflection *refl, double osf, double Bfac, double res) +/* Correct 'val' (probably an intensity from one pattern, maybe an e.s.d.) + * for scaling, partiality and Lorentz factors but not polarisation */ +double correct_reflection(double val, Reflection *refl, double osf, double Bfac, + double res) { - double Ipart = correct_reflection_nopart(refl, osf, Bfac, res); + double Ipart = correct_reflection_nopart(val, refl, osf, Bfac, res); return Ipart / get_partiality(refl); } @@ -394,7 +395,7 @@ double residual(Crystal *cr, const RefList *full, int free, if ( get_redundancy(match) < 2 ) continue; - int1 = correct_reflection_nopart(refl, G, B, res); + int1 = correct_reflection_nopart(get_intensity(refl), refl, G, B, res); int2 = get_partiality(refl)*I_full; w = 1.0; |