diff options
author | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2007-09-04 02:43:56 +0000 |
---|---|---|
committer | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2007-09-04 02:43:56 +0000 |
commit | 54d6b9281dc233e0b2acf26884073d973b7663de (patch) | |
tree | 15cd1fa40207e68c5035a50fd7d54536831c4599 /gnuradio-examples/python/usrp/limbo/test_dft_analysis.py | |
parent | 2c37e57fe4626ac30eb8c042e4d7daf64a0d45f5 (diff) |
Merged r6271:6278 from jcorgan/t182 into trunk. Implements ticket:182.
Created new top-level component, gr-utils, to hold commonly used utility
scripts (originally in gnuradio-examples). These now install into the
system path, allowing their use from wherever.
Reorganization of gnuradio-examples component:
* Commonly used utility scripts moved from python/usrp into gr-utils.
* Examples now install into $(prefix)/share/gnuradio/examples/...
* Channel coding examples moved into gr-trellis/src/examples, now install
from there, only if gr-atsc itself is going to built and installed.
* ATSC example scripts now install into example hierarchy
* Cruft has been moved into 'limbo' in repository, do not get installed
Trunk passes 'make distcheck'.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6279 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-examples/python/usrp/limbo/test_dft_analysis.py')
-rwxr-xr-x | gnuradio-examples/python/usrp/limbo/test_dft_analysis.py | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/gnuradio-examples/python/usrp/limbo/test_dft_analysis.py b/gnuradio-examples/python/usrp/limbo/test_dft_analysis.py new file mode 100755 index 0000000000..a1d9eda46c --- /dev/null +++ b/gnuradio-examples/python/usrp/limbo/test_dft_analysis.py @@ -0,0 +1,72 @@ +#!/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 () |