From 9c0b4b7e7f7fb7f28d1db1a25dd37e63d6f5e6ee Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 29 Sep 2011 16:48:53 +0200 Subject: Revert "New scaling procedure" This reverts commit 838a23c106786f5a1cee877533eee053c9f90282. Conflicts: src/hrs-scaling.c --- src/hrs-scaling.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/hrs-scaling.c b/src/hrs-scaling.c index fb0a813e..1c46effe 100644 --- a/src/hrs-scaling.c +++ b/src/hrs-scaling.c @@ -52,8 +52,7 @@ static double iterate_scale(struct image *images, int n, RefList *reference) RefListIterator *iter; double num = 0.0; double den = 0.0; - double new_sf; - double corr = 0.0; + double corr; if ( image->pr_dud ) continue; @@ -62,7 +61,7 @@ static double iterate_scale(struct image *images, int n, RefList *reference) refl = next_refl(refl, iter) ) { signed int h, k, l; - double Ih, Ihl; + double Ih, Ihl, esd; Reflection *r; if ( !get_scalable(refl) ) continue; @@ -81,18 +80,21 @@ static double iterate_scale(struct image *images, int n, RefList *reference) } Ihl = get_intensity(refl) / get_partiality(refl); + esd = get_esd_intensity(refl) / get_partiality(refl); - num += Ih * Ihl; - den += Ih * Ih; + num += Ih * (Ihl/image->osf) / pow(esd/image->osf, 2.0); + den += pow(Ih, 2.0)/pow(esd/image->osf, 2.0); } - new_sf = num / den; - if ( !isnan(new_sf) && !isinf(new_sf) ) { - corr = fabs(image->osf - new_sf); - image->osf = new_sf; + //num += image->osf / pow(SCALING_RESTRAINT, 2.0); + //den += pow(image->osf, 2.0)/pow(SCALING_RESTRAINT, 2.0); + + corr = num / den; + if ( !isnan(corr) && !isinf(corr) ) { + image->osf *= corr; } - if ( corr > max_shift ) max_shift = corr; + if ( fabs(corr-1.0) > max_shift ) max_shift = fabs(corr-1.0); } -- cgit v1.2.3