Author: bugman Date: Tue Oct 6 17:45:44 2009 New Revision: 9592 URL: http://svn.gna.org/viewcvs/relax?rev=9592&view=rev Log: Fixes for spin_id_to_data_list(), and now it returns a tuple rather than a list. 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=9592&r1=9591&r2=9592&view=diff ============================================================================== --- 1.3/generic_fns/mol_res_spin.py (original) +++ 1.3/generic_fns/mol_res_spin.py Tue Oct 6 17:45:44 2009 @@ -2100,9 +2100,8 @@ @param id: The spin ID string. @type id: str - @return: A list of the molecule name, the residue number and name, and the spin number and - name. - @rtype: list of str, int, str, int, str + @return: The molecule name, the residue number and name, and the spin number and name. + @rtype: str, int, str, int, str """ # Split up the spin ID. @@ -2131,15 +2130,19 @@ res_num = None if len(res_nums) > 1: raise RelaxError("The single spin ID should only belong to one residue number, not %s." % res_info) - if len(res_info) == 1: - res_num = res_info[0] + elif len(res_nums) == 1: + res_num = res_nums[0] + else: + res_num = res_nums # Residue name. res_name = None if len(res_names) > 1: raise RelaxError("The single spin ID should only belong to one residue name, not %s." % res_info) - if len(res_info) == 1: - res_name = res_info[0] + elif len(res_names) == 1: + res_name = res_names[0] + else: + res_name = res_names # Spin info. spin_names = [] @@ -2154,18 +2157,22 @@ spin_num = None if len(spin_nums) > 1: raise RelaxError("The single spin ID should only belong to one spin number, not %s." % spin_info) - if len(spin_info) == 1: - spin_num = spin_info[0] + elif len(spin_nums) == 1: + spin_num = spin_nums[0] + else: + spin_num = spin_nums # Spin name. spin_name = None if len(spin_names) > 1: raise RelaxError("The single spin ID should only belong to one spin name, not %s." % spin_info) - if len(spin_info) == 1: - spin_name = spin_info[0] + elif len(spin_names) == 1: + spin_name = spin_names[0] + else: + spin_name = spin_names # Return the data. - return [mol_name, res_num, res_name, spin_num, spin_name] + return mol_name, res_num, res_name, spin_num, spin_name def spin_in_list(spin_list, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, mol_name=None, res_num=None, res_name=None, spin_num=None, spin_name=None):