summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py6
-rw-r--r--gnuradio-core/src/python/gnuradio/window.py1
-rw-r--r--gr-wxgui/src/python/fftsink_gl.py3
-rw-r--r--gr-wxgui/src/python/fftsink_nongl.py4
-rw-r--r--gr-wxgui/src/python/waterfallsink_gl.py2
-rw-r--r--grc/blocks/wxgui_fftsink2.xml37
-rw-r--r--grc/blocks/wxgui_numbersink2.xml2
-rw-r--r--grc/blocks/wxgui_waterfallsink2.xml57
8 files changed, 95 insertions, 17 deletions
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py
index 7ef40be40..200c4cfbe 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py
@@ -28,7 +28,7 @@ class _logpwrfft_base(gr.hier_block2):
Create a log10(abs(fft)) stream chain, with real or complex input.
"""
- def __init__(self, sample_rate, fft_size, ref_scale, frame_rate, avg_alpha, average):
+ def __init__(self, sample_rate, fft_size, ref_scale, frame_rate, avg_alpha, average, win=None):
"""
Create an log10(abs(fft)) stream chain.
Provide access to the setting the filter and sample rate.
@@ -38,6 +38,7 @@ class _logpwrfft_base(gr.hier_block2):
@param frame_rate Output frame rate
@param avg_alpha FFT averaging (over time) constant [0.0-1.0]
@param average Whether to average [True, False]
+ @param win the window taps generation function
"""
gr.hier_block2.__init__(self, self._name,
gr.io_signature(1, 1, self._item_size), # Input signature
@@ -48,7 +49,8 @@ class _logpwrfft_base(gr.hier_block2):
vec_rate=frame_rate,
vec_len=fft_size)
- fft_window = window.blackmanharris(fft_size)
+ if win is None: win = window.blackmanharris
+ fft_window = win(fft_size)
fft = self._fft_block[0](fft_size, True, fft_window)
window_power = sum(map(lambda x: x*x, fft_window))
diff --git a/gnuradio-core/src/python/gnuradio/window.py b/gnuradio-core/src/python/gnuradio/window.py
index f89831375..7f6d62b7c 100644
--- a/gnuradio-core/src/python/gnuradio/window.py
+++ b/gnuradio-core/src/python/gnuradio/window.py
@@ -177,3 +177,4 @@ blackmanharris = coswindow((0.35875,0.48829,0.14128,0.01168))
nuttall = coswindow((0.3635819,0.4891775,0.1365995,0.0106411)) # Wikipedia calls this Blackman-Nuttall
nuttall_cfd = coswindow((0.355768,0.487396,0.144232,0.012604)) # Wikipedia calls this Nuttall, continuous first deriv
flattop = coswindow((1.0,1.93,1.29,0.388,0.032)) # Flat top window, coeffs from Wikipedia
+rectangular = lambda fft_size: [1]*fft_size
diff --git a/gr-wxgui/src/python/fftsink_gl.py b/gr-wxgui/src/python/fftsink_gl.py
index 9d683d697..9b2f9a487 100644
--- a/gr-wxgui/src/python/fftsink_gl.py
+++ b/gr-wxgui/src/python/fftsink_gl.py
@@ -52,6 +52,8 @@ class _fft_sink_base(gr.hier_block2, common.wxgui_hb):
title='',
size=fft_window.DEFAULT_WIN_SIZE,
peak_hold=False,
+ win=None,
+ **kwargs #do not end with a comma
):
#ensure avg alpha
if avg_alpha is None: avg_alpha = 2.0/fft_rate
@@ -70,6 +72,7 @@ class _fft_sink_base(gr.hier_block2, common.wxgui_hb):
ref_scale=ref_scale,
avg_alpha=avg_alpha,
average=average,
+ win=win,
)
msgq = gr.msg_queue(2)
sink = gr.message_sink(gr.sizeof_float*fft_size, msgq, True)
diff --git a/gr-wxgui/src/python/fftsink_nongl.py b/gr-wxgui/src/python/fftsink_nongl.py
index ca5e91fdb..b3a48a716 100644
--- a/gr-wxgui/src/python/fftsink_nongl.py
+++ b/gr-wxgui/src/python/fftsink_nongl.py
@@ -93,7 +93,7 @@ class fft_sink_f(gr.hier_block2, fft_sink_base):
def __init__(self, parent, baseband_freq=0, ref_scale=2.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):
+ title='', size=default_fftsink_size, peak_hold=False, **kwargs):
gr.hier_block2.__init__(self, "fft_sink_f",
gr.io_signature(1, 1, gr.sizeof_float),
@@ -136,7 +136,7 @@ class fft_sink_c(gr.hier_block2, fft_sink_base):
def __init__(self, parent, baseband_freq=0, ref_scale=2.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):
+ title='', size=default_fftsink_size, peak_hold=False, **kwargs):
gr.hier_block2.__init__(self, "fft_sink_c",
gr.io_signature(1, 1, gr.sizeof_gr_complex),
diff --git a/gr-wxgui/src/python/waterfallsink_gl.py b/gr-wxgui/src/python/waterfallsink_gl.py
index 37844399e..c6b0df65c 100644
--- a/gr-wxgui/src/python/waterfallsink_gl.py
+++ b/gr-wxgui/src/python/waterfallsink_gl.py
@@ -51,6 +51,7 @@ class _waterfall_sink_base(gr.hier_block2, common.wxgui_hb):
ref_scale=2.0,
dynamic_range=80,
num_lines=256,
+ win=None,
**kwargs #do not end with a comma
):
#ensure avg alpha
@@ -70,6 +71,7 @@ class _waterfall_sink_base(gr.hier_block2, common.wxgui_hb):
ref_scale=ref_scale,
avg_alpha=avg_alpha,
average=average,
+ win=win,
)
msgq = gr.msg_queue(2)
sink = gr.message_sink(gr.sizeof_float*fft_size, msgq, True)
diff --git a/grc/blocks/wxgui_fftsink2.xml b/grc/blocks/wxgui_fftsink2.xml
index 42bca5ccf..8df8f90d0 100644
--- a/grc/blocks/wxgui_fftsink2.xml
+++ b/grc/blocks/wxgui_fftsink2.xml
@@ -7,6 +7,7 @@
<block>
<name>FFT Sink</name>
<key>wxgui_fftsink2</key>
+ <import>from gnuradio import window</import>
<import>from gnuradio.wxgui import fftsink2</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
fftsink2.$(type.fcn)(
@@ -23,6 +24,9 @@ fftsink2.$(type.fcn)(
avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#,
title=$title,
peak_hold=$peak_hold,
+#if $win()
+ win=$win,
+#end if
#if $win_size()
size=$win_size,
#end if
@@ -144,7 +148,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<key>average</key>
<value>False</value>
<type>enum</type>
- <hide>#if $average() == 'True' then 'none' else 'part'#</hide>
+ <hide>part</hide>
<option>
<name>On</name>
<key>True</key>
@@ -162,6 +166,37 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<hide>#if $average() == 'True' then 'none' else 'all'#</hide>
</param>
<param>
+ <name>Window</name>
+ <key>win</key>
+ <value>None</value>
+ <type>raw</type>
+ <hide>#if $win() is None then 'part' else 'none'#</hide>
+ <option>
+ <name>Automatic</name>
+ <key>None</key>
+ </option>
+ <option>
+ <name>Blackman-Harris</name>
+ <key>window.blackmanharris</key>
+ </option>
+ <option>
+ <name>Hamming</name>
+ <key>window.hamming</key>
+ </option>
+ <option>
+ <name>Hanning</name>
+ <key>window.hanning</key>
+ </option>
+ <option>
+ <name>Rectangular</name>
+ <key>window.rectangular</key>
+ </option>
+ <option>
+ <name>Flattop</name>
+ <key>window.flattop</key>
+ </option>
+ </param>
+ <param>
<name>Window Size</name>
<key>win_size</key>
<value></value>
diff --git a/grc/blocks/wxgui_numbersink2.xml b/grc/blocks/wxgui_numbersink2.xml
index 5289db8af..ad93dec08 100644
--- a/grc/blocks/wxgui_numbersink2.xml
+++ b/grc/blocks/wxgui_numbersink2.xml
@@ -123,7 +123,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<key>average</key>
<value>False</value>
<type>enum</type>
- <hide>#if $average() == 'True' then 'none' else 'part'#</hide>
+ <hide>part</hide>
<option>
<name>On</name>
<key>True</key>
diff --git a/grc/blocks/wxgui_waterfallsink2.xml b/grc/blocks/wxgui_waterfallsink2.xml
index cee598990..3de67597f 100644
--- a/grc/blocks/wxgui_waterfallsink2.xml
+++ b/grc/blocks/wxgui_waterfallsink2.xml
@@ -7,6 +7,7 @@
<block>
<name>Waterfall Sink</name>
<key>wxgui_waterfallsink2</key>
+ <import>from gnuradio import window</import>
<import>from gnuradio.wxgui import waterfallsink2</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
waterfallsink2.$(type.fcn)(
@@ -18,9 +19,12 @@ waterfallsink2.$(type.fcn)(
sample_rate=$samp_rate,
fft_size=$fft_size,
fft_rate=$fft_rate,
- average=$options.average,
+ average=$average,
avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#,
title=$title,
+#if $win()
+ win=$win,
+#end if
#if $win_size()
size=$win_size,
#end if
@@ -97,25 +101,56 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<type>int</type>
</param>
<param>
+ <name>Average</name>
+ <key>average</key>
+ <value>False</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
<name>Average Alpha</name>
<key>avg_alpha</key>
<value>0</value>
<type>real</type>
+ <hide>#if $average() == 'True' then 'none' else 'all'#</hide>
</param>
<param>
- <name>Options</name>
- <key>options</key>
- <value>none</value>
- <type>enum</type>
+ <name>Window</name>
+ <key>win</key>
+ <value>None</value>
+ <type>raw</type>
+ <hide>#if $win() is None then 'part' else 'none'#</hide>
+ <option>
+ <name>Automatic</name>
+ <key>None</key>
+ </option>
+ <option>
+ <name>Blackman-Harris</name>
+ <key>window.blackmanharris</key>
+ </option>
+ <option>
+ <name>Hamming</name>
+ <key>window.hamming</key>
+ </option>
+ <option>
+ <name>Hanning</name>
+ <key>window.hanning</key>
+ </option>
<option>
- <name>None</name>
- <key>none</key>
- <opt>average:False</opt>
+ <name>Rectangular</name>
+ <key>window.rectangular</key>
</option>
<option>
- <name>Average</name>
- <key>average</key>
- <opt>average:True</opt>
+ <name>Flattop</name>
+ <key>window.flattop</key>
</option>
</param>
<param>