mailr25820 - /branches/frame_order_cleanup/specific_analyses/frame_order/checks.py


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

Header


Content

Posted by edward on September 14, 2014 - 12:56:
Author: bugman
Date: Sun Sep 14 12:56:20 2014
New Revision: 25820

URL: http://svn.gna.org/viewcvs/relax?rev=25820&view=rev
Log:
Created the check_model() function for the frame order analysis.

This is in the specific_analyses.frame_order.checks module.  The function 
checks that the frame
order model has been selected via the frame_order.select_model user function.


Modified:
    branches/frame_order_cleanup/specific_analyses/frame_order/checks.py

Modified: branches/frame_order_cleanup/specific_analyses/frame_order/checks.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/checks.py?rev=25820&r1=25819&r2=25820&view=diff
==============================================================================
--- branches/frame_order_cleanup/specific_analyses/frame_order/checks.py      
  (original)
+++ branches/frame_order_cleanup/specific_analyses/frame_order/checks.py      
  Sun Sep 14 12:56:20 2014
@@ -35,8 +35,9 @@
     """Check if the domain has been defined.
 
     @keyword domain:        The domain to check for.  If None, then the 
check will be for any domain being defined.
+    @type domain:           None or str
     @keyword escalate:      The feedback to give if the domain is not 
defined.  This can be 0 for no printouts, 1 to throw a RelaxWarning, or 2 to 
raise a RelaxError.
-    @type escalate:         None or str
+    @type escalate:         int
     @raises RelaxError:     If escalate is set to 2 and the domain is not 
defined.
     @return:                True if the domain is defined, False otherwise.
     @rtype:                 bool
@@ -63,6 +64,34 @@
     return defined
 
 
+def check_model(escalate=0):
+    """Check if the frame order model has been set up.
+
+    @keyword escalate:      The feedback to give if the model is not set up. 
 This can be 0 for no printouts, 1 to throw a RelaxWarning, or 2 to raise a 
RelaxError.
+    @type escalate:         int
+    @raises RelaxError:     If escalate is set to 2 and the model is not set 
up.
+    @return:                True if the model is set up, False otherwise.
+    @rtype:                 bool
+    """
+
+    # Init.
+    flag = True
+
+    # Check that the model is set up.
+    if not hasattr(cdp, 'model'):
+        flag = False
+        msg = "The frame order model has not been set up, please use the 
frame_order.select_model user function."
+
+    # Warnings and errors.
+    if escalate == 1:
+        warn(RelaxWarning(msg))
+    elif escalate == 2:
+        raise RelaxError(msg)
+
+    # Return the answer.
+    return flag
+
+
 def check_pivot(pipe_name=None):
     """Check that the pivot point has been set.
 




Related Messages


Powered by MHonArc, Updated Sun Sep 14 13:00:03 2014