Author: bugman Date: Thu Apr 11 09:40:53 2013 New Revision: 19446 URL: http://svn.gna.org/viewcvs/relax?rev=19446&view=rev Log: The pipe_control.mol_res_spin.count_max_spins_per_residue() function now accepts a spin ID argument. This can be used to restrict the spins to count. Modified: trunk/pipe_control/mol_res_spin.py Modified: trunk/pipe_control/mol_res_spin.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/mol_res_spin.py?rev=19446&r1=19445&r2=19446&view=diff ============================================================================== --- trunk/pipe_control/mol_res_spin.py (original) +++ trunk/pipe_control/mol_res_spin.py Thu Apr 11 09:40:53 2013 @@ -417,11 +417,13 @@ status.spin_lock.release(sys._getframe().f_code.co_name) -def count_max_spins_per_residue(pipe=None, skip_desel=True): +def count_max_spins_per_residue(pipe=None, spin_id=None, skip_desel=True): """Determine the maximum number of spins present per residue. @keyword pipe: The data pipe containing the spin. Defaults to the current data pipe. @type pipe: str + @param spin_id: The molecule, residue, and spin identifier string. + @type spin_id: 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. @@ -444,6 +446,9 @@ # Get the data pipe. dp = pipes.get_pipe(pipe) + + # Parse the selection string. + select_obj = Selection(spin_id) # Loop over the molecules. for mol in dp.mol: @@ -454,6 +459,10 @@ # Loop over the spins. for spin in res.spin: + # Skip the spin if there is no match to the selection. + if not select_obj.contains_spin(spin_num=spin.num, spin_name=spin.name, res_num=res.num, res_name=res.name, mol=mol.name): + continue + # Skip deselected spins. if skip_desel and not spin.select: continue