mailr19496 - /trunk/pipe_control/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 19, 2013 - 20:08:
Author: bugman
Date: Fri Apr 19 20:08:05 2013
New Revision: 19496

URL: http://svn.gna.org/viewcvs/relax?rev=19496&view=rev
Log:
The Monte Carlo error_analysis() function now handles dictionary type 
parameters.


Modified:
    trunk/pipe_control/monte_carlo.py

Modified: trunk/pipe_control/monte_carlo.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/monte_carlo.py?rev=19496&r1=19495&r2=19496&view=diff
==============================================================================
--- trunk/pipe_control/monte_carlo.py (original)
+++ trunk/pipe_control/monte_carlo.py Fri Apr 19 20:08:05 2013
@@ -156,8 +156,23 @@
             if param_array == None:
                 break
 
-            # SD of simulation parameters with values (ie not None).
-            if param_array[0] != None:
+            # Handle dictionary type parameters.
+            if isinstance(param_array[0], dict):
+                # Initialise the standard deviation structure as a 
dictionary.
+                sd = {}
+
+                # Loop over each key.
+                for key in param_array[0].keys():
+                    # Create a list of the values for the current key.
+                    data = []
+                    for i in range(len(param_array)):
+                        data.append(param_array[i][key])
+
+                    # Calculate and store the SD.
+                    sd[key] = stats.std(values=data, skip=select_sim)
+
+             # SD of simulation parameters with values (ie not None).
+            elif param_array[0] != None:
                 sd = stats.std(values=param_array, skip=select_sim)
 
             # Simulation parameters with the value None.




Related Messages


Powered by MHonArc, Updated Fri Apr 19 20:20:06 2013