mailr3852 - /1.3/generic_fns/selection.py


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

Header


Content

Posted by edward on November 23, 2007 - 15:48:
Author: bugman
Date: Fri Nov 23 15:48:05 2007
New Revision: 3852

URL: http://svn.gna.org/viewcvs/relax?rev=3852&view=rev
Log:
Wrote the count_spins() function.


Modified:
    1.3/generic_fns/selection.py

Modified: 1.3/generic_fns/selection.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/selection.py?rev=3852&r1=3851&r2=3852&view=diff
==============================================================================
--- 1.3/generic_fns/selection.py (original)
+++ 1.3/generic_fns/selection.py Fri Nov 23 15:48:05 2007
@@ -170,6 +170,26 @@
         self._union = (select_obj0, select_obj1)
 
 
+def count_spins(selection=None):
+    """Function for counting the number of spins for which there is data.
+
+    @param selection:   The selection string.
+    @type selection:    str
+    @return:            The number of non-empty spins.
+    @return type:       int
+    """
+
+    # Init.
+    spin_num = 0
+
+    # Spin loop.
+    for spin in spin_loop(selection):
+        spin_num = spin_num + 1
+
+    # Return the number of spins.
+    return spin_num
+
+
 def desel_all(self, run=None):
     """Function for deselecting all residues."""
 




Related Messages


Powered by MHonArc, Updated Fri Nov 23 16:00:21 2007