From d830a4547256be3096db83118f6e9ffe299f8ecf Mon Sep 17 00:00:00 2001 From: jcorgan Date: Sat, 19 Jan 2008 19:16:31 +0000 Subject: Fixes ticket:229. Fixed code in synthesis filterbank, restored test programs from limbo and upgraded to use blks2. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@7476 221aa14e-8319-0410-a670-987f0aec2ac5 --- .../python/usrp/limbo/test_dft_analysis.py | 72 -------------------- .../python/usrp/limbo/test_dft_synth.py | 79 ---------------------- 2 files changed, 151 deletions(-) delete mode 100755 gnuradio-examples/python/usrp/limbo/test_dft_analysis.py delete mode 100755 gnuradio-examples/python/usrp/limbo/test_dft_synth.py (limited to 'gnuradio-examples/python/usrp/limbo') diff --git a/gnuradio-examples/python/usrp/limbo/test_dft_analysis.py b/gnuradio-examples/python/usrp/limbo/test_dft_analysis.py deleted file mode 100755 index a1d9eda46..000000000 --- a/gnuradio-examples/python/usrp/limbo/test_dft_analysis.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, gru, blks -from gnuradio.wxgui import stdgui, fftsink, slider -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import wx - -class test_graph (stdgui.gui_flow_graph): - def __init__(self, frame, panel, vbox, argv): - stdgui.gui_flow_graph.__init__(self, frame, panel, vbox, argv) - - parser = OptionParser (option_class=eng_option) - (options, args) = parser.parse_args () - - sample_rate = 16e3 - mpoints = 4 - ampl = 1000 - freq = 0 - - lo_freq = 1e6 - lo_ampl = 1 - - vbox.Add(slider.slider(panel, - -sample_rate/2, sample_rate/2, - self.set_lo_freq), 0, wx.ALIGN_CENTER) - - - src = gr.sig_source_c(sample_rate, gr.GR_CONST_WAVE, - freq, ampl, 0) - - self.lo = gr.sig_source_c(sample_rate, gr.GR_SIN_WAVE, - lo_freq, lo_ampl, 0) - - mixer = gr.multiply_cc() - self.connect(src, (mixer, 0)) - self.connect(self.lo, (mixer, 1)) - - # We add these throttle blocks so that this demo doesn't - # suck down all the CPU available. Normally you wouldn't use these. - thr = gr.throttle(gr.sizeof_gr_complex, sample_rate) - - taps = gr.firdes.low_pass(1, # gain - 1, # rate - 1.0/mpoints * 0.4, # cutoff - 1.0/mpoints * 0.1, # trans width - gr.firdes.WIN_HANN) - print len(taps) - analysis = blks.analysis_filterbank(self, mpoints, taps) - - self.connect(mixer, thr) - self.connect(thr, analysis) - - for i in range(mpoints): - fft = fftsink.fft_sink_c(self, frame, fft_size=128, - sample_rate=sample_rate/mpoints, - fft_rate=5, - title="Ch %d" % (i,)) - self.connect((analysis, i), fft) - vbox.Add(fft.win, 1, wx.EXPAND) - - def set_lo_freq(self, freq): - self.lo.set_frequency(freq) - - - -def main (): - app = stdgui.stdapp (test_graph, "Test DFT filterbank") - app.MainLoop () - -if __name__ == '__main__': - main () diff --git a/gnuradio-examples/python/usrp/limbo/test_dft_synth.py b/gnuradio-examples/python/usrp/limbo/test_dft_synth.py deleted file mode 100755 index 60a49e3b3..000000000 --- a/gnuradio-examples/python/usrp/limbo/test_dft_synth.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, gru, blks -from gnuradio.wxgui import stdgui, fftsink -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import wx -import random - - -def make_random_complex_tuple(L, gain=1): - result = [] - for x in range(L): - result.append(gain * complex(random.gauss(0, 1),random.gauss(0, 1))) - - return tuple(result) - -def random_noise_c(gain=1): - src = gr.vector_source_c(make_random_complex_tuple(32*1024, gain), True) - return src - - -class test_graph (stdgui.gui_flow_graph): - def __init__(self, frame, panel, vbox, argv): - stdgui.gui_flow_graph.__init__(self, frame, panel, vbox, argv) - - parser = OptionParser (option_class=eng_option) - (options, args) = parser.parse_args () - - sample_rate = 16e6 - mpoints = 16 - ampl = 1000 - - enable = mpoints * [0] - enable[0] = 1 - - taps = gr.firdes.low_pass(1, # gain - 1, # rate - 1.0/mpoints * 0.4, # cutoff - 1.0/mpoints * 0.1, # trans width - gr.firdes.WIN_HANN) - - synth = blks.synthesis_filterbank(self, mpoints, taps) - - null_source = gr.null_source(gr.sizeof_gr_complex) - - if 0: - for i in range(mpoints): - s = gr.sig_source_c(sample_rate/mpoints, gr.GR_SIN_WAVE, - 300e3, ampl * enable[i], 0) - self.connect(s, (synth, i)) - - else: - for i in range(mpoints): - if i == 0: - s = gr.sig_source_c(sample_rate/mpoints, gr.GR_SIN_WAVE, - 300e3, ampl * enable[i], 0) - #s = random_noise_c(ampl) - self.connect(s, (synth, i)) - else: - self.connect(null_source, (synth, i)) - - - # We add these throttle blocks so that this demo doesn't - # suck down all the CPU available. Normally you wouldn't use these. - thr = gr.throttle(gr.sizeof_gr_complex, sample_rate) - fft = fftsink.fft_sink_c(self, frame, fft_size=1024, - sample_rate=sample_rate) - vbox.Add(fft.win, 1, wx.EXPAND) - - self.connect(synth, thr, fft) - - -def main (): - app = stdgui.stdapp (test_graph, "Test DFT filterbank") - app.MainLoop () - -if __name__ == '__main__': - main () -- cgit