3 # Copyright 2010 Free Software Foundation, Inc.
5 # This file is part of GNU Radio
7 # GNU Radio is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3, or (at your option)
12 # GNU Radio is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Radio; see the file COPYING. If not, write to
19 # the Free Software Foundation, Inc., 51 Franklin Street,
20 # Boston, MA 02110-1301, USA.
23 from gnuradio import gr, blks2
30 freqs = [100, 200, 300, 400, 500]
36 s = gr.sig_source_f(fs, gr.GR_SIN_WAVE, fi, 1)
37 fm = blks2.nbfm_tx (fs, 4*fs, max_dev=10000, tau=75e-6)
41 syntaps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100)
42 print "Synthesis Num. Taps = %d (taps per filter = %d)" % (len(syntaps),
44 chtaps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100)
45 print "Channelizer Num. Taps = %d (taps per filter = %d)" % (len(chtaps),
47 filtbank = gr.pfb_synthesis_filterbank_ccf(nchans, syntaps)
48 channelizer = blks2.pfb_channelizer_ccf(nchans, chtaps)
51 head = gr.head(gr.sizeof_gr_complex, N)
52 noise = gr.noise_source_c(gr.GR_GAUSSIAN, noise_level)
53 addnoise = gr.add_cc()
54 snk_synth = gr.vector_sink_c()
58 tb.connect(noise, (addnoise,0))
59 tb.connect(filtbank, head, (addnoise, 1))
60 tb.connect(addnoise, channelizer)
61 tb.connect(addnoise, snk_synth)
64 for i,si in enumerate(sigs):
65 tb.connect(si, fmtx[i], (filtbank, i))
67 for i in xrange(nchans):
68 snk.append(gr.vector_sink_c())
69 tb.connect((channelizer, i), snk[i])
75 data = snk[channel].data()[1000:]
78 s1 = f1.add_subplot(1,1,1)
79 s1.plot(data[10000:10200] )
80 s1.set_title(("Output Signal from Channel %d" % channel))
83 winfunc = scipy.blackman
84 #winfunc = scipy.hamming
87 s2 = f2.add_subplot(1,1,1)
88 s2.psd(data, NFFT=fftlen,
91 window = lambda d: d*winfunc(fftlen))
92 s2.set_title(("Output PSD from Channel %d" % channel))
95 s3 = f3.add_subplot(1,1,1)
96 s3.psd(snk_synth.data()[1000:], NFFT=fftlen,
99 window = lambda d: d*winfunc(fftlen))
100 s3.set_title("Output of Synthesis Filter")
104 if __name__ == "__main__":