mailr27226 - /trunk/pipe_control/error_analysis.py


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

Header


Content

Posted by tlinnet on January 20, 2015 - 12:02:
Author: tlinnet
Date: Tue Jan 20 12:02:12 2015
New Revision: 27226

URL: http://svn.gna.org/viewcvs/relax?rev=27226&view=rev
Log:
In backend pipe_control.error_analysis.monte_carlo_create_data() added the 
argument 'fixed_error' to allow for fixed input of error to the gauss 
distribution.

Inserted a range of checks, to make sure function behaves as expected.

Task #7882 (https://gna.org/task/?7882): Implement Monte-Carlo simulation, 
where errors are generated with width of standard deviation or residuals.): 
Implement Monte-Carlo simulation, where errors are generated with width of 
standard deviation or residuals.

Modified:
    trunk/pipe_control/error_analysis.py

Modified: trunk/pipe_control/error_analysis.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/error_analysis.py?rev=27226&r1=27225&r2=27226&view=diff
==============================================================================
--- trunk/pipe_control/error_analysis.py        (original)
+++ trunk/pipe_control/error_analysis.py        Tue Jan 20 12:02:12 2015
@@ -72,13 +72,15 @@
             index = index + 1
 
 
-def monte_carlo_create_data(method=None, distribution=None):
+def monte_carlo_create_data(method=None, distribution=None, 
fixed_error=None):
     """Function for creating simulation data.
 
     @keyword method:        The type of Monte Carlo simulation to perform.
     @type method:           str
-    @keyword distribution:  Which gauss distribution to draw errors from.
+    @keyword distribution:  Which gauss distribution to draw errors from. 
Can be: 'measured', 'red_chi2', 'fixed'.
     @type distribution:     str
+    @keyword fixed_error:   If distribution is set to 'fixed', use this 
value as the standard deviation for the gauss distribution.
+    @type fixed_error:      float
     """
 
     # Test if the current data pipe exists.
@@ -94,9 +96,17 @@
         raise RelaxError("The simulation creation method " + repr(method) + 
" is not valid.")
 
     # Test the distribution argument.
-    valid_distributions = ['measured', 'red_chi2']
+    valid_distributions = ['measured', 'red_chi2', 'fixed']
     if distribution not in valid_distributions:
         raise RelaxError("The simulation error distribution method " + 
repr(distribution) + " is not valid.  Try one of the following: " + 
repr(valid_distributions))
+
+    # Test the fixed_error argument.
+    if fixed_error != None and distribution != 'fixed':
+        raise RelaxError("The argument 'fixed_error' is set to a value, but 
the argument 'distribution' is not set to 'fixed'.")
+
+    # Test the distribution argument, equal to 'fixed', but no error is set.
+    if distribution == 'fixed' and fixed_error == None:
+        raise RelaxError("The argument 'distribution' is set to 'fixed', but 
you have not provided a value to the argument 'fixed_error'.")
 
     # The specific analysis API object.
     api = return_api()




Related Messages


Powered by MHonArc, Updated Tue Jan 20 12:20:02 2015