Author: bugman Date: Wed Jul 15 17:39:16 2009 New Revision: 9237 URL: http://svn.gna.org/viewcvs/relax?rev=9237&view=rev Log: Modified return_spin() to handle multiple spin ID strings. 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=9237&r1=9236&r2=9237&view=diff ============================================================================== --- 1.3/generic_fns/mol_res_spin.py (original) +++ 1.3/generic_fns/mol_res_spin.py Wed Jul 15 17:39:16 2009 @@ -1845,8 +1845,11 @@ def return_spin(selection=None, pipe=None, full_info=False): """Function for returning the spin data container of the given selection. - @param selection: The spin selection identifier. - @type selection: str + If more than one selection is given, then the boolean AND operation will be used to pull out the + spin. + + @param selection: The spin selection identifier(s). + @type selection: str or list of str @param pipe: The data pipe containing the spin. Defaults to the current data pipe. @type pipe: str @param full_info: A flag specifying if the amount of information to be returned. If false, @@ -1870,7 +1873,11 @@ dp = pipes.get_pipe(pipe) # Parse the selection string. - select_obj = Selection(selection) + if type(selection) == str: + selection = [selection] + select_obj = [] + for i in range(len(selection)): + select_obj.append(Selection(selection[i])) # Loop over the molecules. spin = None @@ -1882,7 +1889,11 @@ # Loop over the spins. for spin in res.spin: # Skip the spin if there is no match to the selection. - if (mol, res, spin) not in select_obj: + skip = False + for i in range(len(selection)): + if (mol, res, spin) not in select_obj[i]: + skip = True + if skip: continue # Store all containers.