mailr7260 - /1.3/generic_fns/mol_res_spin.py


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

Header


Content

Posted by edward on September 24, 2008 - 18:47:
Author: bugman
Date: Wed Sep 24 18:47:54 2008
New Revision: 7260

URL: http://svn.gna.org/viewcvs/relax?rev=7260&view=rev
Log:
Merged the count_selected_spins() function into count_spins().


Modified:
    1.3/generic_fns/mol_res_spin.py

Modified: 1.3/generic_fns/mol_res_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/mol_res_spin.py?rev=7260&r1=7259&r2=7260&view=diff
==============================================================================
--- 1.3/generic_fns/mol_res_spin.py (original)
+++ 1.3/generic_fns/mol_res_spin.py Wed Sep 24 18:47:54 2008
@@ -696,35 +696,6 @@
         res_to_cont.spin[-1].name = spin_name_to
 
 
-def count_selected_spins(selection=None):
-    """Function for counting the number of spins for which there is data and 
which are selected.
-
-    @param selection:   The selection string.
-    @type selection:    str
-    @return:            The number of non-empty selected spins.
-    @rtype:             int
-    """
-
-    # No data, hence no spins.
-    if not exists_mol_res_spin_data():
-        return 0
-
-    # Init.
-    spin_num = 0
-
-    # Spin loop.
-    for spin in spin_loop(selection):
-        # Skip deselected spins.
-        if not spin.select:
-            continue
-
-        # Increment the spin number.
-        spin_num = spin_num + 1
-
-    # Return the number of spins.
-    return spin_num
-
-
 def count_molecules(selection=None):
     """Count the number of molecules for which there is data.
 
@@ -773,7 +744,7 @@
     return res_num
 
 
-def count_spins(selection=None):
+def count_spins(selection=None, skip_desel=True):
     """Function for counting the number of spins for which there is data.
 
     @param selection:   The selection string.
@@ -791,6 +762,10 @@
 
     # Spin loop.
     for spin in spin_loop(selection):
+        # Skip deselected spins.
+        if skip_desel and not spin.select:
+            continue
+
         spin_num = spin_num + 1
 
     # Return the number of spins.




Related Messages


Powered by MHonArc, Updated Wed Sep 24 19:00:04 2008