mailr27746 - /trunk/pipe_control/pcs.py


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

Header


Content

Posted by edward on March 03, 2015 - 15:04:
Author: bugman
Date: Tue Mar  3 15:04:47 2015
New Revision: 27746

URL: http://svn.gna.org/viewcvs/relax?rev=27746&view=rev
Log:
Added full per-alignment data printouts to the pcs.copy user function to 
match rdc.copy.

The feedback is important to know what was actually copied.


Modified:
    trunk/pipe_control/pcs.py

Modified: trunk/pipe_control/pcs.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/pcs.py?rev=27746&r1=27745&r2=27746&view=diff
==============================================================================
--- trunk/pipe_control/pcs.py   (original)
+++ trunk/pipe_control/pcs.py   Tue Mar  3 15:04:47 2015
@@ -33,9 +33,10 @@
 
 # relax module imports.
 from lib.alignment.pcs import ave_pcs_tensor, pcs_tensor
+from lib.check_types import is_float
 from lib.errors import RelaxError, RelaxNoAlignError, RelaxNoPdbError, 
RelaxNoPCSError, RelaxNoSequenceError
 from lib.geometry.vectors import random_unit_vector
-from lib.io import open_write_file
+from lib.io import open_write_file, write_data
 from lib.periodic_table import periodic_table
 from lib.physical_constants import pcs_constant
 from lib.plotting.api import write_xy_data, write_xy_header
@@ -326,6 +327,7 @@
             dp_to.pcs_ids.append(align_id)
 
         # Spin loop.
+        data = []
         for mol_index, res_index, spin_index in spin_index_loop():
             # Alias the spin containers.
             spin_from = 
dp_from.mol[mol_index].res[res_index].spin[spin_index]
@@ -344,12 +346,41 @@
                 spin_to.pcs_err = {}
 
             # Copy the value and error from pipe_from.
+            value = None
+            error = None
+            value_bc = None
             if hasattr(spin_from, 'pcs'):
-                spin_to.pcs[align_id] = spin_from.pcs[align_id]
+                value = spin_from.pcs[align_id]
+                spin_to.pcs[align_id] = value
             if back_calc and hasattr(spin_from, 'pcs_bc'):
-                spin_to.pcs_bc[align_id] = spin_from.pcs_bc[align_id]
+                value_bc = spin_from.pcs_bc[align_id]
+                spin_to.pcs_bc[align_id] = value_bc
             if hasattr(spin_from, 'pcs_err'):
-                spin_to.pcs_err[align_id] = spin_from.pcs_err[align_id]
+                error = spin_from.pcs_err[align_id]
+                spin_to.pcs_err[align_id] = error
+
+            # Append the data for printout.
+            data.append([spin_from._spin_ids[0]])
+            if is_float(value):
+                data[-1].append("%20.15f" % value)
+            else:
+                data[-1].append("%20s" % value)
+            if back_calc:
+                if is_float(value_bc):
+                    data[-1].append("%20.15f" % value_bc)
+                else:
+                    data[-1].append("%20s" % value_bc)
+            if is_float(error):
+                data[-1].append("%20.15f" % error)
+            else:
+                data[-1].append("%20s" % error)
+
+        # Printout.
+        print("The following PCSs have been copied:\n")
+        if back_calc:
+            write_data(out=sys.stdout, headings=["Spin_ID", "Value", 
"Back-calculated", "Error"], data=data)
+        else:
+            write_data(out=sys.stdout, headings=["Spin_ID", "Value", 
"Error"], data=data)
 
 
 def corr_plot(format=None, title=None, subtitle=None, file=None, dir=None, 
force=False):




Related Messages


Powered by MHonArc, Updated Tue Mar 03 15:20:02 2015