mailr3507 - /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 11, 2007 - 22:29:
Author: bugman
Date: Sun Nov 11 22:29:56 2007
New Revision: 3507

URL: http://svn.gna.org/viewcvs/relax?rev=3507&view=rev
Log:
Modified the spin loop function to return the molecule name, res num, and res 
name if asked.

The full_info flag has been added which should significantly simplify much 
code.


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=3507&r1=3506&r2=3507&view=diff
==============================================================================
--- 1.3/generic_fns/selection.py (original)
+++ 1.3/generic_fns/selection.py Sun Nov 11 22:29:56 2007
@@ -937,15 +937,20 @@
         print "No residues match."
 
 
-def spin_loop(selection=None, pipe=None):
+def spin_loop(selection=None, pipe=None, full_info=False):
     """Generator function for looping over all the spin systems of the given 
selection.
 
     @param selection:   The spin system selection identifier.
     @type selection:    str
     @param pipe:        The data pipe containing the spin.  Defaults to the 
current data pipe.
     @type pipe:         str
-    @return:            The spin system specific data container.
-    @rtype:             instance of the SpinContainer class.
+    @param full_info:   A flag specifying if the amount of information to be 
returned.  If false,
+                        only the data container is returned.  If true, the 
molecule name, residue
+                        number, and residue name is additionally returned.
+    @return:            The spin system specific data container and, if 
full_info=True, the molecule
+                        name, residue number, and residue name.
+    @rtype:             instance of the SpinContainer class.  If 
full_info=True, the type is the
+                        tuple (SpinContainer, str, int, str).
     """
 
     # The data pipe.
@@ -974,7 +979,10 @@
                     continue
 
                 # Yield the spin system data container.
-                yield spin
+                if full_info:
+                    yield spin, mol.name, res.num, res.name
+                else:
+                    yield spin
 
 
 def tokenise(selection):




Related Messages


Powered by MHonArc, Updated Sun Nov 11 22:40:15 2007