summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgnuradio-examples/python/audio/audio_fft.py3
-rwxr-xr-xgnuradio-examples/python/usrp/usrp_am_mw_rcv.py5
-rwxr-xr-xgnuradio-examples/python/usrp/usrp_nbfm_rcv.py2
-rwxr-xr-xgnuradio-examples/python/usrp/usrp_wfm_rcv.py3
-rwxr-xr-xgnuradio-examples/python/usrp/usrp_wfm_rcv_pll.py3
-rwxr-xr-xgnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py3
-rwxr-xr-xgnuradio-examples/python/usrp/usrp_wxapt_rcv.py3
-rwxr-xr-xgr-utils/src/python/usrp_fft.py5
-rwxr-xr-xgr-wxgui/src/python/fftsink2.py14
9 files changed, 27 insertions, 14 deletions
diff --git a/gnuradio-examples/python/audio/audio_fft.py b/gnuradio-examples/python/audio/audio_fft.py
index f7f1c2e8c..960e0f94d 100755
--- a/gnuradio-examples/python/audio/audio_fft.py
+++ b/gnuradio-examples/python/audio/audio_fft.py
@@ -61,7 +61,8 @@ class app_top_block(stdgui2.std_top_block):
elif options.oscilloscope:
self.scope = scopesink2.scope_sink_f(panel, sample_rate=sample_rate)
else:
- self.scope = fftsink2.fft_sink_f (panel, fft_size=1024, sample_rate=sample_rate, fft_rate=30)
+ self.scope = fftsink2.fft_sink_f (panel, fft_size=1024, sample_rate=sample_rate, fft_rate=30,
+ ref_scale=1.0, ref_level=0, y_divs=12)
self.src = audio.source (sample_rate, options.audio_input)
diff --git a/gnuradio-examples/python/usrp/usrp_am_mw_rcv.py b/gnuradio-examples/python/usrp/usrp_am_mw_rcv.py
index c99fb3072..b11355985 100755
--- a/gnuradio-examples/python/usrp/usrp_am_mw_rcv.py
+++ b/gnuradio-examples/python/usrp/usrp_am_mw_rcv.py
@@ -178,7 +178,8 @@ class wfm_rx_block (stdgui2.std_top_block):
if 1:
self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from USRP",
- fft_size=512, sample_rate=usrp_rate)
+ fft_size=512, sample_rate=usrp_rate,
+ ref_scale=32768.0, ref_level=0.0, y_divs=12)
self.connect (self.u, self.src_fft)
vbox.Add (self.src_fft.win, 4, wx.EXPAND)
@@ -198,7 +199,7 @@ class wfm_rx_block (stdgui2.std_top_block):
if 1:
audio_fft = fftsink2.fft_sink_f(self.panel, title="Audio",
fft_size=512, sample_rate=audio_rate,
- y_per_div=10, ref_level=-20)
+ y_per_div=10, ref_level=20)
self.connect (self.audio_filt, audio_fft)
vbox.Add (audio_fft.win, 4, wx.EXPAND)
diff --git a/gnuradio-examples/python/usrp/usrp_nbfm_rcv.py b/gnuradio-examples/python/usrp/usrp_nbfm_rcv.py
index 7aa45575d..4c66fc970 100755
--- a/gnuradio-examples/python/usrp/usrp_nbfm_rcv.py
+++ b/gnuradio-examples/python/usrp/usrp_nbfm_rcv.py
@@ -102,7 +102,7 @@ class my_top_block (stdgui2.std_top_block):
if 1 and not(no_gui):
self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from USRP",
fft_size=512, sample_rate=self.rxpath.if_rate,
- ref_level=80, y_per_div=20)
+ ref_scale=32768.0, ref_level=0, y_per_div=10, y_divs=12)
self.connect (self.rxpath.u, self.src_fft)
vbox.Add (self.src_fft.win, 4, wx.EXPAND)
if 1 and not(no_gui):
diff --git a/gnuradio-examples/python/usrp/usrp_wfm_rcv.py b/gnuradio-examples/python/usrp/usrp_wfm_rcv.py
index 40e4d8384..5655d19b5 100755
--- a/gnuradio-examples/python/usrp/usrp_wfm_rcv.py
+++ b/gnuradio-examples/python/usrp/usrp_wfm_rcv.py
@@ -150,7 +150,8 @@ class wfm_rx_block (stdgui2.std_top_block):
if 1:
self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from USRP",
- fft_size=512, sample_rate=usrp_rate)
+ fft_size=512, sample_rate=usrp_rate,
+ ref_scale=32768.0, ref_level=0, y_divs=12)
self.connect (self.u, self.src_fft)
vbox.Add (self.src_fft.win, 4, wx.EXPAND)
diff --git a/gnuradio-examples/python/usrp/usrp_wfm_rcv_pll.py b/gnuradio-examples/python/usrp/usrp_wfm_rcv_pll.py
index a85bcdbf4..bc79fb810 100755
--- a/gnuradio-examples/python/usrp/usrp_wfm_rcv_pll.py
+++ b/gnuradio-examples/python/usrp/usrp_wfm_rcv_pll.py
@@ -167,7 +167,8 @@ class wfm_rx_block (stdgui2.std_top_block):
if 1:
self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from USRP",
- fft_size=512, sample_rate=usrp_rate)
+ fft_size=512, sample_rate=usrp_rate,
+ ref_scale=32768.0, ref_level=0, y_divs=12)
self.connect (self.u, self.src_fft)
vbox.Add (self.src_fft.win, 4, wx.EXPAND)
diff --git a/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py b/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py
index 1d39c7691..75bbc0acd 100755
--- a/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py
+++ b/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py
@@ -228,7 +228,8 @@ class wfm_rx_sca_block (stdgui2.std_top_block):
if 1:
self.src_fft = fftsink2.fft_sink_c(self.panel, title="Data from USRP",
- fft_size=512, sample_rate=usrp_rate)
+ fft_size=512, sample_rate=usrp_rate,
+ ref_scale=32768.0, ref_level=0, y_divs=12)
self.connect (self.u, self.src_fft)
vbox.Add (self.src_fft.win, 4, wx.EXPAND)
diff --git a/gnuradio-examples/python/usrp/usrp_wxapt_rcv.py b/gnuradio-examples/python/usrp/usrp_wxapt_rcv.py
index 983e3ec98..11b8c431f 100755
--- a/gnuradio-examples/python/usrp/usrp_wxapt_rcv.py
+++ b/gnuradio-examples/python/usrp/usrp_wxapt_rcv.py
@@ -148,7 +148,8 @@ class wxapt_rx_block (stdgui2.std_top_block):
if 1:
self.src_fft = fftsink2.fft_sink_c (self.panel, title="Data from USRP",
- fft_size=512, sample_rate=usrp_rate)
+ fft_size=512, sample_rate=usrp_rate,
+ ref_scale=32768.0, ref_level=0, y_divs=12)
self.connect (self.u, self.src_fft)
vbox.Add (self.src_fft.win, 4, wx.EXPAND)
diff --git a/gr-utils/src/python/usrp_fft.py b/gr-utils/src/python/usrp_fft.py
index d549dd4e3..30a06911a 100755
--- a/gr-utils/src/python/usrp_fft.py
+++ b/gr-utils/src/python/usrp_fft.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2005,2007 Free Software Foundation, Inc.
+# Copyright 2004,2005,2007,2008 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -115,7 +115,8 @@ class app_top_block(stdgui2.std_top_block):
elif options.oscilloscope:
self.scope = scopesink2.scope_sink_c(panel, sample_rate=input_rate)
else:
- self.scope = fftsink2.fft_sink_c (panel, fft_size=1024, sample_rate=input_rate, y_divs = 10)
+ self.scope = fftsink2.fft_sink_c (panel, fft_size=1024, sample_rate=input_rate,
+ ref_scale=32768.0, ref_level=0.0, y_divs = 10)
self.connect(self.u, self.scope)
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)