mailr12750 - /branches/relax_data/generic_fns/relax_data.py


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

Header


Content

Posted by edward on March 03, 2011 - 07:57:
Author: bugman
Date: Thu Mar  3 07:57:47 2011
New Revision: 12750

URL: http://svn.gna.org/viewcvs/relax?rev=12750&view=rev
Log:
Added checks for the relax_data user functions for the ri_type being one of 
'R1', 'R2', or 'NOE'.


Modified:
    branches/relax_data/generic_fns/relax_data.py

Modified: branches/relax_data/generic_fns/relax_data.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_data/generic_fns/relax_data.py?rev=12750&r1=12749&r2=12750&view=diff
==============================================================================
--- branches/relax_data/generic_fns/relax_data.py (original)
+++ branches/relax_data/generic_fns/relax_data.py Thu Mar  3 07:57:47 2011
@@ -44,6 +44,11 @@
 import specific_fns
 
 
+# The relaxation data types supported.
+VALID_TYPES = ['R1', 'R2', 'NOE']
+
+
+
 def back_calc(ri_id=None, ri_type=None, frq=None):
     """Back calculate the relaxation data.
 
@@ -64,6 +69,10 @@
     # Test if sequence data is loaded.
     if not exists_mol_res_spin_data():
         raise RelaxNoSequenceError
+
+    # Check if the type is valid.
+    if ri_type not in VALID_TYPES:
+        raise RelaxError("The relaxation data type '%s' must be one of %s." 
% (ri_type, VALID_TYPES))
 
     # Initialise the global data for the current pipe if necessary.
     if not hasattr(cdp, 'frq'):
@@ -712,6 +721,10 @@
     if hasattr(cdp, 'ri_ids') and ri_id in cdp.ri_ids:
         raise RelaxError("The relaxation ID string '%s' already exists." % 
ri_id)
 
+    # Check if the type is valid.
+    if ri_type not in VALID_TYPES:
+        raise RelaxError("The relaxation data type '%s' must be one of %s." 
% (ri_type, VALID_TYPES))
+
     # Loop over the file data to create the data structures for packing.
     values = []
     errors = []




Related Messages


Powered by MHonArc, Updated Thu Mar 03 08:00:02 2011