diff options
author | jcorgan | 2007-04-28 02:20:28 +0000 |
---|---|---|
committer | jcorgan | 2007-04-28 02:20:28 +0000 |
commit | b26ea69676c09f5366a9e2f33b11ae5a7521ffe5 (patch) | |
tree | 0641c1c25d6e827f70941e07f4611d0a2b6b83cd /gr-wxgui/src/python/waterfallsink2.py | |
parent | 00696b9f754338de9362932c1ecfb1e144a38786 (diff) | |
download | gnuradio-b26ea69676c09f5366a9e2f33b11ae5a7521ffe5.tar.gz gnuradio-b26ea69676c09f5366a9e2f33b11ae5a7521ffe5.tar.bz2 gnuradio-b26ea69676c09f5366a9e2f33b11ae5a7521ffe5.zip |
Merged -r 5137:5174 from developer branch jcorgan/hb. Trunk passes distcheck. Converts gr.hier_block2 API to not use 'define_component' methodology anymore.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@5177 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-wxgui/src/python/waterfallsink2.py')
-rwxr-xr-x | gr-wxgui/src/python/waterfallsink2.py | 76 |
1 files changed, 21 insertions, 55 deletions
diff --git a/gr-wxgui/src/python/waterfallsink2.py b/gr-wxgui/src/python/waterfallsink2.py index e91789532..cd4cc75da 100755 --- a/gr-wxgui/src/python/waterfallsink2.py +++ b/gr-wxgui/src/python/waterfallsink2.py @@ -87,28 +87,17 @@ class waterfall_sink_f(gr.hier_block2, waterfall_sink_base): fft_rate=fft_rate, average=average, avg_alpha=avg_alpha, title=title) - self.define_component("s2p", gr.serial_to_parallel(gr.sizeof_float, self.fft_size)) + self.s2p = gr.serial_to_parallel(gr.sizeof_float, self.fft_size) self.one_in_n = gr.keep_one_in_n(gr.sizeof_float * self.fft_size, max(1, int(self.sample_rate/self.fft_size/self.fft_rate))) - self.define_component("one_in_n", self.one_in_n) mywindow = window.blackmanharris(self.fft_size) - self.define_component("fft", gr.fft_vfc(self.fft_size, True, mywindow)) - self.define_component("c2mag", gr.complex_to_mag(self.fft_size)) + self.fft = gr.fft_vfc(self.fft_size, True, mywindow) + self.c2mag = gr.complex_to_mag(self.fft_size) self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size) - self.define_component("avg", self.avg) - self.define_component("log", gr.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size))) - self.define_component("sink", gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)) - - # Ultimately this will be - # self.connect("self s2p one_in_n fft c2mag avg log sink") - self.connect("self", 0, "s2p", 0) - self.connect("s2p", 0, "one_in_n", 0) - self.connect("one_in_n", 0, "fft", 0) - self.connect("fft", 0, "c2mag", 0) - self.connect("c2mag", 0, "avg", 0) - self.connect("avg", 0, "log", 0) - self.connect("log", 0, "sink", 0) + self.log = gr.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size)) + self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True) + self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink) self.win = waterfall_window(self, parent, size=size) self.set_average(self.average) @@ -129,28 +118,17 @@ class waterfall_sink_c(gr.hier_block2, waterfall_sink_base): fft_rate=fft_rate, average=average, avg_alpha=avg_alpha, title=title) - self.define_component("s2p", gr.serial_to_parallel(gr.sizeof_gr_complex, self.fft_size)) + self.s2p = gr.serial_to_parallel(gr.sizeof_gr_complex, self.fft_size) self.one_in_n = gr.keep_one_in_n(gr.sizeof_gr_complex * self.fft_size, max(1, int(self.sample_rate/self.fft_size/self.fft_rate))) - self.define_component("one_in_n", self.one_in_n) mywindow = window.blackmanharris(self.fft_size) - self.define_component("fft", gr.fft_vcc(self.fft_size, True, mywindow)) - self.define_component("c2mag", gr.complex_to_mag(self.fft_size)) + self.fft = gr.fft_vcc(self.fft_size, True, mywindow) + self.c2mag = gr.complex_to_mag(self.fft_size) self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size) - self.define_component("avg", self.avg) - self.define_component("log", gr.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size))) - self.define_component("sink", gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)) - - # Ultimately this will be - # self.connect("self s2p one_in_n fft c2mag avg log sink") - self.connect("self", 0, "s2p", 0) - self.connect("s2p", 0, "one_in_n", 0) - self.connect("one_in_n", 0, "fft", 0) - self.connect("fft", 0, "c2mag", 0) - self.connect("c2mag", 0, "avg", 0) - self.connect("avg", 0, "log", 0) - self.connect("log", 0, "sink", 0) + self.log = gr.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size)) + self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True) + self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink) self.win = waterfall_window(self, parent, size=size) self.set_average(self.average) @@ -448,41 +426,29 @@ class test_top_block (stdgui2.std_top_block): input_rate = 20.000e3 # Generate a complex sinusoid - self.define_component("src1", gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000)) + self.src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000) #src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1000) # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. - self.define_component("thr1", gr.throttle(gr.sizeof_gr_complex, input_rate)) + self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) - sink1 = waterfall_sink_c (self, panel, title="Complex Data", fft_size=fft_size, + sink1 = waterfall_sink_c (panel, title="Complex Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3) - self.define_component("sink1", sink1) - + self.connect(self.src1, self.thr1, sink1) vbox.Add (sink1.win, 1, wx.EXPAND) - # Ultimately this will be - # self.connect("src1 thr1 sink1") - self.connect("src1", 0, "thr1", 0) - self.connect("thr1", 0, "sink1", 0) - # generate a real sinusoid - self.define_component("src2", gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000)) - #src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1000) - self.define_component("thr2", gr.throttle(gr.sizeof_float, input_rate)) - sink2 = waterfall_sink_f (self, panel, title="Real Data", fft_size=fft_size, + self.src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000) + self.thr2 = gr.throttle(gr.sizeof_float, input_rate) + sink2 = waterfall_sink_f (panel, title="Real Data", fft_size=fft_size, sample_rate=input_rate, baseband_freq=100e3) - self.define_component("sink2", sink2) + self.connect(self.src2, self.thr2, sink2) vbox.Add (sink2.win, 1, wx.EXPAND) - # Ultimately this will be - # self.connect("src2 thr2 sink2") - self.connect("src2", 0, "thr2", 0) - self.connect("thr2", 0, "sink2", 0) def main (): - app = stdgui2.stdapp (test_top_block, - "Waterfall Sink Test App") + app = stdgui2.stdapp (test_top_block, "Waterfall Sink Test App") app.MainLoop () if __name__ == '__main__': |