mailr25427 - /trunk/specific_analyses/relax_disp/estimate_r2eff.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by tlinnet on August 29, 2014 - 12:40:
Author: tlinnet
Date: Fri Aug 29 12:40:03 2014
New Revision: 25427

URL: http://svn.gna.org/viewcvs/relax?rev=25427&view=rev
Log:
Fix to weight properly according to if minimising with direct Jacobian or 
chi2 Jacobian.

task #7822(https://gna.org/task/index.php?7822): Implement user function to 
estimate R2eff and associated errors for exponential curve fitting.

Modified:
    trunk/specific_analyses/relax_disp/estimate_r2eff.py

Modified: trunk/specific_analyses/relax_disp/estimate_r2eff.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/estimate_r2eff.py?rev=25427&r1=25426&r2=25427&view=diff
==============================================================================
--- trunk/specific_analyses/relax_disp/estimate_r2eff.py        (original)
+++ trunk/specific_analyses/relax_disp/estimate_r2eff.py        Fri Aug 29 
12:40:03 2014
@@ -976,23 +976,23 @@
     r2eff, i0 = param_vector
 
     # Get the Jacobian.
-    if E.c_code:
-        # Calculate the direct exponential Jacobian matrix from C code.
-        jacobian_matrix_exp = transpose(asarray( jacobian(param_vector) ) )
-
-    else:
+    if E.c_code == True:
+        if E.chi2_jacobian:
+            # Calculate the direct exponential Jacobian matrix from C code.
+            jacobian_matrix_exp = transpose(asarray( jacobian(param_vector) 
) )
+
+            # The Jacobian in the C-code is from chi2 function, and is 
already weighted.
+            weights = ones(E.errors.shape)
+
+    elif E.c_code == False:
         if E.chi2_jacobian:
             # Use the chi2 Jacobian.
             jacobian_matrix_exp = func_exp_chi2_grad(params=param_vector, 
times=E.times, values=E.values, errors=E.errors)
+            weights = ones(E.errors.shape)
         else:
             # Use the direct Jacobian.
             jacobian_matrix_exp = func_exp_grad(params=param_vector, 
times=E.times, values=E.values, errors=E.errors)
-
-    # Get the co-variance
-    if E.chi2_jacobian:
-        weights = ones(E.errors.shape)
-    else:
-        weights = 1. / E.errors**2
+            weights = 1. / E.errors**2
 
     pcov = multifit_covar(J=jacobian_matrix_exp, weights=weights)
 




Related Messages


Powered by MHonArc, Updated Fri Aug 29 13:00:02 2014