summaryrefslogtreecommitdiff
path: root/gnuradio-examples
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-examples')
-rw-r--r--gnuradio-examples/.gitignore25
-rw-r--r--gnuradio-examples/c++/.gitignore5
-rw-r--r--gnuradio-examples/c++/dial_tone/.gitignore5
-rw-r--r--gnuradio-examples/python/.gitignore10
-rw-r--r--gnuradio-examples/python/Makefile.am1
-rw-r--r--gnuradio-examples/python/apps/.gitignore2
-rw-r--r--gnuradio-examples/python/apps/hf_explorer/.gitignore3
-rw-r--r--gnuradio-examples/python/apps/hf_radio/.gitignore3
-rw-r--r--gnuradio-examples/python/audio/.gitignore10
-rw-r--r--gnuradio-examples/python/digital-bert/.gitignore2
-rw-r--r--gnuradio-examples/python/digital/.gitignore11
-rw-r--r--gnuradio-examples/python/digital_voice/.gitignore10
-rw-r--r--gnuradio-examples/python/mp-sched/.gitignore10
-rw-r--r--gnuradio-examples/python/multi-antenna/.gitignore11
-rw-r--r--gnuradio-examples/python/multi_usrp/.gitignore10
-rw-r--r--gnuradio-examples/python/network/.gitignore2
-rw-r--r--gnuradio-examples/python/ofdm/.gitignore4
-rw-r--r--gnuradio-examples/python/pfb/.gitignore2
-rw-r--r--gnuradio-examples/python/pfb/Makefile.am31
-rwxr-xr-xgnuradio-examples/python/pfb/channelize.py177
-rwxr-xr-xgnuradio-examples/python/pfb/chirp_channelize.py192
-rwxr-xr-xgnuradio-examples/python/pfb/decimate.py171
-rwxr-xr-xgnuradio-examples/python/pfb/fmtest.py197
-rwxr-xr-xgnuradio-examples/python/pfb/interpolate.py226
-rw-r--r--gnuradio-examples/python/usrp/.gitignore10
-rw-r--r--gnuradio-examples/python/usrp2/.gitignore2
26 files changed, 1132 insertions, 0 deletions
diff --git a/gnuradio-examples/.gitignore b/gnuradio-examples/.gitignore
new file mode 100644
index 000000000..29ec71e01
--- /dev/null
+++ b/gnuradio-examples/.gitignore
@@ -0,0 +1,25 @@
+/Makefile
+/Makefile.in
+/aclocal.m4
+/configure
+/config.h.in
+/stamp-h.in
+/libtool
+/config.log
+/config.h
+/config.cache
+/config.status
+/missing
+/stamp-h
+/stamp-h1
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/autom4te.cache
+/*.cache
+/missing
+/make.log
+/gnuradio.pc
diff --git a/gnuradio-examples/c++/.gitignore b/gnuradio-examples/c++/.gitignore
new file mode 100644
index 000000000..19dd0e0a5
--- /dev/null
+++ b/gnuradio-examples/c++/.gitignore
@@ -0,0 +1,5 @@
+/.deps
+/.libs
+/Makefile
+/Makefile.in
+/dialtone
diff --git a/gnuradio-examples/c++/dial_tone/.gitignore b/gnuradio-examples/c++/dial_tone/.gitignore
new file mode 100644
index 000000000..c5e345858
--- /dev/null
+++ b/gnuradio-examples/c++/dial_tone/.gitignore
@@ -0,0 +1,5 @@
+/.deps
+/.libs
+/Makefile
+/Makefile.in
+/dial_tone
diff --git a/gnuradio-examples/python/.gitignore b/gnuradio-examples/python/.gitignore
new file mode 100644
index 000000000..c400497f5
--- /dev/null
+++ b/gnuradio-examples/python/.gitignore
@@ -0,0 +1,10 @@
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
diff --git a/gnuradio-examples/python/Makefile.am b/gnuradio-examples/python/Makefile.am
index 3a1acf51d..ea03b438f 100644
--- a/gnuradio-examples/python/Makefile.am
+++ b/gnuradio-examples/python/Makefile.am
@@ -32,5 +32,6 @@ SUBDIRS = \
multi_usrp \
network \
ofdm \
+ pfb \
usrp \
usrp2
diff --git a/gnuradio-examples/python/apps/.gitignore b/gnuradio-examples/python/apps/.gitignore
new file mode 100644
index 000000000..b336cc7ce
--- /dev/null
+++ b/gnuradio-examples/python/apps/.gitignore
@@ -0,0 +1,2 @@
+/Makefile
+/Makefile.in
diff --git a/gnuradio-examples/python/apps/hf_explorer/.gitignore b/gnuradio-examples/python/apps/hf_explorer/.gitignore
new file mode 100644
index 000000000..b6950912c
--- /dev/null
+++ b/gnuradio-examples/python/apps/hf_explorer/.gitignore
@@ -0,0 +1,3 @@
+/Makefile
+/Makefile.in
+/*.pyc
diff --git a/gnuradio-examples/python/apps/hf_radio/.gitignore b/gnuradio-examples/python/apps/hf_radio/.gitignore
new file mode 100644
index 000000000..b6950912c
--- /dev/null
+++ b/gnuradio-examples/python/apps/hf_radio/.gitignore
@@ -0,0 +1,3 @@
+/Makefile
+/Makefile.in
+/*.pyc
diff --git a/gnuradio-examples/python/audio/.gitignore b/gnuradio-examples/python/audio/.gitignore
new file mode 100644
index 000000000..c400497f5
--- /dev/null
+++ b/gnuradio-examples/python/audio/.gitignore
@@ -0,0 +1,10 @@
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
diff --git a/gnuradio-examples/python/digital-bert/.gitignore b/gnuradio-examples/python/digital-bert/.gitignore
new file mode 100644
index 000000000..b336cc7ce
--- /dev/null
+++ b/gnuradio-examples/python/digital-bert/.gitignore
@@ -0,0 +1,2 @@
+/Makefile
+/Makefile.in
diff --git a/gnuradio-examples/python/digital/.gitignore b/gnuradio-examples/python/digital/.gitignore
new file mode 100644
index 000000000..ff40c06f3
--- /dev/null
+++ b/gnuradio-examples/python/digital/.gitignore
@@ -0,0 +1,11 @@
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
+/*.dat
diff --git a/gnuradio-examples/python/digital_voice/.gitignore b/gnuradio-examples/python/digital_voice/.gitignore
new file mode 100644
index 000000000..c400497f5
--- /dev/null
+++ b/gnuradio-examples/python/digital_voice/.gitignore
@@ -0,0 +1,10 @@
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
diff --git a/gnuradio-examples/python/mp-sched/.gitignore b/gnuradio-examples/python/mp-sched/.gitignore
new file mode 100644
index 000000000..c400497f5
--- /dev/null
+++ b/gnuradio-examples/python/mp-sched/.gitignore
@@ -0,0 +1,10 @@
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
diff --git a/gnuradio-examples/python/multi-antenna/.gitignore b/gnuradio-examples/python/multi-antenna/.gitignore
new file mode 100644
index 000000000..ff40c06f3
--- /dev/null
+++ b/gnuradio-examples/python/multi-antenna/.gitignore
@@ -0,0 +1,11 @@
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
+/*.dat
diff --git a/gnuradio-examples/python/multi_usrp/.gitignore b/gnuradio-examples/python/multi_usrp/.gitignore
new file mode 100644
index 000000000..c400497f5
--- /dev/null
+++ b/gnuradio-examples/python/multi_usrp/.gitignore
@@ -0,0 +1,10 @@
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
diff --git a/gnuradio-examples/python/network/.gitignore b/gnuradio-examples/python/network/.gitignore
new file mode 100644
index 000000000..b336cc7ce
--- /dev/null
+++ b/gnuradio-examples/python/network/.gitignore
@@ -0,0 +1,2 @@
+/Makefile
+/Makefile.in
diff --git a/gnuradio-examples/python/ofdm/.gitignore b/gnuradio-examples/python/ofdm/.gitignore
new file mode 100644
index 000000000..2f6a10e95
--- /dev/null
+++ b/gnuradio-examples/python/ofdm/.gitignore
@@ -0,0 +1,4 @@
+/Makefile
+/Makefile.in
+/*.pyc
+/*.dat
diff --git a/gnuradio-examples/python/pfb/.gitignore b/gnuradio-examples/python/pfb/.gitignore
new file mode 100644
index 000000000..282522db0
--- /dev/null
+++ b/gnuradio-examples/python/pfb/.gitignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/gnuradio-examples/python/pfb/Makefile.am b/gnuradio-examples/python/pfb/Makefile.am
new file mode 100644
index 000000000..4aa9248ea
--- /dev/null
+++ b/gnuradio-examples/python/pfb/Makefile.am
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+include $(top_srcdir)/Makefile.common
+
+ourdatadir = $(exampledir)/pfb
+
+dist_ourdata_SCRIPTS = \
+ channelize.py \
+ chirp_channelize.py \
+ decimate.py \
+ interpolate.py \
+ fmtest.py
diff --git a/gnuradio-examples/python/pfb/channelize.py b/gnuradio-examples/python/pfb/channelize.py
new file mode 100755
index 000000000..bc83fae27
--- /dev/null
+++ b/gnuradio-examples/python/pfb/channelize.py
@@ -0,0 +1,177 @@
+#!/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 os, time
+import scipy, pylab
+from scipy import fftpack
+from pylab import mlab
+
+class pfb_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._N = 2000000 # number of samples to use
+ self._fs = 9000 # initial sampling rate
+ 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,
+ attenuation_dB=10, window=gr.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Calculate the number of taps per channel for our own information
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._M))
+ 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
+ # in the list "signals", which then get summed together
+ self.signals = list()
+ self.add = gr.add_cc()
+ freqs = [-4070, -3050, -2030, -1010, 10, 1020, 2040, 3060, 4080]
+ for i in xrange(len(freqs)):
+ self.signals.append(gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freqs[i], 1))
+ self.connect(self.signals[i], (self.add,i))
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._N)
+
+ # Construct the channelizer filter
+ self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps)
+
+ # Construct a vector sink for the input signal to the channelizer
+ self.snk_i = gr.vector_sink_c()
+
+ # Connect the blocks
+ self.connect(self.add, self.head, self.pfb)
+ self.connect(self.add, self.snk_i)
+
+ # 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()
+
+ tend = time.time()
+ print "Run time: %f" % (tend - tstart)
+
+ if 1:
+ 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
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+ fs = tb._fs
+
+ # Plot the input signal on its own figure
+ d = tb.snk_i.data()[Ns:Ne]
+ spin_f = fig_in.add_subplot(2, 1, 1)
+
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ 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_title("Input Signal", weight="bold")
+ spin_f.set_xlabel("Frequency (Hz)")
+ spin_f.set_ylabel("Power (dBW)")
+
+
+ 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)
+ pin_t = spin_t.plot(t_in, x_in.real, "b")
+ pin_t = spin_t.plot(t_in, x_in.imag, "r")
+
+ spin_t.set_xlabel("Time (s)")
+ spin_t.set_ylabel("Amplitude")
+
+ Ncols = int(scipy.floor(scipy.sqrt(tb._M)))
+ Nrows = int(scipy.floor(tb._M / Ncols))
+ if(tb._M % Ncols != 0):
+ Nrows += 1
+
+ # Plot each of the channels outputs. Frequencies on Figure 2 and
+ # time signals on Figure 3
+ fs_o = tb._fs / tb._M
+ Ts_o = 1.0/fs_o
+ Tmax_o = len(d)*Ts_o
+ for i in xrange(len(tb.snks)):
+ # remove issues with the transients at the beginning
+ # also remove some corruption at the end of the stream
+ # this is a bug, probably due to the corner cases
+ d = tb.snks[i].data()[Ns:Ne]
+
+ sp1_f = fig1.add_subplot(Nrows, Ncols, 1+i)
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ 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 = 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_title(("Channel %d" % i), weight="bold")
+ sp1_f.set_xlabel("Frequency (Hz)")
+ sp1_f.set_ylabel("Power (dBW)")
+
+ x_o = scipy.array(d)
+ t_o = scipy.arange(0, Tmax_o, Ts_o)
+ 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_title(("Channel %d" % i), weight="bold")
+ sp2_o.set_xlabel("Time (s)")
+ sp2_o.set_ylabel("Amplitude")
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gnuradio-examples/python/pfb/chirp_channelize.py b/gnuradio-examples/python/pfb/chirp_channelize.py
new file mode 100755
index 000000000..edebf5f59
--- /dev/null
+++ b/gnuradio-examples/python/pfb/chirp_channelize.py
@@ -0,0 +1,192 @@
+#!/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 os, time
+import scipy, pylab
+from scipy import fftpack
+from pylab import mlab
+
+class pfb_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._N = 200000 # number of samples to use
+ self._fs = 9000 # initial sampling rate
+ 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,
+ attenuation_dB=10, window=gr.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Calculate the number of taps per channel for our own information
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._M))
+ print "Number of taps: ", len(self._taps)
+ print "Number of channels: ", self._M
+ print "Taps per channel: ", tpc
+
+ repeated = True
+ if(repeated):
+ self.vco_input = gr.sig_source_f(self._fs, gr.GR_SIN_WAVE, 0.25, 110)
+ else:
+ 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)
+ self.f2c = gr.float_to_complex()
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._N)
+
+ # Construct the channelizer filter
+ self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps)
+
+ # Construct a vector sink for the input signal to the channelizer
+ self.snk_i = gr.vector_sink_c()
+
+ # Connect the blocks
+ self.connect(self.vco_input, self.vco, self.f2c)
+ self.connect(self.f2c, self.head, self.pfb)
+ self.connect(self.f2c, self.snk_i)
+
+ # 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()
+
+ tend = time.time()
+ print "Run time: %f" % (tend - tstart)
+
+ if 1:
+ 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")
+ fig3 = pylab.figure(4, figsize=(16,9), facecolor="w")
+
+ Ns = 650
+ Ne = 20000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+ fs = tb._fs
+
+ # Plot the input signal on its own figure
+ d = tb.snk_i.data()[Ns:Ne]
+ spin_f = fig_in.add_subplot(2, 1, 1)
+
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ 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_title("Input Signal", weight="bold")
+ spin_f.set_xlabel("Frequency (Hz)")
+ spin_f.set_ylabel("Power (dBW)")
+
+
+ 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)
+ pin_t = spin_t.plot(t_in, x_in.real, "b")
+ pin_t = spin_t.plot(t_in, x_in.imag, "r")
+
+ spin_t.set_xlabel("Time (s)")
+ spin_t.set_ylabel("Amplitude")
+
+ Ncols = int(scipy.floor(scipy.sqrt(tb._M)))
+ Nrows = int(scipy.floor(tb._M / Ncols))
+ if(tb._M % Ncols != 0):
+ Nrows += 1
+
+ # Plot each of the channels outputs. Frequencies on Figure 2 and
+ # time signals on Figure 3
+ fs_o = tb._fs / tb._M
+ Ts_o = 1.0/fs_o
+ Tmax_o = len(d)*Ts_o
+ for i in xrange(len(tb.snks)):
+ # remove issues with the transients at the beginning
+ # also remove some corruption at the end of the stream
+ # this is a bug, probably due to the corner cases
+ d = tb.snks[i].data()[Ns:Ne]
+
+ sp1_f = fig1.add_subplot(Nrows, Ncols, 1+i)
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ 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_title(("Channel %d" % i), weight="bold")
+ sp1_f.set_xlabel("Frequency (Hz)")
+ sp1_f.set_ylabel("Power (dBW)")
+
+ x_o = scipy.array(d)
+ t_o = scipy.arange(0, Tmax_o, Ts_o)
+ 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_title(("Channel %d" % i), weight="bold")
+ sp2_o.set_xlabel("Time (s)")
+ sp2_o.set_ylabel("Amplitude")
+
+
+ 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_title("All Channels")
+ sp3.set_xlabel("Time (s)")
+ sp3.set_ylabel("Amplitude")
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gnuradio-examples/python/pfb/decimate.py b/gnuradio-examples/python/pfb/decimate.py
new file mode 100755
index 000000000..cb5d61b72
--- /dev/null
+++ b/gnuradio-examples/python/pfb/decimate.py
@@ -0,0 +1,171 @@
+#!/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 os
+import scipy, pylab
+from scipy import fftpack
+from pylab import mlab
+import time
+
+#print os.getpid()
+#raw_input()
+
+class pfb_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ 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)
+
+ # Calculate the number of taps per channel for our own information
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._decim))
+ 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.
+ self.signals = list()
+ self.add = gr.add_cc()
+ freqs = [10, 20, 2040]
+ for i in xrange(len(freqs)):
+ self.signals.append(gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freqs[i], 1))
+ 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)
+
+ # Construct a standard FIR decimating filter
+ self.dec = gr.fir_filter_ccf(self._decim, self._taps)
+
+ self.snk_i = gr.vector_sink_c()
+
+ # Connect the blocks
+ self.connect(self.add, self.head, self.pfb)
+ self.connect(self.add, self.snk_i)
+
+ # 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()
+ tb.run()
+ tend = time.time()
+ print "Run time: %f" % (tend - tstart)
+
+ if 1:
+ fig1 = pylab.figure(1, figsize=(16,9))
+ fig2 = pylab.figure(2, figsize=(16,9))
+
+ Ns = 10000
+ Ne = 10000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+ fs = tb._fs
+
+ # Plot the input to the decimator
+
+ d = tb.snk_i.data()[Ns:Ns+Ne]
+ sp1_f = fig1.add_subplot(2, 1, 1)
+
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ 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_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
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ sp1_t = fig1.add_subplot(2, 1, 2)
+ p1_t = sp1_t.plot(t_in, x_in.real, "b")
+ p1_t = sp1_t.plot(t_in, x_in.imag, "r")
+ sp1_t.set_ylim([-tb._decim*1.1, tb._decim*1.1])
+
+ sp1_t.set_xlabel("Time (s)")
+ sp1_t.set_ylabel("Amplitude")
+
+
+ # Plot the output of the decimator
+ fs_o = tb._fs / tb._decim
+
+ sp2_f = fig2.add_subplot(2, 1, 1)
+ d = tb.snk.data()[Ns:Ns+Ne]
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ 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_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
+
+ x_o = scipy.array(d)
+ t_o = scipy.arange(0, Tmax_o, Ts_o)
+ sp2_t = fig2.add_subplot(2, 1, 2)
+ p2_t = sp2_t.plot(t_o, x_o.real, "b-o")
+ p2_t = sp2_t.plot(t_o, x_o.imag, "r-o")
+ sp2_t.set_ylim([-2.5, 2.5])
+
+ sp2_t.set_xlabel("Time (s)")
+ sp2_t.set_ylabel("Amplitude")
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gnuradio-examples/python/pfb/fmtest.py b/gnuradio-examples/python/pfb/fmtest.py
new file mode 100755
index 000000000..97df0e0f5
--- /dev/null
+++ b/gnuradio-examples/python/pfb/fmtest.py
@@ -0,0 +1,197 @@
+#!/usr/bin/env python
+#
+
+
+from gnuradio import gr, eng_notation
+from gnuradio import blks2
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+import math, time, sys, scipy, pylab
+from scipy import fftpack
+
+class fmtx(gr.hier_block2):
+ def __init__(self, lo_freq, audio_rate, if_rate):
+
+ gr.hier_block2.__init__(self, "build_fm",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ 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
+ lo_freq, #frequency
+ 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)
+
+class fmtest(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._nsamples = 1000000
+ self._audio_rate = 8000
+
+ # Set up N channels with their own baseband and IF frequencies
+ self._N = 5
+ chspacing = 16000
+ freq = [10, 20, 30, 40, 50]
+ f_lo = [0, 1*chspacing, -1*chspacing, 2*chspacing, -2*chspacing]
+
+ self._if_rate = 4*self._N*self._audio_rate
+
+ # Create a signal source and frequency modulate it
+ self.sum = gr.add_cc ()
+ for n in xrange(self._N):
+ sig = gr.sig_source_f(self._audio_rate, gr.GR_SIN_WAVE, freq[n], 0.5)
+ fm = fmtx(f_lo[n], self._audio_rate, self._if_rate)
+ self.connect(sig, fm)
+ self.connect(fm, (self.sum, n))
+
+ self.head = gr.head(gr.sizeof_gr_complex, self._nsamples)
+ self.snk_tx = gr.vector_sink_c()
+ self.channel = blks2.channel_model(0.1)
+
+ self.connect(self.sum, self.head, self.channel, self.snk_tx)
+
+
+ # Design the channlizer
+ self._M = 10
+ 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,
+ attenuation_dB=100,
+ window=gr.firdes.WIN_BLACKMAN_hARRIS)
+ tpc = math.ceil(float(len(self._taps)) / float(self._M))
+
+ 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()
+ self.snks = list()
+ for i in xrange(self._M):
+ self.fmdet.append(blks2.nbfm_rx(self._audio_rate, self._chan_rate))
+ self.squelch.append(blks2.standard_squelch(self._audio_rate*10))
+ self.snks.append(gr.vector_sink_f())
+ self.connect((self.pfb, i), self.fmdet[i], self.squelch[i], self.snks[i])
+
+ def num_tx_channels(self):
+ return self._N
+
+ def num_rx_channels(self):
+ return self._M
+
+def main():
+
+ fm = fmtest()
+
+ tstart = time.time()
+ fm.run()
+ tend = time.time()
+
+ if 1:
+ 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 = 100000
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+
+ # Plot transmitted signal
+ fs = fm._if_rate
+
+ d = fm.snk_tx.data()[Ns:Ns+Ne]
+ sp1_f = fig1.add_subplot(2, 1, 1)
+
+ X,freq = sp1_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ visible=False)
+ 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_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
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ sp1_t = fig1.add_subplot(2, 1, 2)
+ p1_t = sp1_t.plot(t_in, x_in.real, "b-o")
+ #p1_t = sp1_t.plot(t_in, x_in.imag, "r-o")
+ sp1_t.set_ylim([-5, 5])
+
+ # Set up the number of rows and columns for plotting the subfigures
+ Ncols = int(scipy.floor(scipy.sqrt(fm.num_rx_channels())))
+ Nrows = int(scipy.floor(fm.num_rx_channels() / Ncols))
+ if(fm.num_rx_channels() % Ncols != 0):
+ Nrows += 1
+
+ # Plot each of the channels outputs. Frequencies on Figure 2 and
+ # time signals on Figure 3
+ fs_o = fm._audio_rate
+ for i in xrange(len(fm.snks)):
+ # remove issues with the transients at the beginning
+ # also remove some corruption at the end of the stream
+ # this is a bug, probably due to the corner cases
+ d = fm.snks[i].data()[Ns:Ne]
+
+ sp2_f = fig2.add_subplot(Nrows, Ncols, 1+i)
+ X,freq = sp2_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ window = lambda d: d*winfunc(fftlen),
+ visible=False)
+ #X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+ 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))
+ 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.grid(True)
+
+ sp2_f.set_title(("Channel %d" % i), weight="bold")
+ sp2_f.set_xlabel("Frequency (kHz)")
+ sp2_f.set_ylabel("Power (dBW)")
+
+
+ Ts = 1.0/fs_o
+ Tmax = len(d)*Ts
+ t_o = scipy.arange(0, Tmax, Ts)
+
+ x_t = scipy.array(d)
+ 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_xlabel("Time (s)")
+ sp2_t.set_ylabel("Amplitude")
+
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/gnuradio-examples/python/pfb/interpolate.py b/gnuradio-examples/python/pfb/interpolate.py
new file mode 100755
index 000000000..a7a2522f8
--- /dev/null
+++ b/gnuradio-examples/python/pfb/interpolate.py
@@ -0,0 +1,226 @@
+#!/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 os
+import scipy, pylab
+from scipy import fftpack
+from pylab import mlab
+import time
+
+#print os.getpid()
+#raw_input()
+
+class pfb_top_block(gr.top_block):
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ self._N = 100000 # number of samples to use
+ self._fs = 2000 # initial sampling rate
+ 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
+ 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,
+ attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Create a set of taps for the PFB arbitrary resampler
+ # The filter size is the number of filters in the filterbank; 32 will give very low side-lobes,
+ # and larger numbers will reduce these even farther
+ # 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,
+ attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS)
+
+ # Calculate the number of taps per channel for our own information
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._interp))
+ print "Number of taps: ", len(self._taps)
+ print "Number of filters: ", self._interp
+ print "Taps per channel: ", tpc
+
+ # Create a couple of signals at different frequencies
+ 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
+ self.pfb = blks2.pfb_interpolator_ccf(self._interp, self._taps)
+
+ # Construct the PFB arbitrary resampler filter
+ self.pfb_ar = blks2.pfb_arb_resampler_ccf(self._ainterp, self._taps2, flt_size)
+ self.snk_i = gr.vector_sink_c()
+
+ #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))
+ self.connect(self.signal, self.pfb)
+ self.connect(self.signal, self.pfb_ar)
+ self.connect(self.signal, self.snk_i)
+
+ # Create the sink for the interpolated signals
+ self.snk1 = gr.vector_sink_c()
+ 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()
+
+ tstart = time.time()
+ tb.run()
+ tend = time.time()
+ print "Run time: %f" % (tend - tstart)
+
+
+ if 1:
+ 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
+
+ fftlen = 8192
+ winfunc = scipy.blackman
+
+ # Plot input signal
+ fs = tb._fs
+
+ d = tb.snk_i.data()[Ns:Ns+Ne]
+ sp1_f = fig1.add_subplot(2, 1, 1)
+
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ 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_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
+
+ t_in = scipy.arange(0, Tmax, Ts)
+ x_in = scipy.array(d)
+ sp1_t = fig1.add_subplot(2, 1, 2)
+ p1_t = sp1_t.plot(t_in, x_in.real, "b-o")
+ #p1_t = sp1_t.plot(t_in, x_in.imag, "r-o")
+ sp1_t.set_ylim([-2.5, 2.5])
+
+ sp1_t.set_title("Input Signal", weight="bold")
+ sp1_t.set_xlabel("Time (s)")
+ sp1_t.set_ylabel("Amplitude")
+
+
+ # Plot output of PFB interpolator
+ fs_int = tb._fs*tb._interp
+
+ sp2_f = fig2.add_subplot(2, 1, 1)
+ d = tb.snk1.data()[Ns:Ns+(tb._interp*Ne)]
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ 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_title("Output Signal from PFB Interpolator", weight="bold")
+ sp2_f.set_xlabel("Frequency (Hz)")
+ sp2_f.set_ylabel("Power (dBW)")
+
+ Ts_int = 1.0/fs_int
+ Tmax = len(d)*Ts_int
+
+ t_o = scipy.arange(0, Tmax, Ts_int)
+ x_o1 = scipy.array(d)
+ sp2_t = fig2.add_subplot(2, 1, 2)
+ p2_t = sp2_t.plot(t_o, x_o1.real, "b-o")
+ #p2_t = sp2_t.plot(t_o, x_o.imag, "r-o")
+ sp2_t.set_ylim([-2.5, 2.5])
+
+ sp2_t.set_title("Output Signal from PFB Interpolator", weight="bold")
+ sp2_t.set_xlabel("Time (s)")
+ sp2_t.set_ylabel("Amplitude")
+
+
+ # Plot output of PFB arbitrary resampler
+ fs_aint = tb._fs * tb._ainterp
+
+ sp3_f = fig3.add_subplot(2, 1, 1)
+ d = tb.snk2.data()[Ns:Ns+(tb._interp*Ne)]
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ window = lambda d: d*winfunc(fftlen),
+ scale_by_freq=True)
+ 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_title("Output Signal from PFB Arbitrary Resampler", weight="bold")
+ sp3_f.set_xlabel("Frequency (Hz)")
+ sp3_f.set_ylabel("Power (dBW)")
+
+ Ts_aint = 1.0/fs_aint
+ Tmax = len(d)*Ts_aint
+
+ t_o = scipy.arange(0, Tmax, Ts_aint)
+ x_o2 = scipy.array(d)
+ sp3_f = fig3.add_subplot(2, 1, 2)
+ p3_f = sp3_f.plot(t_o, x_o2.real, "b-o")
+ 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")
+
+ pylab.show()
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+
diff --git a/gnuradio-examples/python/usrp/.gitignore b/gnuradio-examples/python/usrp/.gitignore
new file mode 100644
index 000000000..c400497f5
--- /dev/null
+++ b/gnuradio-examples/python/usrp/.gitignore
@@ -0,0 +1,10 @@
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
diff --git a/gnuradio-examples/python/usrp2/.gitignore b/gnuradio-examples/python/usrp2/.gitignore
new file mode 100644
index 000000000..b336cc7ce
--- /dev/null
+++ b/gnuradio-examples/python/usrp2/.gitignore
@@ -0,0 +1,2 @@
+/Makefile
+/Makefile.in