mailr4893 - /branches/N_state_model/maths_fns/chi2.py


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

Header


Content

Posted by edward on January 28, 2008 - 14:15:
Author: bugman
Date: Mon Jan 28 14:15:18 2008
New Revision: 4893

URL: http://svn.gna.org/viewcvs/relax?rev=4893&view=rev
Log:
Bug fix for the change to the numpy.sum() function.

In Numeric the axis keyword argument defaults to 0.  In numpy it defaults to 
None!


Modified:
    branches/N_state_model/maths_fns/chi2.py

Modified: branches/N_state_model/maths_fns/chi2.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/maths_fns/chi2.py?rev=4893&r1=4892&r2=4893&view=diff
==============================================================================
--- branches/N_state_model/maths_fns/chi2.py (original)
+++ branches/N_state_model/maths_fns/chi2.py Mon Jan 28 14:15:18 2008
@@ -60,7 +60,7 @@
     """
 
     # Calculate the chi-squared statistic.
-    return sum((1.0 / errors * (data - back_calc_vals))**2)
+    return sum((1.0 / errors * (data - back_calc_vals))**2, axis=0)
 
 
 # Chi-squared gradient.
@@ -99,7 +99,7 @@
     """
 
     # Calculate the chi-squared gradient.
-    return -2.0 * sum(1.0 / (errors**2) * (data - back_calc_vals) * 
back_calc_grad)
+    return -2.0 * sum(1.0 / (errors**2) * (data - back_calc_vals) * 
back_calc_grad, axis=0)
 
 
 # Chi-squared Hessian.
@@ -144,8 +144,8 @@
     """
 
     # Calculate the chi-squared Hessian.
-    #return 2.0 * sum(1.0 / (errors**2) * (back_calc_grad_j * 
back_calc_grad_k - (data - back_calc_vals) * back_calc_hess))
-    #return 2.0 * sum((back_calc_grad_j * back_calc_grad_k - (data - 
back_calc_vals) * back_calc_hess) / errors**2)
+    #return 2.0 * sum(1.0 / (errors**2) * (back_calc_grad_j * 
back_calc_grad_k - (data - back_calc_vals) * back_calc_hess), axis=0)
+    #return 2.0 * sum((back_calc_grad_j * back_calc_grad_k - (data - 
back_calc_vals) * back_calc_hess) / errors**2, axis=0)
 
     # Calculate the chi-squared Hessian.
     # This is faster than the above sums, and having the errors term first 
appears to minimise roundoff errors.




Related Messages


Powered by MHonArc, Updated Mon Jan 28 16:40:15 2008