From 2e101d99268b467c1ab900121c4fba3bbab6f4b1 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 5 Jun 2019 11:15:18 +0200 Subject: Allow correct_reflection() to correct anything, not just intensities --- src/merge.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/merge.c') 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; -- cgit v1.2.3