diff options
Diffstat (limited to 'gr-wxgui/src/python/fftsink_nongl.py')
-rw-r--r-- | gr-wxgui/src/python/fftsink_nongl.py | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/gr-wxgui/src/python/fftsink_nongl.py b/gr-wxgui/src/python/fftsink_nongl.py index c756d8a3b2..bc634b5cc7 100644 --- a/gr-wxgui/src/python/fftsink_nongl.py +++ b/gr-wxgui/src/python/fftsink_nongl.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2003,2004,2005,2006,2007,2009,2010 Free Software Foundation, Inc. +# Copyright 2003-2007,2009,2010,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,8 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, gru, window +from gnuradio import gr, gru, window, fft, filter +from gnuradio import analog from gnuradio.wxgui import stdgui2 import wx import plot @@ -122,13 +123,13 @@ class fft_sink_f(gr.hier_block2, fft_sink_base): max(1, int(self.sample_rate/self.fft_size/self.fft_rate))) mywindow = window.blackmanharris(self.fft_size) - self.fft = gr.fft_vfc(self.fft_size, True, mywindow) + self.fft = fft.fft_vfc(self.fft_size, True, mywindow) power = 0 for tap in mywindow: power += tap*tap self.c2mag = gr.complex_to_mag(self.fft_size) - self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size) + self.avg = filter.single_pole_iir_filter_ff(1.0, self.fft_size) # FIXME We need to add 3dB to all bins but the DC bin self.log = gr.nlog10_ff(20, self.fft_size, @@ -167,13 +168,13 @@ class fft_sink_c(gr.hier_block2, fft_sink_base): max(1, int(self.sample_rate/self.fft_size/self.fft_rate))) mywindow = window.blackmanharris(self.fft_size) - self.fft = gr.fft_vcc(self.fft_size, True, mywindow) + self.fft = fft.fft_vcc(self.fft_size, True, mywindow) power = 0 for tap in mywindow: power += tap*tap self.c2mag = gr.complex_to_mag(self.fft_size) - self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size) + self.avg = filter.single_pole_iir_filter_ff(1.0, self.fft_size) # FIXME We need to add 3dB to all bins but the DC bin self.log = gr.nlog10_ff(20, self.fft_size, @@ -604,33 +605,33 @@ class test_app_block (stdgui2.std_top_block): input_rate = 100*20.48e3 # Generate a complex sinusoid - #src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 100*2e3, 1) - src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 100*5.75e3, 1) + #src1 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 100*2e3, 1) + src1 = analog.sig_source_c(input_rate, analog.GR_CONST_WAVE, 100*5.75e3, 1) # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) - sink1 = fft_sink_c (panel, title="Complex Data", fft_size=fft_size, - sample_rate=input_rate, baseband_freq=100e3, - ref_level=0, y_per_div=20, y_divs=10) - vbox.Add (sink1.win, 1, wx.EXPAND) + sink1 = fft_sink_c(panel, title="Complex Data", fft_size=fft_size, + sample_rate=input_rate, baseband_freq=100e3, + ref_level=0, y_per_div=20, y_divs=10) + vbox.Add(sink1.win, 1, wx.EXPAND) self.connect(src1, thr1, sink1) - #src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 100*2e3, 1) - src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 100*5.75e3, 1) + #src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 100*2e3, 1) + src2 = analog.sig_source_f(input_rate, analog.GR_CONST_WAVE, 100*5.75e3, 1) thr2 = gr.throttle(gr.sizeof_float, input_rate) - sink2 = fft_sink_f (panel, title="Real Data", fft_size=fft_size*2, - sample_rate=input_rate, baseband_freq=100e3, - ref_level=0, y_per_div=20, y_divs=10) - vbox.Add (sink2.win, 1, wx.EXPAND) + sink2 = fft_sink_f(panel, title="Real Data", fft_size=fft_size*2, + sample_rate=input_rate, baseband_freq=100e3, + ref_level=0, y_per_div=20, y_divs=10) + vbox.Add(sink2.win, 1, wx.EXPAND) self.connect(src2, thr2, sink2) def main (): - app = stdgui2.stdapp (test_app_block, "FFT Sink Test App") - app.MainLoop () + app = stdgui2.stdapp(test_app_block, "FFT Sink Test App") + app.MainLoop() if __name__ == '__main__': main () |