mailr23257 - /branches/frame_order_cleanup/test_suite/shared_data/frame_order/cam/generate_base.py


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

Header


Content

Posted by edward on May 20, 2014 - 13:47:
Author: bugman
Date: Tue May 20 13:47:59 2014
New Revision: 23257

URL: http://svn.gna.org/viewcvs/relax?rev=23257&view=rev
Log:
Improvements to the progress meter for the CaM frame order test data 
generation base script.

Commas are now printed between the thousands and the numbers are now right 
justified.

Modified:
    
branches/frame_order_cleanup/test_suite/shared_data/frame_order/cam/generate_base.py

Modified: 
branches/frame_order_cleanup/test_suite/shared_data/frame_order/cam/generate_base.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/shared_data/frame_order/cam/generate_base.py?rev=23257&r1=23256&r2=23257&view=diff
==============================================================================
--- 
branches/frame_order_cleanup/test_suite/shared_data/frame_order/cam/generate_base.py
        (original)
+++ 
branches/frame_order_cleanup/test_suite/shared_data/frame_order/cam/generate_base.py
        Tue May 20 13:47:59 2014
@@ -23,6 +23,7 @@
 """Module containing the base class for the distribution and alignment data 
generation."""
 
 # Python module imports.
+import locale
 from math import pi
 from numpy import array, cross, dot, eye, float32, float64, inner, 
tensordot, transpose, zeros
 from numpy.linalg import norm
@@ -86,6 +87,9 @@
         self.interpreter.populate_self()
         self.interpreter.on(verbose=False)
 
+        # Set up for the progress meter (commas between the thousands).
+        locale.setlocale(locale.LC_ALL, 'en_US')
+
         # Build the axis system.
         self.build_axes()
         self.print_axis_system()
@@ -116,7 +120,7 @@
         """Calculate the averaged PCS for all states."""
 
         # Printout.
-        sys.stdout.write("\n\nRotating %s states for the PCS:\n\n" % self.N)
+        sys.stdout.write("\n\nRotating %s states for the PCS:\n\n" % 
locale.format("%d", self.N, grouping=True))
 
         # Turn off the relax interpreter echoing to allow the progress meter 
to be shown correctly.
         self.interpreter.off()
@@ -217,7 +221,7 @@
             rot_file = open_write_file('rotations', dir=self.save_path, 
compress_type=1, force=True)
 
         # Printout.
-        sys.stdout.write("\n\nRotating %s states for the RDC:\n\n" % self.N)
+        sys.stdout.write("\n\nRotating %s states for the RDC:\n\n" % 
locale.format("%d", self.N, grouping=True))
 
         # Turn off the relax interpreter echoing to allow the progress meter 
to be shown correctly.
         self.interpreter.off()
@@ -450,7 +454,8 @@
 
         # Dump the progress.
         if i % b == 0:
-            sys.stderr.write('\b%i\n' % i)
+            num = locale.format("%d", i, grouping=True)
+            sys.stderr.write('\b%12s\n' % num)
 
 
     def _state_loop(self):




Related Messages


Powered by MHonArc, Updated Tue May 20 14:00:03 2014