From 3b3d1ea269e9f16ed4b34636f45a9e2fc428f2ec Mon Sep 17 00:00:00 2001
From: Jeff Long <willcode4@gmail.com>
Date: Fri, 13 Aug 2021 16:16:35 -0400
Subject: gr-fft: add "shift" param to logpwrfft block

Contributed by Marcus Leech

Signed-off-by: Jeff Long <willcode4@gmail.com>
---
 gr-fft/python/fft/logpwrfft.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'gr-fft/python/fft/logpwrfft.py')

diff --git a/gr-fft/python/fft/logpwrfft.py b/gr-fft/python/fft/logpwrfft.py
index f3c27342cd..82f852e190 100644
--- a/gr-fft/python/fft/logpwrfft.py
+++ b/gr-fft/python/fft/logpwrfft.py
@@ -26,7 +26,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, win=None):
+    def __init__(self, sample_rate, fft_size, ref_scale, frame_rate, avg_alpha, average, win=None, shift=False):
         """
         Create an log10(abs(fft)) stream chain.
         Provide access to the setting the filter and sample rate.
@@ -39,6 +39,7 @@ class _logpwrfft_base(gr.hier_block2):
             avg_alpha: FFT averaging (over time) constant [0.0-1.0]
             average: Whether to average [True, False]
             win: the window taps generation function
+            shift: shift zero-frequency component to center of spectrum
         """
         gr.hier_block2.__init__(self, self._name,
                                 gr.io_signature(1, 1, self._item_size),          # Input signature
@@ -48,10 +49,9 @@ class _logpwrfft_base(gr.hier_block2):
                                                      sample_rate=sample_rate,
                                                      vec_rate=frame_rate,
                                                      vec_len=fft_size)
-
         if win is None: win = window.blackmanharris
         fft_window = win(fft_size)
-        fft = self._fft_block[0](fft_size, True, fft_window)
+        fft = self._fft_block[0](fft_size, True, fft_window, shift=shift)
         window_power = sum([x*x for x in fft_window])
 
         c2magsq = blocks.complex_to_mag_squared(fft_size)
-- 
cgit v1.2.3