[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9284 - gnuradio/branches/developers/jblum/glwxgui/gr-
From: |
jblum |
Subject: |
[Commit-gnuradio] r9284 - gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python |
Date: |
Thu, 14 Aug 2008 09:43:38 -0600 (MDT) |
Author: jblum
Date: 2008-08-14 09:43:37 -0600 (Thu, 14 Aug 2008)
New Revision: 9284
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/common.py
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scope_window.py
Log:
label format tweak
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/common.py
===================================================================
--- gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/common.py
2008-08-14 14:22:00 UTC (rev 9283)
+++ gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/common.py
2008-08-14 15:43:37 UTC (rev 9284)
@@ -283,13 +283,17 @@
def label_format(num):
"""!
Format a floating point number into a presentable string.
+ If the number has an small enough exponent, use regular decimal.
+ Otherwise, format the number with floating point notation.
+ Exponents are normalized to multiples of 3.
+ In the case where the exponent was found to be -3,
+ it is best to display this as a regular decimal, with a 0 to the left.
@param num the number to format
@return a label string
"""
coeff, exp, prefix = get_si_components(num)
- if abs(exp) >= 3:
- return '%se%d'%('%.3g'%coeff, exp)
- else: return '%g'%num
+ if -3 <= exp < 3: return '%g'%num
+ return '%se%d'%('%.3g'%coeff, exp)
if __name__ == '__main__':
import random
Modified:
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scope_window.py
===================================================================
---
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scope_window.py
2008-08-14 14:22:00 UTC (rev 9283)
+++
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scope_window.py
2008-08-14 15:43:37 UTC (rev 9284)
@@ -463,7 +463,7 @@
)
else:
#update the t axis
- coeff, exp, prefix = common.get_si_components(t_per_div)
+ coeff, exp, prefix =
common.get_si_components(t_per_div*t_divs + t_off)
self.plotter.set_x_label('Time', prefix+'s')
self.plotter.set_x_grid(
t_off,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9284 - gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python,
jblum <=