summaryrefslogtreecommitdiff
path: root/gr-wxgui/src/python/fftsink2.py
diff options
context:
space:
mode:
authorjcorgan2007-11-08 03:03:32 +0000
committerjcorgan2007-11-08 03:03:32 +0000
commit27d33b1d2c8dccf5945d34f9daccc93cb66dab2b (patch)
treec507aa0e1da96ddf7e83e62cb84b1d53c729f17b /gr-wxgui/src/python/fftsink2.py
parent32ea2fe9034c799557cfb63be6f56301a94621f1 (diff)
downloadgnuradio-27d33b1d2c8dccf5945d34f9daccc93cb66dab2b.tar.gz
gnuradio-27d33b1d2c8dccf5945d34f9daccc93cb66dab2b.tar.bz2
gnuradio-27d33b1d2c8dccf5945d34f9daccc93cb66dab2b.zip
Improved frequency display format.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6830 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-wxgui/src/python/fftsink2.py')
-rwxr-xr-xgr-wxgui/src/python/fftsink2.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/gr-wxgui/src/python/fftsink2.py b/gr-wxgui/src/python/fftsink2.py
index 9c55801af..d64c22a69 100755
--- a/gr-wxgui/src/python/fftsink2.py
+++ b/gr-wxgui/src/python/fftsink2.py
@@ -260,16 +260,19 @@ class fft_window (plot.PlotCanvas):
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 @@ class fft_window (plot.PlotCanvas):
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 @@ class fft_window (plot.PlotCanvas):
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)