summaryrefslogtreecommitdiff
path: root/gr-radio-astronomy/src/python
diff options
context:
space:
mode:
authorjcorgan2007-11-27 20:06:08 +0000
committerjcorgan2007-11-27 20:06:08 +0000
commitf845cd62f4bc202dc3c23a916a6699a1afb2f40d (patch)
tree91b42cdd1134de3a0cd619a5fb11d86fbe93e03e /gr-radio-astronomy/src/python
parent0795ff1cc1f886c9749a4f95cd708190ec7eef20 (diff)
downloadgnuradio-f845cd62f4bc202dc3c23a916a6699a1afb2f40d.tar.gz
gnuradio-f845cd62f4bc202dc3c23a916a6699a1afb2f40d.tar.bz2
gnuradio-f845cd62f4bc202dc3c23a916a6699a1afb2f40d.zip
Implements ticket:208
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@7045 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-radio-astronomy/src/python')
-rwxr-xr-xgr-radio-astronomy/src/python/qa_ra.py4
-rwxr-xr-xgr-radio-astronomy/src/python/ra_fftsink.py63
-rwxr-xr-xgr-radio-astronomy/src/python/ra_stripchartsink.py16
-rwxr-xr-xgr-radio-astronomy/src/python/ra_waterfallsink.py67
-rwxr-xr-xgr-radio-astronomy/src/python/usrp_psr_receiver.py12
-rwxr-xr-xgr-radio-astronomy/src/python/usrp_ra_receiver.py10
6 files changed, 66 insertions, 106 deletions
diff --git a/gr-radio-astronomy/src/python/qa_ra.py b/gr-radio-astronomy/src/python/qa_ra.py
index 687a75c6a..1c44e23ad 100755
--- a/gr-radio-astronomy/src/python/qa_ra.py
+++ b/gr-radio-astronomy/src/python/qa_ra.py
@@ -26,10 +26,10 @@ import ra
class qa_ra (gr_unittest.TestCase):
def setUp (self):
- self.fg = gr.flow_graph ()
+ self.tb = gr.top_block ()
def tearDown (self):
- self.fg = None
+ self.tb = None
def test_000_(self): # ensure that we can load the module
pass
diff --git a/gr-radio-astronomy/src/python/ra_fftsink.py b/gr-radio-astronomy/src/python/ra_fftsink.py
index f65486418..aa2624b89 100755
--- a/gr-radio-astronomy/src/python/ra_fftsink.py
+++ b/gr-radio-astronomy/src/python/ra_fftsink.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2003,2004,2005 Free Software Foundation, Inc.
+# Copyright 2003,2004,2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,7 +21,7 @@
#
from gnuradio import gr, gru, window
-from gnuradio.wxgui import stdgui
+from gnuradio.wxgui import stdgui2
import wx
import gnuradio.wxgui.plot as plot
import numpy
@@ -94,12 +94,16 @@ class ra_fft_sink_base(object):
self.baseband_freq = baseband_freq
-class ra_fft_sink_f(gr.hier_block, ra_fft_sink_base):
- def __init__(self, fg, parent, baseband_freq=0,
- y_per_div=10, sc_y_per_div=0.5, sc_ref_level=40, ref_level=50, sample_rate=1, fft_size=512,
+class ra_fft_sink_f(gr.hier_block2, ra_fft_sink_base):
+ def __init__(self, parent, baseband_freq=0,
+ y_per_div=10, sc_y_per_div=0.5, sc_ref_level=40, ref_level=50, sample_rate=1, fft_size=512,
fft_rate=15, average=False, avg_alpha=None, title='',
size=default_ra_fftsink_size, peak_hold=False, ofunc=None,
xydfunc=None):
+ gr.hier_block2.__init__(self, "ra_fft_sink_f",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(0, 0, 0))
+
ra_fft_sink_base.__init__(self, input_is_real=True, baseband_freq=baseband_freq,
y_per_div=y_per_div, sc_y_per_div=sc_y_per_div,
sc_ref_level=sc_ref_level, ref_level=ref_level,
@@ -120,19 +124,23 @@ class ra_fft_sink_f(gr.hier_block, ra_fft_sink_base):
log = gr.nlog10_ff(20, fft_size, -20*math.log10(fft_size))
sink = gr.message_sink(gr.sizeof_float * fft_size, self.msgq, True)
- fg.connect (s2p, one_in_n, fft, c2mag, self.avg, log, sink)
- gr.hier_block.__init__(self, fg, s2p, sink)
+ self.connect (self, s2p, one_in_n, fft, c2mag, self.avg, log, sink)
self.win = fft_window(self, parent, size=size)
self.set_average(self.average)
-class ra_fft_sink_c(gr.hier_block, ra_fft_sink_base):
- def __init__(self, fg, parent, baseband_freq=0,
+class ra_fft_sink_c(gr.hier_block2, ra_fft_sink_base):
+ def __init__(self, parent, baseband_freq=0,
y_per_div=10, sc_y_per_div=0.5, sc_ref_level=40,
ref_level=50, sample_rate=1, fft_size=512,
fft_rate=15, average=False, avg_alpha=None, title='',
size=default_ra_fftsink_size, peak_hold=False, ofunc=None, xydfunc=None):
+ gr.hier_block2.__init__(self, "ra_fft_sink_c",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(0, 0, 0))
+
+
ra_fft_sink_base.__init__(self, input_is_real=False, baseband_freq=baseband_freq,
y_per_div=y_per_div, sc_y_per_div=sc_y_per_div,
sc_ref_level=sc_ref_level, ref_level=ref_level,
@@ -153,8 +161,7 @@ class ra_fft_sink_c(gr.hier_block, ra_fft_sink_base):
log = gr.nlog10_ff(20, fft_size, -20*math.log10(fft_size))
sink = gr.message_sink(gr.sizeof_float * fft_size, self.msgq, True)
- fg.connect(s2p, one_in_n, fft, c2mag, self.avg, log, sink)
- gr.hier_block.__init__(self, fg, s2p, sink)
+ self.connect(self, s2p, one_in_n, fft, c2mag, self.avg, log, sink)
self.win = fft_window(self, parent, size=size)
self.set_average(self.average)
@@ -444,36 +451,12 @@ def next_down(v, seq):
# ----------------------------------------------------------------
-# Deprecated interfaces
-# ----------------------------------------------------------------
-
-# returns (block, win).
-# block requires a single input stream of float
-# win is a subclass of wxWindow
-
-def make_ra_fft_sink_f(fg, parent, title, fft_size, input_rate, ymin = 0, ymax=50):
-
- block = ra_fft_sink_f(fg, parent, title=title, fft_size=fft_size, sample_rate=input_rate,
- y_per_div=(ymax - ymin)/8, ref_level=ymax)
- return (block, block.win)
-
-# returns (block, win).
-# block requires a single input stream of gr_complex
-# win is a subclass of wxWindow
-
-def make_ra_fft_sink_c(fg, parent, title, fft_size, input_rate, ymin=0, ymax=50):
- block = ra_fft_sink_c(fg, parent, title=title, fft_size=fft_size, sample_rate=input_rate,
- y_per_div=(ymax - ymin)/8, ref_level=ymax)
- return (block, block.win)
-
-
-# ----------------------------------------------------------------
# Standalone test app
# ----------------------------------------------------------------
-class test_app_flow_graph (stdgui.gui_flow_graph):
+class test_app_flow_graph (stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
- stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv)
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
fft_size = 256
@@ -488,7 +471,7 @@ class test_app_flow_graph (stdgui.gui_flow_graph):
# suck down all the CPU available. Normally you wouldn't use these.
thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
- sink1 = ra_fft_sink_c (self, panel, title="Complex Data", fft_size=fft_size,
+ sink1 = ra_fft_sink_c (panel, title="Complex Data", fft_size=fft_size,
sample_rate=input_rate, baseband_freq=100e3,
ref_level=60, y_per_div=10)
vbox.Add (sink1.win, 1, wx.EXPAND)
@@ -497,14 +480,14 @@ class test_app_flow_graph (stdgui.gui_flow_graph):
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)
thr2 = gr.throttle(gr.sizeof_float, input_rate)
- sink2 = ra_fft_sink_f (self, panel, title="Real Data", fft_size=fft_size*2,
+ sink2 = ra_fft_sink_f (panel, title="Real Data", fft_size=fft_size*2,
sample_rate=input_rate, baseband_freq=100e3,
ref_level=60, y_per_div=10)
vbox.Add (sink2.win, 1, wx.EXPAND)
self.connect (src2, thr2, sink2)
def main ():
- app = stdgui.stdapp (test_app_flow_graph,
+ app = stdgui2.stdapp (test_app_flow_graph,
"FFT Sink Test App")
app.MainLoop ()
diff --git a/gr-radio-astronomy/src/python/ra_stripchartsink.py b/gr-radio-astronomy/src/python/ra_stripchartsink.py
index 4efb0cd56..5e6d5b393 100755
--- a/gr-radio-astronomy/src/python/ra_stripchartsink.py
+++ b/gr-radio-astronomy/src/python/ra_stripchartsink.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2003,2004,2005 Free Software Foundation, Inc.
+# Copyright 2003,2004,2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,7 +21,7 @@
#
from gnuradio import gr, gru
-from gnuradio.wxgui import stdgui
+from gnuradio.wxgui import stdgui2
import wx
import gnuradio.wxgui.plot as plot
import Numeric
@@ -67,14 +67,18 @@ class stripchart_sink_base(object):
def set_autoscale(self, auto):
self.autoscale = auto
-class stripchart_sink_f(gr.hier_block, stripchart_sink_base):
- def __init__(self, fg, parent,
+class stripchart_sink_f(gr.hier_block2, stripchart_sink_base):
+ def __init__(self, parent,
y_per_div=10, ref_level=50, sample_rate=1,
title='', stripsize=4,
size=default_stripchartsink_size,xlabel="X",
ylabel="Y", divbase=0.025,
parallel=False, scaling=1.0, autoscale=False):
+ gr.hier_block2.__init__(self, "stripchart_sink_f",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(0, 0, 0))
+
stripchart_sink_base.__init__(self, input_is_real=True,
y_per_div=y_per_div, ref_level=ref_level,
sample_rate=sample_rate,
@@ -90,9 +94,7 @@ class stripchart_sink_f(gr.hier_block, stripchart_sink_base):
else:
one = gr.keep_one_in_n (gr.sizeof_float, 1)
sink = gr.message_sink(gr.sizeof_float, self.msgq, True)
- fg.connect (one, sink)
-
- gr.hier_block.__init__(self, fg, one, sink)
+ self.connect (self, one, sink)
self.win = stripchart_window(self, parent, size=size)
diff --git a/gr-radio-astronomy/src/python/ra_waterfallsink.py b/gr-radio-astronomy/src/python/ra_waterfallsink.py
index 5ca7072c8..e946f3a10 100755
--- a/gr-radio-astronomy/src/python/ra_waterfallsink.py
+++ b/gr-radio-astronomy/src/python/ra_waterfallsink.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2003,2004,2005 Free Software Foundation, Inc.
+# Copyright 2003,2004,2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,7 +21,7 @@
#
from gnuradio import gr, gru, window
-from gnuradio.wxgui import stdgui
+from gnuradio.wxgui import stdgui2
import wx
import gnuradio.wxgui.plot as plot
import numpy
@@ -86,9 +86,6 @@ class waterfall_sink_base(object):
self.input_is_real = input_is_real
self.msgq = gr.msg_queue(2) # queue up to 2 messages
- def reconnect( self, fg ):
- fg.connect( *self.block_list )
-
def set_average(self, average):
self.average = average
if average:
@@ -109,12 +106,16 @@ class waterfall_sink_base(object):
def _set_n(self):
self.one_in_n.set_n(max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
-class waterfall_sink_f(gr.hier_block, waterfall_sink_base):
- def __init__(self, fg, parent, baseband_freq=0,
+class waterfall_sink_f(gr.hier_block2, waterfall_sink_base):
+ def __init__(self, parent, baseband_freq=0,
ref_level=0, sample_rate=1, fft_size=512,
fft_rate=default_fft_rate, average=False, avg_alpha=None,
title='', size=default_fftsink_size, report=None, span=40, ofunc=None, xydfunc=None):
+ gr.hier_block2.__init__(self, "waterfall_sink_f",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(0, 0, 0))
+
waterfall_sink_base.__init__(self, input_is_real=True,
baseband_freq=baseband_freq,
sample_rate=sample_rate,
@@ -132,21 +133,22 @@ class waterfall_sink_f(gr.hier_block, waterfall_sink_base):
log = gr.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size))
sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
- self.block_list = (s2p, self.one_in_n, fft, c2mag, self.avg, log, sink)
- self.reconnect( fg )
- gr.hier_block.__init__(self, fg, s2p, sink)
-
+ self.connect(self, s2p, self.one_in_n, fft, c2mag, self.avg, log, sink)
self.win = waterfall_window(self, parent, size=size, report=report,
ref_level=ref_level, span=span, ofunc=ofunc, xydfunc=xydfunc)
self.set_average(self.average)
-class waterfall_sink_c(gr.hier_block, waterfall_sink_base):
- def __init__(self, fg, parent, baseband_freq=0,
+class waterfall_sink_c(gr.hier_block2, waterfall_sink_base):
+ def __init__(self, parent, baseband_freq=0,
ref_level=0, sample_rate=1, fft_size=512,
fft_rate=default_fft_rate, average=False, avg_alpha=None,
title='', size=default_fftsink_size, report=None, span=40, ofunc=None, xydfunc=None):
+ gr.hier_block2.__init__(self, "waterfall_sink_c",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(0, 0, 0))
+
waterfall_sink_base.__init__(self, input_is_real=False,
baseband_freq=baseband_freq,
sample_rate=sample_rate,
@@ -166,10 +168,7 @@ class waterfall_sink_c(gr.hier_block, waterfall_sink_base):
log = gr.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size))
sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
- self.block_list = (s2p, self.one_in_n, fft, c2mag, self.avg, log, sink)
- self.reconnect( fg )
- gr.hier_block.__init__(self, fg, s2p, sink)
-
+ self.connect(self, s2p, self.one_in_n, fft, c2mag, self.avg, log, sink)
self.win = waterfall_window(self, parent, size=size, report=report,
ref_level=ref_level, span=span, ofunc=ofunc, xydfunc=xydfunc)
self.set_average(self.average)
@@ -602,36 +601,12 @@ def tab_item( parent, label, chars, units, style=wx.TE_RIGHT, value="" ):
# ----------------------------------------------------------------
-# Deprecated interfaces
-# ----------------------------------------------------------------
-
-# returns (block, win).
-# block requires a single input stream of float
-# win is a subclass of wxWindow
-
-def make_waterfall_sink_f(fg, parent, title, fft_size, input_rate):
-
- block = waterfall_sink_f(fg, parent, title=title, fft_size=fft_size,
- sample_rate=input_rate)
- return (block, block.win)
-
-# returns (block, win).
-# block requires a single input stream of gr_complex
-# win is a subclass of wxWindow
-
-def make_waterfall_sink_c(fg, parent, title, fft_size, input_rate):
- block = waterfall_sink_c(fg, parent, title=title, fft_size=fft_size,
- sample_rate=input_rate)
- return (block, block.win)
-
-
-# ----------------------------------------------------------------
# Standalone test app
# ----------------------------------------------------------------
-class test_app_flow_graph (stdgui.gui_flow_graph):
+class test_app_flow_graph (stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
- stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv)
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
fft_size = 512
@@ -646,7 +621,7 @@ class test_app_flow_graph (stdgui.gui_flow_graph):
# suck down all the CPU available. Normally you wouldn't use these.
thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
- sink1 = waterfall_sink_c (self, panel, title="Complex Data",
+ sink1 = waterfall_sink_c (panel, title="Complex Data",
fft_size=fft_size,
sample_rate=input_rate, baseband_freq=0,
size=(600,144) )
@@ -657,13 +632,13 @@ class test_app_flow_graph (stdgui.gui_flow_graph):
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)
thr2 = gr.throttle(gr.sizeof_float, input_rate)
- sink2 = waterfall_sink_f (self, panel, title="Real Data", fft_size=fft_size,
+ sink2 = waterfall_sink_f (panel, title="Real Data", fft_size=fft_size,
sample_rate=input_rate, baseband_freq=0)
vbox.Add (sink2.win, 1, wx.EXPAND)
self.connect (src2, thr2, sink2)
def main ():
- app = stdgui.stdapp (test_app_flow_graph,
+ app = stdgui2.stdapp (test_app_flow_graph,
"Waterfall Sink Test App")
app.MainLoop ()
diff --git a/gr-radio-astronomy/src/python/usrp_psr_receiver.py b/gr-radio-astronomy/src/python/usrp_psr_receiver.py
index 21b02127a..3937cb5ae 100755
--- a/gr-radio-astronomy/src/python/usrp_psr_receiver.py
+++ b/gr-radio-astronomy/src/python/usrp_psr_receiver.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2005 Free Software Foundation, Inc.
+# Copyright 2004,2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -29,7 +29,7 @@
# and epoch folding analysis
#
#
-from gnuradio import gr, gru, blks, audio
+from gnuradio import gr, gru, blks2, audio
from usrpm import usrp_dbid
from gnuradio import usrp, optfir
from gnuradio import eng_notation
@@ -46,9 +46,9 @@ import os
import math
-class app_flow_graph(stdgui.gui_flow_graph):
+class app_flow_graph(stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
- stdgui.gui_flow_graph.__init__(self)
+ stdgui2.std_top_block.__init__(self)
self.frame = frame
self.panel = panel
@@ -292,7 +292,7 @@ class app_flow_graph(stdgui.gui_flow_graph):
#
# Create the appropriate FFT scope
#
- self.scope = ra_fftsink.ra_fft_sink_f (self, panel,
+ self.scope = ra_fftsink.ra_fft_sink_f (panel,
fft_size=int(options.fft_size), sample_rate=PULSAR_MAX_FREQ*2,
title="Post-detector spectrum",
ofunc=self.pulsarfunc, xydfunc=self.xydfunc, fft_rate=200)
@@ -366,7 +366,7 @@ class app_flow_graph(stdgui.gui_flow_graph):
self.folder_comb = gr.fft_filter_ccc(1,bogtaps)
# Rational resampler
- self.folder_rr = blks.rational_resampler_fff(self, self.interp, self.decim)
+ self.folder_rr = blks2.rational_resampler_fff(self.interp, self.decim)
# Epoch folder bandpass
bogtaps = Numeric.zeros(1, Numeric.Float64)
diff --git a/gr-radio-astronomy/src/python/usrp_ra_receiver.py b/gr-radio-astronomy/src/python/usrp_ra_receiver.py
index 902354528..c6052a569 100755
--- a/gr-radio-astronomy/src/python/usrp_ra_receiver.py
+++ b/gr-radio-astronomy/src/python/usrp_ra_receiver.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2005 Free Software Foundation, Inc.
+# Copyright 2004,2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -25,7 +25,7 @@ from gnuradio import usrp
from usrpm import usrp_dbid
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
-from gnuradio.wxgui import stdgui, ra_fftsink, ra_stripchartsink, ra_waterfallsink, form, slider, waterfallsink
+from gnuradio.wxgui import stdgui2, ra_fftsink, ra_stripchartsink, ra_waterfallsink, form, slider, waterfallsink
from optparse import OptionParser
import wx
import sys
@@ -40,9 +40,9 @@ class continuum_calibration(gr.feval_dd):
exec(str)
return(x)
-class app_flow_graph(stdgui.gui_flow_graph):
+class app_flow_graph(stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
- stdgui.gui_flow_graph.__init__(self)
+ stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
self.frame = frame
self.panel = panel
@@ -1082,7 +1082,7 @@ class app_flow_graph(stdgui.gui_flow_graph):
self.notch_taps = FFT.inverse_fft(tmptaps)
def main ():
- app = stdgui.stdapp(app_flow_graph, "RADIO ASTRONOMY SPECTRAL/CONTINUUM RECEIVER: $Revision$", nstatus=1)
+ app = stdgui2.stdapp(app_flow_graph, "RADIO ASTRONOMY SPECTRAL/CONTINUUM RECEIVER: $Revision$", nstatus=1)
app.MainLoop()
if __name__ == '__main__':