From 09cd2d7cccf0a472ee2623c4a388a4ce950c0c5c Mon Sep 17 00:00:00 2001
From: Josh Morman <jmorman@gnuradio.org>
Date: Wed, 24 Nov 2021 12:34:58 -0500
Subject: filter: pep8 formatting

Signed-off-by: Josh Morman <jmorman@gnuradio.org>
---
 gr-filter/examples/reconstruction.py | 46 +++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 24 deletions(-)

(limited to 'gr-filter/examples/reconstruction.py')

diff --git a/gr-filter/examples/reconstruction.py b/gr-filter/examples/reconstruction.py
index 8b65f70deb..2a34f9e33f 100644
--- a/gr-filter/examples/reconstruction.py
+++ b/gr-filter/examples/reconstruction.py
@@ -29,11 +29,12 @@ except ImportError:
 
 fftlen = 8192
 
+
 def main():
     N = 10000
     fs = 2000.0
     Ts = 1.0 / fs
-    t = numpy.arange(0, N*Ts, Ts)
+    t = numpy.arange(0, N * Ts, Ts)
 
     # When playing with the number of channels, be careful about the filter
     # specs and the channel map of the synthesizer set below.
@@ -42,12 +43,11 @@ def main():
     # Build the filter(s)
     bw = 1000
     tb = 400
-    proto_taps = filter.firdes.low_pass_2(1, nchans*fs,
+    proto_taps = filter.firdes.low_pass_2(1, nchans * fs,
                                           bw, tb, 80,
                                           window.WIN_BLACKMAN_hARRIS)
     print("Filter length: ", len(proto_taps))
 
-
     # Create a modulated signal
     npwr = 0.01
     data = numpy.random.randint(0, 256, N)
@@ -62,7 +62,7 @@ def main():
     channelizer = filter.pfb.channelizer_ccf(nchans, proto_taps, 2)
 
     # Put the pieces back together again
-    syn_taps = [nchans*t for t in proto_taps]
+    syn_taps = [nchans * t for t in proto_taps]
     synthesizer = filter.pfb_synthesizer_ccf(nchans, syn_taps, True)
     src_snk = blocks.vector_sink_c()
     snk = blocks.vector_sink_c()
@@ -70,7 +70,7 @@ def main():
     # Remap the location of the channels
     # Can be done in synth or channelizer (watch out for rotattions in
     # the channelizer)
-    synthesizer.set_channel_map([ 0,  1,  2,  3,  4,
+    synthesizer.set_channel_map([0, 1, 2, 3, 4,
                                  15, 16, 17, 18, 19])
 
     tb = gr.top_block()
@@ -79,34 +79,33 @@ def main():
 
     vsnk = []
     for i in range(nchans):
-        tb.connect((channelizer,i), (synthesizer, i))
+        tb.connect((channelizer, i), (synthesizer, i))
 
         vsnk.append(blocks.vector_sink_c())
-        tb.connect((channelizer,i), vsnk[i])
+        tb.connect((channelizer, i), vsnk[i])
 
     tb.connect(synthesizer, snk)
     tb.run()
 
-    sin  = numpy.array(src_snk.data()[1000:])
+    sin = numpy.array(src_snk.data()[1000:])
     sout = numpy.array(snk.data()[1000:])
 
-
     # Plot original signal
-    fs_in = nchans*fs
-    f1 = pyplot.figure(1, figsize=(16,12), facecolor='w')
-    s11 = f1.add_subplot(2,2,1)
+    fs_in = nchans * fs
+    f1 = pyplot.figure(1, figsize=(16, 12), facecolor='w')
+    s11 = f1.add_subplot(2, 2, 1)
     s11.psd(sin, NFFT=fftlen, Fs=fs_in)
     s11.set_title("PSD of Original Signal")
     s11.set_ylim([-200, -20])
 
-    s12 = f1.add_subplot(2,2,2)
+    s12 = f1.add_subplot(2, 2, 2)
     s12.plot(sin.real[1000:1500], "o-b")
     s12.plot(sin.imag[1000:1500], "o-r")
     s12.set_title("Original Signal in Time")
 
     start = 1
-    skip  = 2
-    s13 = f1.add_subplot(2,2,3)
+    skip = 2
+    s13 = f1.add_subplot(2, 2, 3)
     s13.plot(sin.real[start::skip], sin.imag[start::skip], "o")
     s13.set_title("Constellation")
     s13.set_xlim([-2, 2])
@@ -116,29 +115,29 @@ def main():
     nrows = int(numpy.sqrt(nchans))
     ncols = int(numpy.ceil(float(nchans) / float(nrows)))
 
-    f2 = pyplot.figure(2, figsize=(16,12), facecolor='w')
+    f2 = pyplot.figure(2, figsize=(16, 12), facecolor='w')
     for n in range(nchans):
-        s = f2.add_subplot(nrows, ncols, n+1)
+        s = f2.add_subplot(nrows, ncols, n + 1)
         s.psd(vsnk[n].data(), NFFT=fftlen, Fs=fs_in)
         s.set_title("Channel {0}".format(n))
         s.set_ylim([-200, -20])
 
     # Plot reconstructed signal
-    fs_out = 2*nchans*fs
-    f3 = pyplot.figure(3, figsize=(16,12), facecolor='w')
-    s31 = f3.add_subplot(2,2,1)
+    fs_out = 2 * nchans * fs
+    f3 = pyplot.figure(3, figsize=(16, 12), facecolor='w')
+    s31 = f3.add_subplot(2, 2, 1)
     s31.psd(sout, NFFT=fftlen, Fs=fs_out)
     s31.set_title("PSD of Reconstructed Signal")
     s31.set_ylim([-200, -20])
 
-    s32 = f3.add_subplot(2,2,2)
+    s32 = f3.add_subplot(2, 2, 2)
     s32.plot(sout.real[1000:1500], "o-b")
     s32.plot(sout.imag[1000:1500], "o-r")
     s32.set_title("Reconstructed Signal in Time")
 
     start = 0
-    skip  = 4
-    s33 = f3.add_subplot(2,2,3)
+    skip = 4
+    s33 = f3.add_subplot(2, 2, 3)
     s33.plot(sout.real[start::skip], sout.imag[start::skip], "o")
     s33.set_title("Constellation")
     s33.set_xlim([-2, 2])
@@ -152,4 +151,3 @@ if __name__ == "__main__":
         main()
     except KeyboardInterrupt:
         pass
-
-- 
cgit v1.2.3