Author: bugman Date: Sun Mar 24 22:06:21 2013 New Revision: 19151 URL: http://svn.gna.org/viewcvs/relax?rev=19151&view=rev Log: Fix for the pipe_control.relax_data.pack_data() function for the selection object changes. Modified: trunk/pipe_control/relax_data.py Modified: trunk/pipe_control/relax_data.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/relax_data.py?rev=19151&r1=19150&r2=19151&view=diff ============================================================================== --- trunk/pipe_control/relax_data.py (original) +++ trunk/pipe_control/relax_data.py Sun Mar 24 22:06:21 2013 @@ -855,23 +855,32 @@ data = [] for i in range(N): # Get the corresponding spin container. - spins = return_spin_from_selection(spin_ids[i], multi=True) + match_mol_names, match_res_nums, match_res_names, spins = return_spin_from_selection(spin_ids[i], full_info=True, multi=True) if spins in [None, []]: raise RelaxNoSpinError(spin_ids[i]) # Remove non-matching spins. if select_obj: new_spins = [] + new_mol_names = [] + new_res_nums = [] + new_res_names = [] new_ids = [] for j in range(len(spins)): - if spins[j] in select_obj: + if select_obj.contains_spin(spin_num=spins[j].num, spin_name=spins[j].name, res_num=match_res_nums[j], res_name=match_res_names[j], mol=match_mol_names[j]): new_spins.append(spins[j]) + new_mol_names.append(match_mol_names[j]) + new_res_nums.append(match_res_nums[j]) + new_res_names.append(match_res_names[j]) new_ids.append(generate_spin_id_unique(mol_name=mol_names[i], res_num=res_nums[i], res_name=res_names[i], spin_num=spins[j].num, spin_name=spins[j].name)) new_id = new_ids[0] # Aliases for normal operation. else: new_spins = spins + new_mol_names = match_mol_names + new_res_nums = match_res_nums + new_res_names = match_res_names new_id = spin_ids[i] new_ids = None @@ -885,20 +894,20 @@ raise RelaxNoSpinError(spin_ids[i]) # Loop over the spins. - for spin in new_spins: + for j in range(len(new_spins)): # No match to the selection. - if select_obj and spin not in select_obj: + if select_obj and not select_obj.contains_spin(spin_num=new_spins[j].num, spin_name=new_spins[j].name, res_num=new_res_nums[j], res_name=new_res_names[j], mol=new_mol_names[j]): continue # Initialise the spin data if necessary. - if not hasattr(spin, 'ri_data') or spin.ri_data == None: - spin.ri_data = {} - if not hasattr(spin, 'ri_data_err') or spin.ri_data_err == None: - spin.ri_data_err = {} + if not hasattr(new_spins[j], 'ri_data') or new_spins[j].ri_data == None: + new_spins[j].ri_data = {} + if not hasattr(new_spins[j], 'ri_data_err') or new_spins[j].ri_data_err == None: + new_spins[j].ri_data_err = {} # Update all data structures. - spin.ri_data[ri_id] = values[i] - spin.ri_data_err[ri_id] = errors[i] + new_spins[j].ri_data[ri_id] = values[i] + new_spins[j].ri_data_err[ri_id] = errors[i] # Append the data for printing out. data.append([new_id, repr(values[i]), repr(errors[i])])