From 27d33b1d2c8dccf5945d34f9daccc93cb66dab2b Mon Sep 17 00:00:00 2001 From: jcorgan Date: Thu, 8 Nov 2007 03:03:32 +0000 Subject: Improved frequency display format. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6830 221aa14e-8319-0410-a670-987f0aec2ac5 --- gr-wxgui/src/python/fftsink2.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gr-wxgui/src/python/fftsink2.py') 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) -- cgit