mailr22065 - in /branches/double_rotor: ./ lib/frame_order/format.py


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

Header


Content

Posted by edward on January 29, 2014 - 16:41:
Author: bugman
Date: Wed Jan 29 16:41:13 2014
New Revision: 22065

URL: http://svn.gna.org/viewcvs/relax?rev=22065&view=rev
Log:
Merged revisions 22055 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r22055 | bugman | 2014-01-28 11:20:07 +0100 (Tue, 28 Jan 2014) | 6 lines
  
  The frame order matrix printing function can now output the matrix to any 
precision.
  
  The lib.frame_order.format.print_frame_order_2nd_degree() function now 
accepts the 'places' argument
  which allows for higher precision printouts.
........

Modified:
    branches/double_rotor/   (props changed)
    branches/double_rotor/lib/frame_order/format.py

Propchange: branches/double_rotor/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jan 29 16:41:13 2014
@@ -1,1 +1,1 @@
-/trunk:1-22053
+/trunk:1-22064

Modified: branches/double_rotor/lib/frame_order/format.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/double_rotor/lib/frame_order/format.py?rev=22065&r1=22064&r2=22065&view=diff
==============================================================================
--- branches/double_rotor/lib/frame_order/format.py (original)
+++ branches/double_rotor/lib/frame_order/format.py Wed Jan 29 16:41:13 2014
@@ -30,13 +30,15 @@
 from lib.float import isNaN
 
 
-def print_frame_order_2nd_degree(daeg, name=None, epsilon=1e-15, 
integer=False, dot=False, comma=True, file=None):
+def print_frame_order_2nd_degree(daeg, name=None, places=4, epsilon=1e-15, 
integer=False, dot=False, comma=True, file=None):
     """Nicely print out the Frame Order matrix of the 2nd degree.
 
     @param daeg:        The 3D, rank-4 Frame Order matrix.
     @type daeg:         numpy 3D, rank-4 array
     @keyword name:      The name of the matrix.
     @type name:         None or str
+    @keyword places:    The number of decimal places to print.
+    @type places:       int
     @keyword epsilon:   The minimum value, below which is considered zero.
     @type epsilon:      float
     @keyword integer:   A flag which if true will only print the integer 
part of the number.
@@ -92,30 +94,30 @@
                 # Integer printout.
                 if integer:
                     val = int(daeg[i, j])
-                    format = "%4i%s"
+                    format = "%" + repr(places) + "i%s"
 
                 # Float printout.
                 else:
                     val = daeg[i, j]
-                    format = "%10.4f%s"
+                    format = "%" + repr(places+6) + "." + repr(places) + 
"f%s"
 
             # NaN.
             elif isNaN(daeg[i, j]):
                 val = 'NaN'
                 if integer:
-                    format = "%4i%s"
+                    format = "%" + repr(places) + "i%s"
                 else:
-                    format = "%10s%s"
+                    format = "%" + repr(places+6) + "s%s"
 
             # Write out the zero elements.
             else:
                 # Integer printout.
                 if integer:
-                    format = "%4s%s"
+                    format = "%" + repr(places) + "s%s"
 
                 # Float printout.
                 else:
-                    format = "%10s%s"
+                    format = "%" + repr(places+6) + "s%s"
 
                 # The character.
                 if dot:




Related Messages


Powered by MHonArc, Updated Wed Jan 29 17:20:02 2014