From 9e625c4821f4c63421b3d3747c0c4f358fef6c5f Mon Sep 17 00:00:00 2001
From: Douglas Anderson <danderson@ntia.doc.gov>
Date: Sun, 12 Feb 2017 15:52:19 -0800
Subject: python3: update non-GRC components to use python2 or python3

---
 gr-filter/examples/resampler.py | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)
 mode change 100755 => 100644 gr-filter/examples/resampler.py

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

diff --git a/gr-filter/examples/resampler.py b/gr-filter/examples/resampler.py
old mode 100755
new mode 100644
index e329f062d0..29b25629cc
--- a/gr-filter/examples/resampler.py
+++ b/gr-filter/examples/resampler.py
@@ -20,6 +20,9 @@
 # Boston, MA 02110-1301, USA.
 #
 
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
 from gnuradio import gr
 from gnuradio import filter
 from gnuradio import blocks
@@ -48,7 +51,7 @@ class mytb(gr.top_block):
         gr.top_block.__init__(self)
 
         rerate = float(fs_out) / float(fs_in)
-        print "Resampling from %f to %f by %f " %(fs_in, fs_out, rerate)
+        print("Resampling from %f to %f by %f " %(fs_in, fs_out, rerate))
 
         # Creating our own taps
         taps = filter.firdes.low_pass_2(32, 32, 0.25, 0.1, 80)
@@ -91,31 +94,31 @@ def main():
     fig1 = pylab.figure(1, figsize=(10,10), facecolor="w")
     sp1 = fig1.add_subplot(2,1,1)
     sp1.psd(tb.snk_in.data(), NFFT=nfftsize,
-            noverlap=nfftsize/4, Fs = fs_in)
-    sp1.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0)))
-    sp1.set_xlim([-fs_in/2, fs_in/2])
+            noverlap=nfftsize / 4, Fs = fs_in)
+    sp1.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in / 1000.0)))
+    sp1.set_xlim([-fs_in / 2, fs_in / 2])
 
     sp2 = fig1.add_subplot(2,1,2)
     sp2.psd(tb.snk_0.data(), NFFT=nfftsize,
-            noverlap=nfftsize/4, Fs = fs_out,
+            noverlap=nfftsize / 4, Fs = fs_out,
             label="With our filter")
     sp2.psd(tb.snk_1.data(), NFFT=nfftsize,
-            noverlap=nfftsize/4, Fs = fs_out,
+            noverlap=nfftsize / 4, Fs = fs_out,
             label="With auto-generated filter")
-    sp2.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0)))
-    sp2.set_xlim([-fs_out/2, fs_out/2])
+    sp2.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out / 1000.0)))
+    sp2.set_xlim([-fs_out / 2, fs_out / 2])
     sp2.legend()
 
     # Plot signals in time
-    Ts_in = 1.0/fs_in
-    Ts_out = 1.0/fs_out
+    Ts_in = 1.0 / fs_in
+    Ts_out = 1.0 / fs_out
     t_in = scipy.arange(0, len(tb.snk_in.data())*Ts_in, Ts_in)
     t_out = scipy.arange(0, len(tb.snk_0.data())*Ts_out, Ts_out)
 
     fig2 = pylab.figure(2, figsize=(10,10), facecolor="w")
     sp21 = fig2.add_subplot(2,1,1)
     sp21.plot(t_in, tb.snk_in.data())
-    sp21.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0)))
+    sp21.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in / 1000.0)))
     sp21.set_xlim([t_in[100], t_in[200]])
 
     sp22 = fig2.add_subplot(2,1,2)
@@ -123,8 +126,8 @@ def main():
               label="With our filter")
     sp22.plot(t_out, tb.snk_1.data(),
               label="With auto-generated filter")
-    sp22.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0)))
-    r = float(fs_out)/float(fs_in)
+    sp22.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out / 1000.0)))
+    r = float(fs_out) / float(fs_in)
     sp22.set_xlim([t_out[r * 100], t_out[r * 200]])
     sp22.legend()
 
-- 
cgit v1.2.3