mailr17013 - /branches/interatomic/generic_fns/relax_data.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on June 21, 2012 - 10:17:
Author: bugman
Date: Thu Jun 21 10:17:56 2012
New Revision: 17013

URL: http://svn.gna.org/viewcvs/relax?rev=17013&view=rev
Log:
Improvements and fixes for the generic_fns.relax_data.pack_data() function.

This affects all the relaxation data reading user functions.


Modified:
    branches/interatomic/generic_fns/relax_data.py

Modified: branches/interatomic/generic_fns/relax_data.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/interatomic/generic_fns/relax_data.py?rev=17013&r1=17012&r2=17013&view=diff
==============================================================================
--- branches/interatomic/generic_fns/relax_data.py (original)
+++ branches/interatomic/generic_fns/relax_data.py Thu Jun 21 10:17:56 2012
@@ -838,19 +838,30 @@
         # Remove non-matching spins.
         if select_obj:
             new_spins = []
-            for spin in spins:
-                if spin in select_obj:
-                    new_spins.append(spin)
-            spins = new_spins
+            new_ids = []
+            for j in range(len(spins)):
+                if spins[j] in select_obj:
+                    new_spins.append(spins[j])
+                    new_ids.append(generate_spin_id(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_id = spin_ids[i]
+            new_ids = None
 
         # Check that only a singe spin is present.
-        if len(spins) > 1:
-            raise RelaxMultiSpinIDError(spin_ids[i])
-        if len(spins) == 0:
+        if len(new_spins) > 1:
+            if new_ids:
+                raise RelaxMultiSpinIDError(spin_ids[i], new_ids)
+            else:
+                raise RelaxMultiSpinIDError(spin_ids[i], new_ids)
+        if len(new_spins) == 0:
             raise RelaxNoSpinError(spin_ids[i])
 
         # Loop over the spins.
-        for spin in spins:
+        for spin in new_spins:
             # No match to the selection.
             if select_obj and spin not in select_obj:
                 continue
@@ -866,7 +877,7 @@
             spin.ri_data_err[ri_id] = errors[i]
 
             # Append the data for printing out.
-            data.append([spin_ids[i], repr(values[i]), repr(errors[i])])
+            data.append([new_id, repr(values[i]), repr(errors[i])])
 
     # Print out.
     write_data(out=sys.stdout, headings=["Spin_ID", "Value", "Error"], 
data=data)




Related Messages


Powered by MHonArc, Updated Thu Jun 21 10:20:02 2012