mailr18427 - /trunk/generic_fns/align_tensor.py


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

Header


Content

Posted by edward on February 06, 2013 - 11:44:
Author: bugman
Date: Wed Feb  6 11:44:16 2013
New Revision: 18427

URL: http://svn.gna.org/viewcvs/relax?rev=18427&view=rev
Log:
Improved the printout from the align_tensor.matrix_angles user function.

The relax_io.write_data() function is being used and the tensors are now 
identified by name rather
than index.


Modified:
    trunk/generic_fns/align_tensor.py

Modified: trunk/generic_fns/align_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/generic_fns/align_tensor.py?rev=18427&r1=18426&r2=18427&view=diff
==============================================================================
--- trunk/generic_fns/align_tensor.py (original)
+++ trunk/generic_fns/align_tensor.py Wed Feb  6 11:44:16 2013
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2012 Edward d'Auvergne                                  
 #
+# Copyright (C) 2003-2013 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -36,6 +36,7 @@
 from generic_fns import pipes
 from physical_constants import g1H, h_bar, kB, mu0, return_gyromagnetic_ratio
 from relax_errors import RelaxError, RelaxNoTensorError, RelaxStrError, 
RelaxTensorError, RelaxUnknownParamCombError, RelaxUnknownParamError
+from relax_io import write_data
 
 
 def align_data_exists(tensor, pipe=None):
@@ -1052,17 +1053,21 @@
     elif basis_set == 1:
         sys.stdout.write("{Szz, Sxx-yy, Sxy, Sxz, Syz}")
     sys.stdout.write(":\n")
-    sys.stdout.write("%8s" % '')
+
+    # Initialise the table of data.
+    table = []
+
+    # The table header.
+    table.append([''])
     for i in range(tensor_num):
-        sys.stdout.write("%8i" % i)
-    sys.stdout.write("\n")
-
-    # First loop.
+        table[0].append(cdp.align_tensors[i].name)
+
+    # First loop over the rows.
     for i in range(tensor_num):
-        # Print out.
-        sys.stdout.write("%8i" % i)
-
-        # Second loop.
+        # Add the tensor name.
+        table.append([cdp.align_tensors[i].name])
+
+        # Second loop over the columns.
         for j in range(tensor_num):
             # Dot product.
             delta = dot(matrix[i], matrix[j])
@@ -1074,11 +1079,11 @@
             # The angle (in rad).
             cdp.align_tensors.angles[i, j] = arccos(delta)
 
-            # Print out the angles in degrees.
-            sys.stdout.write("%8.1f" % (cdp.align_tensors.angles[i, 
j]*180.0/pi))
-
-        # Print out.
-        sys.stdout.write("\n")
+            # Add to the table as degrees.
+            table[i+1].append("%8.1f" % (cdp.align_tensors.angles[i, 
j]*180.0/pi))
+
+    # Write out the table.
+    write_data(out=sys.stdout, data=table)
 
 
 def num_tensors(skip_fixed=True):




Related Messages


Powered by MHonArc, Updated Wed Feb 06 12:00:02 2013