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()


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@gna.org

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

Reply via email to