mailr27661 - /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 edward on February 17, 2015 - 16:27:
Author: bugman
Date: Tue Feb 17 16:27:20 2015
New Revision: 27661

URL: http://svn.gna.org/viewcvs/relax?rev=27661&view=rev
Log:
Added some error checking for the monte_carlo.setup user function.

A RelaxError is now raised if the number of simulations is less than 3.  This 
prevents Python errors
when later calling the monte_carlo.error_analysis user function.


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=27661&r1=27660&r2=27661&view=diff
==============================================================================
--- trunk/pipe_control/error_analysis.py        (original)
+++ trunk/pipe_control/error_analysis.py        Tue Feb 17 16:27:20 2015
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2004-2014 Edward d'Auvergne                                  
 #
+# Copyright (C) 2004-2015 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -362,18 +362,20 @@
 
 
 def monte_carlo_setup(number=None, all_select_sim=None):
-    """Function for setting up Monte Carlo simulations.
+    """Store the Monte Carlo simulation number.
 
     @keyword number:            The number of Monte Carlo simulations to set 
up.
     @type number:               int
-    @keyword all_select_sim:    The selection status of the Monte Carlo 
simulations.  The first
-                                dimension of this matrix corresponds to the 
simulation and the
-                                second corresponds to the instance.
+    @keyword all_select_sim:    The selection status of the Monte Carlo 
simulations.  The first dimension of this matrix corresponds to the 
simulation and the second corresponds to the instance.
     @type all_select_sim:       list of lists of bool
     """
 
     # Test if the current data pipe exists.
     check_pipe()
+
+    # Check the value.
+    if number < 3:
+        raise RelaxError("A minimum of 3 Monte Carlo simulations is 
required.")
 
     # Create a number of MC sim data structures.
     cdp.sim_number = number




Related Messages


Powered by MHonArc, Updated Tue Feb 17 17:00:03 2015