Author: bugman Date: Tue May 12 11:21:59 2009 New Revision: 9050 URL: http://svn.gna.org/viewcvs/relax?rev=9050&view=rev Log: Added the pipe keyword to all the sequence counting functions. 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=9050&r1=9049&r2=9050&view=diff ============================================================================== --- 1.3/generic_fns/mol_res_spin.py (original) +++ 1.3/generic_fns/mol_res_spin.py Tue May 12 11:21:59 2009 @@ -731,14 +731,23 @@ res_to_cont.spin[-1].name = spin_name_to -def count_molecules(selection=None): +def count_molecules(selection=None, pipe=None): """Count the number of molecules for which there is data. - @param selection: The selection string. + @keyword selection: The selection string. @type selection: str + @keyword pipe: The data pipe containing the spin. Defaults to the current data pipe. + @type pipe: str @return: The number of non-empty molecules. @rtype: int """ + + # The data pipe. + if pipe == None: + pipe = pipes.cdp_name() + + # Test the data pipe. + pipes.test(pipe) # No data, hence no molecules. if not exists_mol_res_spin_data(): @@ -755,14 +764,23 @@ return mol_num -def count_residues(selection=None): +def count_residues(selection=None, pipe=None): """Count the number of residues for which there is data. - @param selection: The selection string. + @keyword selection: The selection string. @type selection: str + @keyword pipe: The data pipe containing the spin. Defaults to the current data pipe. + @type pipe: str @return: The number of non-empty residues. @rtype: int """ + + # The data pipe. + if pipe == None: + pipe = pipes.cdp_name() + + # Test the data pipe. + pipes.test(pipe) # No data, hence no residues. if not exists_mol_res_spin_data(): @@ -779,14 +797,26 @@ return res_num -def count_spins(selection=None, skip_desel=True): +def count_spins(selection=None, pipe=None, skip_desel=True): """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. - @rtype: int - """ + @keyword selection: The selection string. + @type selection: str + @keyword pipe: The data pipe containing the spin. Defaults to the current data pipe. + @type pipe: str + @keyword skip_desel: A flag which if true will cause deselected spins to be skipped in the + count. + @type skip_desel: bool + @return: The number of non-empty spins. + @rtype: int + """ + + # The data pipe. + if pipe == None: + pipe = pipes.cdp_name() + + # Test the data pipe. + pipes.test(pipe) # No data, hence no spins. if not exists_mol_res_spin_data():