summaryrefslogtreecommitdiff
path: root/gr-wxgui/src
diff options
context:
space:
mode:
authorjcorgan2008-02-28 19:03:55 +0000
committerjcorgan2008-02-28 19:03:55 +0000
commit5ede0e2b1457d7c28ad29c5f2322305621a3b26a (patch)
tree37301199a3a33780186b147ea304caa63eca6173 /gr-wxgui/src
parent2869e85809d37ab4a2c01a18c4b348f7f28ee9b0 (diff)
downloadgnuradio-5ede0e2b1457d7c28ad29c5f2322305621a3b26a.tar.gz
gnuradio-5ede0e2b1457d7c28ad29c5f2322305621a3b26a.tar.bz2
gnuradio-5ede0e2b1457d7c28ad29c5f2322305621a3b26a.zip
Added reference scaling to fftsink2. Default behavior is unchanged.
The new parameter 'ref_scale', defaulting to 1.0, represents a 0 dB y-axis value. Updated usrp_fft.py to display dBFS by setting ref_scale to 32768.0 and ref_level to 0. This results in the full 100 dB of dynamic range being displayed. Updated some gnuradio-examples to use the new parameter. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@7863 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-wxgui/src')
-rwxr-xr-xgr-wxgui/src/python/fftsink2.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/gr-wxgui/src/python/fftsink2.py b/gr-wxgui/src/python/fftsink2.py
index 70ec002e9..b9e1a47f3 100755
--- a/gr-wxgui/src/python/fftsink2.py
+++ b/gr-wxgui/src/python/fftsink2.py
@@ -91,7 +91,7 @@ class fft_sink_base(object):
class fft_sink_f(gr.hier_block2, fft_sink_base):
- def __init__(self, parent, baseband_freq=0,
+ def __init__(self, parent, baseband_freq=0, ref_scale=1.0,
y_per_div=10, y_divs=8, ref_level=50, sample_rate=1, fft_size=512,
fft_rate=default_fft_rate, average=False, avg_alpha=None,
title='', size=default_fftsink_size, peak_hold=False):
@@ -122,7 +122,10 @@ class fft_sink_f(gr.hier_block2, fft_sink_base):
# FIXME We need to add 3dB to all bins but the DC bin
self.log = gr.nlog10_ff(20, self.fft_size,
- -20*math.log10(self.fft_size)-10*math.log10(power/self.fft_size))
+ -20*math.log10(self.fft_size) # Adjust for number of bins
+ -10*math.log10(power/self.fft_size) # Adjust for windowing loss
+ -20*math.log10(ref_scale)) # Adjust for reference scale
+
self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink)
@@ -131,7 +134,7 @@ class fft_sink_f(gr.hier_block2, fft_sink_base):
class fft_sink_c(gr.hier_block2, fft_sink_base):
- def __init__(self, parent, baseband_freq=0,
+ def __init__(self, parent, baseband_freq=0, ref_scale=1.0,
y_per_div=10, y_divs=8, ref_level=50, sample_rate=1, fft_size=512,
fft_rate=default_fft_rate, average=False, avg_alpha=None,
title='', size=default_fftsink_size, peak_hold=False):
@@ -162,7 +165,10 @@ class fft_sink_c(gr.hier_block2, fft_sink_base):
# FIXME We need to add 3dB to all bins but the DC bin
self.log = gr.nlog10_ff(20, self.fft_size,
- -20*math.log10(self.fft_size)-10*math.log10(power/self.fft_size))
+ -20*math.log10(self.fft_size) # Adjust for number of bins
+ -10*math.log10(power/self.fft_size) # Adjust for windowing loss
+ -20*math.log10(ref_scale)) # Adjust for reference scale
+
self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink)