aboutsummaryrefslogtreecommitdiff
path: root/src/hrs-scaling.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-09-29 16:48:53 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:38 +0100
commit9c0b4b7e7f7fb7f28d1db1a25dd37e63d6f5e6ee (patch)
treef5530c244910b2b9e2993e57233318ba4c56c130 /src/hrs-scaling.c
parentbe746a67595ab8f8a9bd5a95d9dded27566c780d (diff)
Revert "New scaling procedure"
This reverts commit 838a23c106786f5a1cee877533eee053c9f90282. Conflicts: src/hrs-scaling.c
Diffstat (limited to 'src/hrs-scaling.c')
-rw-r--r--src/hrs-scaling.c22
1 files changed, 12 insertions, 10 deletions
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);
}