summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/examples/pfb
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/examples/pfb')
-rw-r--r--gnuradio-core/src/examples/pfb/CMakeLists.txt8
-rwxr-xr-xgnuradio-core/src/examples/pfb/channelize.py40
-rwxr-xr-xgnuradio-core/src/examples/pfb/chirp_channelize.py42
-rwxr-xr-xgnuradio-core/src/examples/pfb/decimate.py38
-rwxr-xr-xgnuradio-core/src/examples/pfb/fmtest.py36
-rwxr-xr-xgnuradio-core/src/examples/pfb/interpolate.py42
-rwxr-xr-xgnuradio-core/src/examples/pfb/reconstruction.py14
-rwxr-xr-xgnuradio-core/src/examples/pfb/resampler.py14
-rwxr-xr-xgnuradio-core/src/examples/pfb/synth_filter.py18
-rwxr-xr-xgnuradio-core/src/examples/pfb/synth_to_chan.py20
10 files changed, 136 insertions, 136 deletions
diff --git a/gnuradio-core/src/examples/pfb/CMakeLists.txt b/gnuradio-core/src/examples/pfb/CMakeLists.txt
index 899c47b90d..6bb25568c8 100644
--- a/gnuradio-core/src/examples/pfb/CMakeLists.txt
+++ b/gnuradio-core/src/examples/pfb/CMakeLists.txt
@@ -1,17 +1,17 @@
# Copyright 2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
diff --git a/gnuradio-core/src/examples/pfb/channelize.py b/gnuradio-core/src/examples/pfb/channelize.py
index 2fcb14a360..442f263f47 100755
--- a/gnuradio-core/src/examples/pfb/channelize.py
+++ b/gnuradio-core/src/examples/pfb/channelize.py
@@ -1,24 +1,24 @@
#!/usr/bin/env python
#
# Copyright 2009 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
from gnuradio import gr, blks2
import sys, time
@@ -46,7 +46,7 @@ class pfb_top_block(gr.top_block):
self._M = 9 # Number of channels to channelize
# Create a set of taps for the PFB channelizer
- self._taps = gr.firdes.low_pass_2(1, self._fs, 475.50, 50,
+ self._taps = gr.firdes.low_pass_2(1, self._fs, 475.50, 50,
attenuation_dB=100, window=gr.firdes.WIN_BLACKMAN_hARRIS)
# Calculate the number of taps per channel for our own information
@@ -54,9 +54,9 @@ class pfb_top_block(gr.top_block):
print "Number of taps: ", len(self._taps)
print "Number of channels: ", self._M
print "Taps per channel: ", tpc
-
+
# Create a set of signals at different frequencies
- # freqs lists the frequencies of the signals that get stored
+ # freqs lists the frequencies of the signals that get stored
# in the list "signals", which then get summed together
self.signals = list()
self.add = gr.add_cc()
@@ -79,17 +79,17 @@ class pfb_top_block(gr.top_block):
# Use this to play with the channel mapping
#self.pfb.set_channel_map([5,6,7,8,0,1,2,3,4])
-
+
# Create a vector sink for each of M output channels of the filter and connect it
self.snks = list()
for i in xrange(self._M):
self.snks.append(gr.vector_sink_c())
self.connect((self.pfb, i), self.snks[i])
-
+
def main():
tstart = time.time()
-
+
tb = pfb_top_block()
tb.run()
@@ -100,7 +100,7 @@ def main():
fig_in = pylab.figure(1, figsize=(16,9), facecolor="w")
fig1 = pylab.figure(2, figsize=(16,9), facecolor="w")
fig2 = pylab.figure(3, figsize=(16,9), facecolor="w")
-
+
Ns = 1000
Ne = 10000
@@ -118,8 +118,8 @@ def main():
X_in = 10.0*scipy.log10(abs(X))
f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
pin_f = spin_f.plot(f_in, X_in, "b")
- spin_f.set_xlim([min(f_in), max(f_in)+1])
- spin_f.set_ylim([-200.0, 50.0])
+ spin_f.set_xlim([min(f_in), max(f_in)+1])
+ spin_f.set_ylim([-200.0, 50.0])
spin_f.set_title("Input Signal", weight="bold")
spin_f.set_xlabel("Frequency (Hz)")
@@ -128,7 +128,7 @@ def main():
Ts = 1.0/fs
Tmax = len(d)*Ts
-
+
t_in = scipy.arange(0, Tmax, Ts)
x_in = scipy.array(d)
spin_t = fig_in.add_subplot(2, 1, 2)
@@ -161,8 +161,8 @@ def main():
X_o = 10.0*scipy.log10(abs(X))
f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
p2_f = sp1_f.plot(f_o, X_o, "b")
- sp1_f.set_xlim([min(f_o), max(f_o)+1])
- sp1_f.set_ylim([-200.0, 50.0])
+ sp1_f.set_xlim([min(f_o), max(f_o)+1])
+ sp1_f.set_ylim([-200.0, 50.0])
sp1_f.set_title(("Channel %d" % i), weight="bold")
sp1_f.set_xlabel("Frequency (Hz)")
@@ -173,8 +173,8 @@ def main():
sp2_o = fig2.add_subplot(Nrows, Ncols, 1+i)
p2_o = sp2_o.plot(t_o, x_o.real, "b")
p2_o = sp2_o.plot(t_o, x_o.imag, "r")
- sp2_o.set_xlim([min(t_o), max(t_o)+1])
- sp2_o.set_ylim([-2, 2])
+ sp2_o.set_xlim([min(t_o), max(t_o)+1])
+ sp2_o.set_ylim([-2, 2])
sp2_o.set_title(("Channel %d" % i), weight="bold")
sp2_o.set_xlabel("Time (s)")
@@ -188,4 +188,4 @@ if __name__ == "__main__":
main()
except KeyboardInterrupt:
pass
-
+
diff --git a/gnuradio-core/src/examples/pfb/chirp_channelize.py b/gnuradio-core/src/examples/pfb/chirp_channelize.py
index 951255d3b0..1c485ea9dd 100755
--- a/gnuradio-core/src/examples/pfb/chirp_channelize.py
+++ b/gnuradio-core/src/examples/pfb/chirp_channelize.py
@@ -1,24 +1,24 @@
#!/usr/bin/env python
#
# Copyright 2009 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
from gnuradio import gr, blks2
import sys, time
@@ -46,7 +46,7 @@ class pfb_top_block(gr.top_block):
self._M = 9 # Number of channels to channelize
# Create a set of taps for the PFB channelizer
- self._taps = gr.firdes.low_pass_2(1, self._fs, 500, 20,
+ self._taps = gr.firdes.low_pass_2(1, self._fs, 500, 20,
attenuation_dB=10, window=gr.firdes.WIN_BLACKMAN_hARRIS)
# Calculate the number of taps per channel for our own information
@@ -62,7 +62,7 @@ class pfb_top_block(gr.top_block):
amp = 100
data = scipy.arange(0, amp, amp/float(self._N))
self.vco_input = gr.vector_source_f(data, False)
-
+
# Build a VCO controlled by either the sinusoid or single chirp tone
# Then convert this to a complex signal
self.vco = gr.vco_f(self._fs, 225, 1)
@@ -86,11 +86,11 @@ class pfb_top_block(gr.top_block):
for i in xrange(self._M):
self.snks.append(gr.vector_sink_c())
self.connect((self.pfb, i), self.snks[i])
-
+
def main():
tstart = time.time()
-
+
tb = pfb_top_block()
tb.run()
@@ -102,7 +102,7 @@ def main():
fig1 = pylab.figure(2, figsize=(16,9), facecolor="w")
fig2 = pylab.figure(3, figsize=(16,9), facecolor="w")
fig3 = pylab.figure(4, figsize=(16,9), facecolor="w")
-
+
Ns = 650
Ne = 20000
@@ -120,8 +120,8 @@ def main():
X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
pin_f = spin_f.plot(f_in, X_in, "b")
- spin_f.set_xlim([min(f_in), max(f_in)+1])
- spin_f.set_ylim([-200.0, 50.0])
+ spin_f.set_xlim([min(f_in), max(f_in)+1])
+ spin_f.set_ylim([-200.0, 50.0])
spin_f.set_title("Input Signal", weight="bold")
spin_f.set_xlabel("Frequency (Hz)")
@@ -130,7 +130,7 @@ def main():
Ts = 1.0/fs
Tmax = len(d)*Ts
-
+
t_in = scipy.arange(0, Tmax, Ts)
x_in = scipy.array(d)
spin_t = fig_in.add_subplot(2, 1, 2)
@@ -163,8 +163,8 @@ def main():
X_o = 10.0*scipy.log10(abs(X))
f_o = freq
p2_f = sp1_f.plot(f_o, X_o, "b")
- sp1_f.set_xlim([min(f_o), max(f_o)+1])
- sp1_f.set_ylim([-200.0, 50.0])
+ sp1_f.set_xlim([min(f_o), max(f_o)+1])
+ sp1_f.set_ylim([-200.0, 50.0])
sp1_f.set_title(("Channel %d" % i), weight="bold")
sp1_f.set_xlabel("Frequency (Hz)")
@@ -175,8 +175,8 @@ def main():
sp2_o = fig2.add_subplot(Nrows, Ncols, 1+i)
p2_o = sp2_o.plot(t_o, x_o.real, "b")
p2_o = sp2_o.plot(t_o, x_o.imag, "r")
- sp2_o.set_xlim([min(t_o), max(t_o)+1])
- sp2_o.set_ylim([-2, 2])
+ sp2_o.set_xlim([min(t_o), max(t_o)+1])
+ sp2_o.set_ylim([-2, 2])
sp2_o.set_title(("Channel %d" % i), weight="bold")
sp2_o.set_xlabel("Time (s)")
@@ -185,12 +185,12 @@ def main():
sp3 = fig3.add_subplot(1,1,1)
p3 = sp3.plot(t_o, x_o.real)
- sp3.set_xlim([min(t_o), max(t_o)+1])
- sp3.set_ylim([-2, 2])
+ sp3.set_xlim([min(t_o), max(t_o)+1])
+ sp3.set_ylim([-2, 2])
sp3.set_title("All Channels")
sp3.set_xlabel("Time (s)")
- sp3.set_ylabel("Amplitude")
+ sp3.set_ylabel("Amplitude")
pylab.show()
@@ -200,4 +200,4 @@ if __name__ == "__main__":
main()
except KeyboardInterrupt:
pass
-
+
diff --git a/gnuradio-core/src/examples/pfb/decimate.py b/gnuradio-core/src/examples/pfb/decimate.py
index 643a2c2417..5322d746db 100755
--- a/gnuradio-core/src/examples/pfb/decimate.py
+++ b/gnuradio-core/src/examples/pfb/decimate.py
@@ -1,24 +1,24 @@
#!/usr/bin/env python
#
# Copyright 2009 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
from gnuradio import gr, blks2
import sys, time
@@ -44,7 +44,7 @@ class pfb_top_block(gr.top_block):
self._N = 10000000 # number of samples to use
self._fs = 10000 # initial sampling rate
self._decim = 20 # Decimation rate
-
+
# Generate the prototype filter taps for the decimators with a 200 Hz bandwidth
self._taps = gr.firdes.low_pass_2(1, self._fs, 200, 150,
attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS)
@@ -54,7 +54,7 @@ class pfb_top_block(gr.top_block):
print "Number of taps: ", len(self._taps)
print "Number of filters: ", self._decim
print "Taps per channel: ", tpc
-
+
# Build the input signal source
# We create a list of freqs, and a sine wave is generated and added to the source
# for each one of these frequencies.
@@ -66,7 +66,7 @@ class pfb_top_block(gr.top_block):
self.connect(self.signals[i], (self.add,i))
self.head = gr.head(gr.sizeof_gr_complex, self._N)
-
+
# Construct a PFB decimator filter
self.pfb = blks2.pfb_decimator_ccf(self._decim, self._taps, 0)
@@ -82,12 +82,12 @@ class pfb_top_block(gr.top_block):
# Create the sink for the decimated siganl
self.snk = gr.vector_sink_c()
self.connect(self.pfb, self.snk)
-
+
def main():
tb = pfb_top_block()
- tstart = time.time()
+ tstart = time.time()
tb.run()
tend = time.time()
print "Run time: %f" % (tend - tstart)
@@ -95,7 +95,7 @@ def main():
if 1:
fig1 = pylab.figure(1, figsize=(16,9))
fig2 = pylab.figure(2, figsize=(16,9))
-
+
Ns = 10000
Ne = 10000
@@ -114,13 +114,13 @@ def main():
X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
p1_f = sp1_f.plot(f_in, X_in, "b")
- sp1_f.set_xlim([min(f_in), max(f_in)+1])
- sp1_f.set_ylim([-200.0, 50.0])
+ sp1_f.set_xlim([min(f_in), max(f_in)+1])
+ sp1_f.set_ylim([-200.0, 50.0])
sp1_f.set_title("Input Signal", weight="bold")
sp1_f.set_xlabel("Frequency (Hz)")
sp1_f.set_ylabel("Power (dBW)")
-
+
Ts = 1.0/fs
Tmax = len(d)*Ts
@@ -134,7 +134,7 @@ def main():
sp1_t.set_xlabel("Time (s)")
sp1_t.set_ylabel("Amplitude")
-
+
# Plot the output of the decimator
fs_o = tb._fs / tb._decim
@@ -146,13 +146,13 @@ def main():
X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
p2_f = sp2_f.plot(f_o, X_o, "b")
- sp2_f.set_xlim([min(f_o), max(f_o)+1])
- sp2_f.set_ylim([-200.0, 50.0])
+ sp2_f.set_xlim([min(f_o), max(f_o)+1])
+ sp2_f.set_ylim([-200.0, 50.0])
sp2_f.set_title("PFB Decimated Signal", weight="bold")
sp2_f.set_xlabel("Frequency (Hz)")
sp2_f.set_ylabel("Power (dBW)")
-
+
Ts_o = 1.0/fs_o
Tmax_o = len(d)*Ts_o
@@ -175,4 +175,4 @@ if __name__ == "__main__":
main()
except KeyboardInterrupt:
pass
-
+
diff --git a/gnuradio-core/src/examples/pfb/fmtest.py b/gnuradio-core/src/examples/pfb/fmtest.py
index 635ee4e9ed..b9dd9b3823 100755
--- a/gnuradio-core/src/examples/pfb/fmtest.py
+++ b/gnuradio-core/src/examples/pfb/fmtest.py
@@ -1,24 +1,24 @@
#!/usr/bin/env python
#
# Copyright 2009 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
from gnuradio import gr, blks2
import sys, math, time
@@ -45,7 +45,7 @@ class fmtx(gr.hier_block2):
gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5e3, tau=75e-6)
-
+
# Local oscillator
lo = gr.sig_source_c (if_rate, # sample rate
gr.GR_SIN_WAVE, # waveform type
@@ -53,7 +53,7 @@ class fmtx(gr.hier_block2):
1.0, # amplitude
0) # DC Offset
mixer = gr.multiply_cc ()
-
+
self.connect (self, fmtx, (mixer, 0))
self.connect (lo, (mixer, 1))
self.connect (mixer, self)
@@ -93,7 +93,7 @@ class fmtest(gr.top_block):
bw = chspacing/2.0
t_bw = chspacing/10.0
self._chan_rate = self._if_rate / self._M
- self._taps = gr.firdes.low_pass_2(1, self._if_rate, bw, t_bw,
+ self._taps = gr.firdes.low_pass_2(1, self._if_rate, bw, t_bw,
attenuation_dB=100,
window=gr.firdes.WIN_BLACKMAN_hARRIS)
tpc = math.ceil(float(len(self._taps)) / float(self._M))
@@ -101,11 +101,11 @@ class fmtest(gr.top_block):
print "Number of taps: ", len(self._taps)
print "Number of channels: ", self._M
print "Taps per channel: ", tpc
-
+
self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps)
-
+
self.connect(self.channel, self.pfb)
-
+
# Create a file sink for each of M output channels of the filter and connect it
self.fmdet = list()
self.squelch = list()
@@ -153,8 +153,8 @@ def main():
X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
p1_f = sp1_f.plot(f_in, X_in, "b")
- sp1_f.set_xlim([min(f_in), max(f_in)+1])
- sp1_f.set_ylim([-120.0, 20.0])
+ sp1_f.set_xlim([min(f_in), max(f_in)+1])
+ sp1_f.set_ylim([-120.0, 20.0])
sp1_f.set_title("Input Signal", weight="bold")
sp1_f.set_xlabel("Frequency (Hz)")
@@ -162,7 +162,7 @@ def main():
Ts = 1.0/fs
Tmax = len(d)*Ts
-
+
t_in = scipy.arange(0, Tmax, Ts)
x_in = scipy.array(d)
sp1_t = fig1.add_subplot(2, 1, 2)
@@ -194,8 +194,8 @@ def main():
#f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
f_o = scipy.arange(0, fs_o/2.0, fs_o/2.0/float(X_o.size))
p2_f = sp2_f.plot(f_o, X_o, "b")
- sp2_f.set_xlim([min(f_o), max(f_o)+0.1])
- sp2_f.set_ylim([-120.0, 20.0])
+ sp2_f.set_xlim([min(f_o), max(f_o)+0.1])
+ sp2_f.set_ylim([-120.0, 20.0])
sp2_f.grid(True)
sp2_f.set_title(("Channel %d" % i), weight="bold")
@@ -211,8 +211,8 @@ def main():
sp2_t = fig3.add_subplot(Nrows, Ncols, 1+i)
p2_t = sp2_t.plot(t_o, x_t.real, "b")
p2_t = sp2_t.plot(t_o, x_t.imag, "r")
- sp2_t.set_xlim([min(t_o), max(t_o)+1])
- sp2_t.set_ylim([-1, 1])
+ sp2_t.set_xlim([min(t_o), max(t_o)+1])
+ sp2_t.set_ylim([-1, 1])
sp2_t.set_xlabel("Time (s)")
sp2_t.set_ylabel("Amplitude")
diff --git a/gnuradio-core/src/examples/pfb/interpolate.py b/gnuradio-core/src/examples/pfb/interpolate.py
index 370cf26a72..98068f220b 100755
--- a/gnuradio-core/src/examples/pfb/interpolate.py
+++ b/gnuradio-core/src/examples/pfb/interpolate.py
@@ -1,24 +1,24 @@
#!/usr/bin/env python
#
# Copyright 2009 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
from gnuradio import gr, blks2
import sys, time
@@ -46,13 +46,13 @@ class pfb_top_block(gr.top_block):
self._interp = 5 # Interpolation rate for PFB interpolator
self._ainterp = 5.5 # Resampling rate for the PFB arbitrary resampler
- # Frequencies of the signals we construct
+ # Frequencies of the signals we construct
freq1 = 100
freq2 = 200
# Create a set of taps for the PFB interpolator
# This is based on the post-interpolation sample rate
- self._taps = gr.firdes.low_pass_2(self._interp, self._interp*self._fs, freq2+50, 50,
+ self._taps = gr.firdes.low_pass_2(self._interp, self._interp*self._fs, freq2+50, 50,
attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS)
# Create a set of taps for the PFB arbitrary resampler
@@ -61,7 +61,7 @@ class pfb_top_block(gr.top_block):
# The taps in this filter are based on a sampling rate of the filter size since it acts
# internally as an interpolator.
flt_size = 32
- self._taps2 = gr.firdes.low_pass_2(flt_size, flt_size*self._fs, freq2+50, 150,
+ self._taps2 = gr.firdes.low_pass_2(flt_size, flt_size*self._fs, freq2+50, 150,
attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS)
# Calculate the number of taps per channel for our own information
@@ -74,7 +74,7 @@ class pfb_top_block(gr.top_block):
self.signal1 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq1, 0.5)
self.signal2 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq2, 0.5)
self.signal = gr.add_cc()
-
+
self.head = gr.head(gr.sizeof_gr_complex, self._N)
# Construct the PFB interpolator filter
@@ -86,7 +86,7 @@ class pfb_top_block(gr.top_block):
#self.pfb_ar.pfb.print_taps()
#self.pfb.pfb.print_taps()
-
+
# Connect the blocks
self.connect(self.signal1, self.head, (self.signal,0))
self.connect(self.signal2, (self.signal,1))
@@ -99,7 +99,7 @@ class pfb_top_block(gr.top_block):
self.snk2 = gr.vector_sink_c()
self.connect(self.pfb, self.snk1)
self.connect(self.pfb_ar, self.snk2)
-
+
def main():
tb = pfb_top_block()
@@ -114,7 +114,7 @@ def main():
fig1 = pylab.figure(1, figsize=(12,10), facecolor="w")
fig2 = pylab.figure(2, figsize=(12,10), facecolor="w")
fig3 = pylab.figure(3, figsize=(12,10), facecolor="w")
-
+
Ns = 10000
Ne = 10000
@@ -133,8 +133,8 @@ def main():
X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
p1_f = sp1_f.plot(f_in, X_in, "b")
- sp1_f.set_xlim([min(f_in), max(f_in)+1])
- sp1_f.set_ylim([-200.0, 50.0])
+ sp1_f.set_xlim([min(f_in), max(f_in)+1])
+ sp1_f.set_ylim([-200.0, 50.0])
sp1_f.set_title("Input Signal", weight="bold")
@@ -143,7 +143,7 @@ def main():
Ts = 1.0/fs
Tmax = len(d)*Ts
-
+
t_in = scipy.arange(0, Tmax, Ts)
x_in = scipy.array(d)
sp1_t = fig1.add_subplot(2, 1, 2)
@@ -167,8 +167,8 @@ def main():
X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
f_o = scipy.arange(-fs_int/2.0, fs_int/2.0, fs_int/float(X_o.size))
p2_f = sp2_f.plot(f_o, X_o, "b")
- sp2_f.set_xlim([min(f_o), max(f_o)+1])
- sp2_f.set_ylim([-200.0, 50.0])
+ sp2_f.set_xlim([min(f_o), max(f_o)+1])
+ sp2_f.set_ylim([-200.0, 50.0])
sp2_f.set_title("Output Signal from PFB Interpolator", weight="bold")
sp2_f.set_xlabel("Frequency (Hz)")
@@ -200,8 +200,8 @@ def main():
X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
f_o = scipy.arange(-fs_aint/2.0, fs_aint/2.0, fs_aint/float(X_o.size))
p3_f = sp3_f.plot(f_o, X_o, "b")
- sp3_f.set_xlim([min(f_o), max(f_o)+1])
- sp3_f.set_ylim([-200.0, 50.0])
+ sp3_f.set_xlim([min(f_o), max(f_o)+1])
+ sp3_f.set_ylim([-200.0, 50.0])
sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", weight="bold")
sp3_f.set_xlabel("Frequency (Hz)")
@@ -217,7 +217,7 @@ def main():
p3_f = sp3_f.plot(t_o, x_o1.real, "m-o")
#p3_f = sp3_f.plot(t_o, x_o2.imag, "r-o")
sp3_f.set_ylim([-2.5, 2.5])
-
+
sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", weight="bold")
sp3_f.set_xlabel("Time (s)")
sp3_f.set_ylabel("Amplitude")
@@ -230,4 +230,4 @@ if __name__ == "__main__":
main()
except KeyboardInterrupt:
pass
-
+
diff --git a/gnuradio-core/src/examples/pfb/reconstruction.py b/gnuradio-core/src/examples/pfb/reconstruction.py
index c7909f7a56..59910e4d6d 100755
--- a/gnuradio-core/src/examples/pfb/reconstruction.py
+++ b/gnuradio-core/src/examples/pfb/reconstruction.py
@@ -36,7 +36,7 @@ def main():
# Split it up into pieces
channelizer = blks2.pfb_channelizer_ccf(nchans, proto_taps, 2)
-
+
# Put the pieces back together again
syn_taps = [nchans*t for t in proto_taps]
synthesizer = gr.pfb_synthesizer_ccf(nchans, syn_taps, True)
@@ -48,7 +48,7 @@ def main():
# the channelizer)
synthesizer.set_channel_map([ 0, 1, 2, 3, 4,
15, 16, 17, 18, 19])
-
+
tb = gr.top_block()
tb.connect(src, mod, chan, rrc, channelizer)
tb.connect(rrc, src_snk)
@@ -59,14 +59,14 @@ def main():
vsnk.append(gr.vector_sink_c())
tb.connect((channelizer,i), vsnk[i])
-
+
tb.connect(synthesizer, snk)
tb.run()
-
+
sin = scipy.array(src_snk.data()[1000:])
sout = scipy.array(snk.data()[1000:])
-
+
# Plot original signal
fs_in = nchans*fs
f1 = pylab.figure(1, figsize=(16,12), facecolor='w')
@@ -87,7 +87,7 @@ def main():
s13.set_title("Constellation")
s13.set_xlim([-2, 2])
s13.set_ylim([-2, 2])
-
+
# Plot channels
nrows = int(scipy.sqrt(nchans))
ncols = int(scipy.ceil(float(nchans)/float(nrows)))
@@ -122,7 +122,7 @@ def main():
pylab.show()
-
+
if __name__ == "__main__":
try:
main()
diff --git a/gnuradio-core/src/examples/pfb/resampler.py b/gnuradio-core/src/examples/pfb/resampler.py
index 7b296ca717..555938d281 100755
--- a/gnuradio-core/src/examples/pfb/resampler.py
+++ b/gnuradio-core/src/examples/pfb/resampler.py
@@ -1,24 +1,24 @@
#!/usr/bin/env python
#
# Copyright 2009 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
from gnuradio import gr, blks2
import sys
@@ -38,7 +38,7 @@ except ImportError:
class mytb(gr.top_block):
def __init__(self, fs_in, fs_out, fc, N=10000):
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)
@@ -56,7 +56,7 @@ class mytb(gr.top_block):
# A resampler that just needs a resampling rate.
# Filter is created for us and designed to cover
# entire bandwidth of the input signal.
- # An optional atten=XX rate can be used here to
+ # An optional atten=XX rate can be used here to
# specify the out-of-band rejection (default=80).
self.resamp_1 = blks2.pfb_arb_resampler_ccf(rerate)
diff --git a/gnuradio-core/src/examples/pfb/synth_filter.py b/gnuradio-core/src/examples/pfb/synth_filter.py
index a91edfebf8..c0f7376ec0 100755
--- a/gnuradio-core/src/examples/pfb/synth_filter.py
+++ b/gnuradio-core/src/examples/pfb/synth_filter.py
@@ -1,27 +1,27 @@
#!/usr/bin/env python
#
# Copyright 2010 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
from gnuradio import gr, blks2
-import sys
+import sys
try:
import scipy
@@ -48,7 +48,7 @@ def main():
sigs.append(s)
taps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100)
- print "Num. Taps = %d (taps per filter = %d)" % (len(taps),
+ print "Num. Taps = %d (taps per filter = %d)" % (len(taps),
len(taps)/nchans)
filtbank = gr.pfb_synthesizer_ccf(nchans, taps)
@@ -60,14 +60,14 @@ def main():
for i,si in enumerate(sigs):
tb.connect(si, (filtbank, i))
-
+
tb.run()
if 1:
f1 = pylab.figure(1)
s1 = f1.add_subplot(1,1,1)
s1.plot(snk.data()[1000:])
-
+
fftlen = 2048
f2 = pylab.figure(2)
s2 = f2.add_subplot(1,1,1)
diff --git a/gnuradio-core/src/examples/pfb/synth_to_chan.py b/gnuradio-core/src/examples/pfb/synth_to_chan.py
index c6c80b2f85..18b2e7b53f 100755
--- a/gnuradio-core/src/examples/pfb/synth_to_chan.py
+++ b/gnuradio-core/src/examples/pfb/synth_to_chan.py
@@ -1,27 +1,27 @@
#!/usr/bin/env python
#
# Copyright 2010 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
from gnuradio import gr, blks2
-import sys
+import sys
try:
import scipy
@@ -51,10 +51,10 @@ def main():
fmtx.append(fm)
syntaps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100)
- print "Synthesis Num. Taps = %d (taps per filter = %d)" % (len(syntaps),
+ print "Synthesis Num. Taps = %d (taps per filter = %d)" % (len(syntaps),
len(syntaps)/nchans)
chtaps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100)
- print "Channelizer Num. Taps = %d (taps per filter = %d)" % (len(chtaps),
+ print "Channelizer Num. Taps = %d (taps per filter = %d)" % (len(chtaps),
len(chtaps)/nchans)
filtbank = gr.pfb_synthesizer_ccf(nchans, syntaps)
channelizer = blks2.pfb_channelizer_ccf(nchans, chtaps)
@@ -79,7 +79,7 @@ def main():
for i in xrange(nchans):
snk.append(gr.vector_sink_c())
tb.connect((channelizer, i), snk[i])
-
+
tb.run()
if 1:
@@ -90,7 +90,7 @@ def main():
s1 = f1.add_subplot(1,1,1)
s1.plot(data[10000:10200] )
s1.set_title(("Output Signal from Channel %d" % channel))
-
+
fftlen = 2048
winfunc = scipy.blackman
#winfunc = scipy.hamming