commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r6830 - gnuradio/trunk/gr-wxgui/src/python


From: jcorgan
Subject: [Commit-gnuradio] r6830 - gnuradio/trunk/gr-wxgui/src/python
Date: Wed, 7 Nov 2007 20:03:33 -0700 (MST)

Author: jcorgan
Date: 2007-11-07 20:03:32 -0700 (Wed, 07 Nov 2007)
New Revision: 6830

Modified:
   gnuradio/trunk/gr-wxgui/src/python/fftsink2.py
Log:
Improved frequency display format.

Modified: gnuradio/trunk/gr-wxgui/src/python/fftsink2.py
===================================================================
--- gnuradio/trunk/gr-wxgui/src/python/fftsink2.py      2007-11-08 02:20:57 UTC 
(rev 6829)
+++ gnuradio/trunk/gr-wxgui/src/python/fftsink2.py      2007-11-08 03:03:32 UTC 
(rev 6830)
@@ -260,16 +260,19 @@
         if x >= 1e9:
             sf = 1e-9
             self.units = "GHz"
+           self.format = "%3.6f"
         elif x >= 1e6:
             sf = 1e-6
             self.units = "MHz"
+           self.format = "%3.3f"
         else:
             sf = 1e-3
             self.units = "kHz"
+           self.format = "%3.3f"
 
         if self.fftsink.input_is_real:     # only plot 1/2 the points
             x_vals = ((numpy.arange (L/2)
-                       * (self.fftsink.sample_rate * sf / L))
+                      * (self.fftsink.sample_rate * sf / L))
                       + self.fftsink.baseband_freq * sf)
             self.points = numpy.zeros((len(x_vals), 2), numpy.float64)
             self.points[:,0] = x_vals
@@ -277,7 +280,7 @@
         else:
             # the "negative freqs" are in the second half of the array
             x_vals = ((numpy.arange (-L/2, L/2)
-                       * (self.fftsink.sample_rate * sf / L))
+                      * (self.fftsink.sample_rate * sf / L))
                       + self.fftsink.baseband_freq * sf)
             self.points = numpy.zeros((len(x_vals), 2), numpy.float64)
             self.points[:,0] = x_vals
@@ -364,7 +367,7 @@
         index = numpy.argmin(numpy.abs(x_vals-ux))
         x_val = x_vals[index]
         db_val = self.points[index, 1]
-        text = "%3.3f %s dB=%3.3f" % (x_val, self.units, db_val)
+        text = (self.format+" %s dB=%3.3f") % (x_val, self.units, db_val)
 
         # Display the tooltip
         tip = wx.ToolTip(text)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]