aboutsummaryrefslogtreecommitdiff
path: root/src/scaling.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-11-09 16:45:00 +0100
committerThomas White <taw@physics.org>2018-02-27 17:12:41 +0100
commit8681a51c2cd6dc3f6f112a0a2f6a413825f96671 (patch)
tree5731d7b718b1d5d11010abed1fdbaa21351352d1 /src/scaling.c
parent4764f7750362c6915a9b7d4191d71ae007d847b5 (diff)
Fix log scaling
Diffstat (limited to 'src/scaling.c')
-rw-r--r--src/scaling.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/scaling.c b/src/scaling.c
index c7c608fe..960233aa 100644
--- a/src/scaling.c
+++ b/src/scaling.c
@@ -65,9 +65,9 @@ static void apply_shift(Crystal *cr, int k, double shift)
break;
case GPARAM_OSF :
- t = crystal_get_osf(cr);
+ t = -log(crystal_get_osf(cr));
t += shift;
- crystal_set_osf(cr, t);
+ crystal_set_osf(cr, exp(-t));
break;
default :
@@ -272,7 +272,7 @@ double log_residual(Crystal *cr, const RefList *full, int free,
if ( I_full <= 0 ) continue; /* Because log */
if ( p <= 0.0 ) continue; /* Because of log */
- fx = G + log(p) - log(L) - B*s*s + log(I_full);
+ fx = -log(G) + log(p) - log(L) - B*s*s + log(I_full);
dc = log(I_partial) - fx;
w = 1.0;
dev += w*dc*dc;