mailr18791 - /trunk/generic_fns/structure/statistics.py


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

Header


Content

Posted by edward on March 12, 2013 - 11:21:
Author: bugman
Date: Tue Mar 12 11:21:25 2013
New Revision: 18791

URL: http://svn.gna.org/viewcvs/relax?rev=18791&view=rev
Log:
Bug fix for the structure RMSD function for when old numpy versions are 
present.

Older numpy versions do not have the ddof argument for the std() standard 
deviation function,
therefore relax now catches this, calculates the biased standard deviation 
formula, and then
multiplies the value by a correction factor to obtain the non-biased 
estimator.


Modified:
    trunk/generic_fns/structure/statistics.py

Modified: trunk/generic_fns/structure/statistics.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/generic_fns/structure/statistics.py?rev=18791&r1=18790&r2=18791&view=diff
==============================================================================
--- trunk/generic_fns/structure/statistics.py (original)
+++ trunk/generic_fns/structure/statistics.py Tue Mar 12 11:21:25 2013
@@ -65,9 +65,18 @@
         if verbosity:
             print("Model %2s RMSD:  %s" % (i, model_rmsd[i]))
 
-    # Calculate the mean and standard deviation.
+    # Calculate the mean.
     rmsd_mean = mean(model_rmsd)
-    rmsd_sd = std(model_rmsd, ddof=1)
+
+    # Calculate the normal non-biased standard deviation.
+    try:
+        rmsd_sd = std(model_rmsd, ddof=1)
+
+    # Handle old numpy versions not having the ddof argument.
+    except TypeError:
+        rmsd_sd = std(model_rmsd) * sqrt(M / (M - 1.0))
+
+    # Printout.
     if verbosity:
         print("\nGlobal RMSD:  %s +/- %s" % (rmsd_mean, rmsd_sd))
 




Related Messages


Powered by MHonArc, Updated Tue Mar 12 12:00:02 2013