mailr12528 - /branches/bmrb/generic_fns/bmrb.py


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

Header


Content

Posted by edward on February 15, 2011 - 18:11:
Author: bugman
Date: Tue Feb 15 18:11:21 2011
New Revision: 12528

URL: http://svn.gna.org/viewcvs/relax?rev=12528&view=rev
Log:
Simplification of the BMRB num_spins() function.


Modified:
    branches/bmrb/generic_fns/bmrb.py

Modified: branches/bmrb/generic_fns/bmrb.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/bmrb.py?rev=12528&r1=12527&r2=12528&view=diff
==============================================================================
--- branches/bmrb/generic_fns/bmrb.py (original)
+++ branches/bmrb/generic_fns/bmrb.py Tue Feb 15 18:11:21 2011
@@ -176,14 +176,15 @@
 
     # The number of spins.
     N = 0
-    if 'data_ids' in data.keys() and data['data_ids']:
-        N = len(data['data_ids'])
-    elif 'entity_ids' in data.keys() and data['entity_ids']:
-        N = len(data['entity_ids'])
-    elif 'res_nums' in data.keys() and data['res_nums']:
-        N = len(data['res_nums'])
-    elif 's2' in data.keys() and data['s2']:
-        N = len(data['s2'])
+
+    # List of keys containing sequence information.
+    keys = ['data_ids', 'entity_ids', 'res_names', 'res_nums', 's2']
+
+    # Loop over the keys until a list is found.
+    for key in keys:
+        if key in data.keys() and data[key]:
+            N = len(data[key])
+            break
 
     # Return the number.
     return N




Related Messages


Powered by MHonArc, Updated Wed Feb 16 15:40:02 2011