mailr5255 - /1.3/generic_fns/monte_carlo.py


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

Header


Content

Posted by edward on April 03, 2008 - 10:50:
Author: bugman
Date: Thu Apr  3 10:31:42 2008
New Revision: 5255

URL: http://svn.gna.org/viewcvs/relax?rev=5255&view=rev
Log:
Another fix for bug #11004 (https://gna.org/bugs/?11004).

This actually isn't a new bug as suggested in the emails (see the bug report 
for links).  It is the
same division by zero problem as was fixed in r5117 (1.3 line) and r5119 (1.2 
line), just a few
lines down.


Modified:
    1.3/generic_fns/monte_carlo.py

Modified: 1.3/generic_fns/monte_carlo.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/monte_carlo.py?rev=5255&r1=5254&r2=5255&view=diff
==============================================================================
--- 1.3/generic_fns/monte_carlo.py (original)
+++ 1.3/generic_fns/monte_carlo.py Thu Apr  3 10:31:42 2008
@@ -227,7 +227,7 @@
 
                     # Calculate the mean parameter value for all simulations.
                     if n == 0:
-                        Xav = 0
+                        Xav = 0.0
                     else:
                         Xav = Xsum / float(n)
 
@@ -246,7 +246,10 @@
                         sd = sd + (param_array[i] - Xav)**2
 
                     # Calculate the standard deviation.
-                    sd = sqrt(sd / (float(n) - 1.0))
+                    if n <= 1:
+                        sd = 0.0
+                    else:
+                        sd = sqrt(sd / (float(n) - 1.0))
 
                 # Simulation parameters with the value None.
                 else:




Related Messages


Powered by MHonArc, Updated Thu Apr 03 12:40:11 2008