summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgr-atsc/src/python/btl-fsd.py42
-rwxr-xr-xgr-atsc/src/python/fpll.py14
-rwxr-xr-xgr-atsc/src/python/interp.py16
-rwxr-xr-xgr-atsc/src/python/qa_atsc.py63
-rwxr-xr-xgr-atsc/src/python/viterbi-out.py8
-rwxr-xr-xgr-atsc/src/python/xlate.py8
6 files changed, 88 insertions, 63 deletions
diff --git a/gr-atsc/src/python/btl-fsd.py b/gr-atsc/src/python/btl-fsd.py
index ed26f4bbc..6de1007d2 100755
--- a/gr-atsc/src/python/btl-fsd.py
+++ b/gr-atsc/src/python/btl-fsd.py
@@ -1,9 +1,29 @@
-#!/usr/bin/python
+#!/usr/bin/env python
+#
+# Copyright 2004,2005,2007 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
from gnuradio import gr
from gnuradio import atsc
-fg = gr.flow_graph()
+tb = gr.top_block()
btl = atsc.bit_timing_loop()
fsc = atsc.fs_checker()
@@ -14,15 +34,15 @@ out_data = gr.file_sink(atsc.sizeof_atsc_soft_data_segment,"/tmp/atsc_pipe_5")
inp = gr.file_source(gr.sizeof_float,"/tmp/atsc_pipe_3")
-fg.connect(inp,btl)
-fg.connect((btl,0),(fsc,0))
-fg.connect((btl,1),(fsc,1))
-fg.connect((fsc,0),(eq,0))
-fg.connect((fsc,1),(eq,1))
-fg.connect((eq,0),(fsd,0))
-fg.connect((eq,1),(fsd,1))
-fg.connect(fsd,out_data)
+tb.connect(inp,btl)
+tb.connect((btl,0),(fsc,0))
+tb.connect((btl,1),(fsc,1))
+tb.connect((fsc,0),(eq,0))
+tb.connect((fsc,1),(eq,1))
+tb.connect((eq,0),(fsd,0))
+tb.connect((eq,1),(fsd,1))
+tb.connect(fsd,out_data)
-fg.run()
+tb.run()
diff --git a/gr-atsc/src/python/fpll.py b/gr-atsc/src/python/fpll.py
index 34a21974f..672fba83b 100755
--- a/gr-atsc/src/python/fpll.py
+++ b/gr-atsc/src/python/fpll.py
@@ -25,7 +25,7 @@ import math
def main():
- fg = gr.flow_graph()
+ tb = gr.top_block()
u = gr.file_source(gr.sizeof_float,"/tmp/atsc_pipe_2")
@@ -68,13 +68,13 @@ def main():
out = gr.file_sink(gr.sizeof_float,"/tmp/atsc_pipe_3")
# out = gr.file_sink(gr.sizeof_float,"/mnt/sata/atsc_data_float")
- fg.connect(u, fpll, lp_filter)
- fg.connect(lp_filter, iir)
- fg.connect(lp_filter, (remove_dc,0))
- fg.connect(iir, (remove_dc,1))
- fg.connect(remove_dc, out)
+ tb.connect(u, fpll, lp_filter)
+ tb.connect(lp_filter, iir)
+ tb.connect(lp_filter, (remove_dc,0))
+ tb.connect(iir, (remove_dc,1))
+ tb.connect(remove_dc, out)
- fg.run()
+ tb.run()
if __name__ == '__main__':
diff --git a/gr-atsc/src/python/interp.py b/gr-atsc/src/python/interp.py
index c3447085e..3a1c92f09 100755
--- a/gr-atsc/src/python/interp.py
+++ b/gr-atsc/src/python/interp.py
@@ -1,6 +1,6 @@
#!/usr/bin/env /usr/bin/python
#
-# Copyright 2004 Free Software Foundation, Inc.
+# Copyright 2004,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -46,7 +46,7 @@ def graph (args):
sampling_freq = 6400000
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
src0 = gr.file_source (gr.sizeof_gr_complex,infile)
src1 = gr.sig_source_c (sampling_freq, gr.GR_CONST_WAVE, 1, 0)
@@ -59,14 +59,14 @@ def graph (args):
file = gr.file_sink(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1")
- fg.connect( src0, (interlv, 0) )
- fg.connect( src1, (interlv, 1) )
- fg.connect( src2, (interlv, 2) )
- fg.connect( interlv, lp, file )
+ tb.connect( src0, (interlv, 0) )
+ tb.connect( src1, (interlv, 1) )
+ tb.connect( src2, (interlv, 2) )
+ tb.connect( interlv, lp, file )
- fg.start()
+ tb.start()
raw_input ('Head End: Press Enter to stop')
- fg.stop()
+ tb.stop()
if __name__ == '__main__':
graph (sys.argv[1:])
diff --git a/gr-atsc/src/python/qa_atsc.py b/gr-atsc/src/python/qa_atsc.py
index f0d0234c0..63621bd90 100755
--- a/gr-atsc/src/python/qa_atsc.py
+++ b/gr-atsc/src/python/qa_atsc.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2006 Free Software Foundation, Inc.
+# Copyright 2004,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -68,36 +68,41 @@ def depad_transport_stream(src):
return depad_stream(src, atsc.sizeof_atsc_mpeg_packet, atsc.sizeof_atsc_mpeg_packet_pad)
-class vector_source_ts(gr.hier_block):
+class vector_source_ts(gr.hier_block2):
"""
MPEG Transport stream source for testing.
"""
- def __init__(self, fg, ts):
+ def __init__(self, ts):
"""
Pad tranport stream packets to 256 bytes and reformat appropriately.
- @param fg: flow graph
@param ts: MPEG transport stream.
@type ts: sequence of ints in [0,255]; len(ts) % 188 == 0
"""
+
src = gr.vector_source_b(pad_transport_stream(ts))
s2v = gr.stream_to_vector(gr.sizeof_char, atsc.sizeof_atsc_mpeg_packet)
- fg.connect(src, s2v)
- gr.hier_block.__init__(self, fg, None, s2v)
+ gr.hier_block2.__init__(self, "vector_source_ts",
+ gr.io_signature(0, 0, 0),
+ s2v.output_signature())
+ self.connect(src, s2v, self)
-class vector_sink_ts(gr.hier_block):
+
+class vector_sink_ts(gr.hier_block2):
"""
MPEG Transport stream sink for testing.
"""
- def __init__(self, fg):
+ def __init__(self):
"""
- @param fg: flow graph
"""
+
v2s = gr.vector_to_stream(gr.sizeof_char, atsc.sizeof_atsc_mpeg_packet)
self.sink = gr.vector_sink_b()
- fg.connect(v2s, self.sink)
- gr.hier_block.__init__(self, fg, v2s, None)
+ gr.hier_block2.__init__(self, "vector_sink_ts",
+ v2s.input_signature(),
+ gr.io_signature(0, 0, 0))
+ self.connect(self, v2s, self.sink)
def data(self):
"""
@@ -113,10 +118,10 @@ class vector_sink_ts(gr.hier_block):
class qa_atsc(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
# The tests are run in alphabetical order
@@ -128,12 +133,12 @@ class qa_atsc(gr_unittest.TestCase):
src_data = make_transport_stream()
expected_result = src_data
- src = vector_source_ts(self.fg, src_data)
+ src = vector_source_ts(src_data)
rand = atsc.randomizer()
derand = atsc.derandomizer()
- dst = vector_sink_ts(self.fg)
- self.fg.connect(src, rand, derand, dst)
- self.fg.run ()
+ dst = vector_sink_ts()
+ self.tb.connect(src, rand, derand, dst)
+ self.tb.run ()
result_data = dst.data ()
self.assertEqual (expected_result, result_data)
@@ -144,14 +149,14 @@ class qa_atsc(gr_unittest.TestCase):
src_data = make_transport_stream()
expected_result = src_data
- src = vector_source_ts(self.fg, src_data)
+ src = vector_source_ts(src_data)
rand = atsc.randomizer()
rs_enc = atsc.rs_encoder()
rs_dec = atsc.rs_decoder()
derand = atsc.derandomizer()
- dst = vector_sink_ts(self.fg)
- self.fg.connect(src, rand, rs_enc, rs_dec, derand, dst)
- self.fg.run ()
+ dst = vector_sink_ts()
+ self.tb.connect(src, rand, rs_enc, rs_dec, derand, dst)
+ self.tb.run ()
result_data = dst.data ()
self.assertEqual (expected_result, result_data)
@@ -164,16 +169,16 @@ class qa_atsc(gr_unittest.TestCase):
interleaver_delay = 52
expected_result = src_data[0:len(src_data)-(interleaver_delay*atsc.ATSC_MPEG_PKT_LENGTH)]
- src = vector_source_ts(self.fg, src_data)
+ src = vector_source_ts(src_data)
rand = atsc.randomizer()
rs_enc = atsc.rs_encoder()
inter = atsc.interleaver()
deinter = atsc.deinterleaver()
rs_dec = atsc.rs_decoder()
derand = atsc.derandomizer()
- dst = vector_sink_ts(self.fg)
- self.fg.connect(src, rand, rs_enc, inter, deinter, rs_dec, derand, dst)
- self.fg.run ()
+ dst = vector_sink_ts()
+ self.tb.connect(src, rand, rs_enc, inter, deinter, rs_dec, derand, dst)
+ self.tb.run ()
result_data = dst.data ()
result_data = result_data[(interleaver_delay*atsc.ATSC_MPEG_PKT_LENGTH):len(result_data)]
self.assertEqual (expected_result, result_data)
@@ -190,7 +195,7 @@ class qa_atsc(gr_unittest.TestCase):
viterbi_delay = 12
expected_result = src_data[0:len(src_data)-((interleaver_delay+viterbi_delay)*atsc.ATSC_MPEG_PKT_LENGTH)]
- src = vector_source_ts(self.fg, src_data)
+ src = vector_source_ts(src_data)
rand = atsc.randomizer()
rs_enc = atsc.rs_encoder()
inter = atsc.interleaver()
@@ -200,9 +205,9 @@ class qa_atsc(gr_unittest.TestCase):
deinter = atsc.deinterleaver()
rs_dec = atsc.rs_decoder()
derand = atsc.derandomizer()
- dst = vector_sink_ts(self.fg)
- self.fg.connect(src, rand, rs_enc, inter, trellis, softds, viterbi, deinter, rs_dec, derand, dst)
- self.fg.run ()
+ dst = vector_sink_ts()
+ self.tb.connect(src, rand, rs_enc, inter, trellis, softds, viterbi, deinter, rs_dec, derand, dst)
+ self.tb.run ()
result_data = dst.data ()[((interleaver_delay+viterbi_delay)*atsc.ATSC_MPEG_PKT_LENGTH):len(dst.data())]
self.assertEqual (expected_result, result_data)
diff --git a/gr-atsc/src/python/viterbi-out.py b/gr-atsc/src/python/viterbi-out.py
index bd6ec4a27..283ed1b23 100755
--- a/gr-atsc/src/python/viterbi-out.py
+++ b/gr-atsc/src/python/viterbi-out.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2006 Free Software Foundation, Inc.
+# Copyright 2004,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -32,7 +32,7 @@ def main(args):
sys.stderr.write ('usage: viterbi_out.py output_file\n')
sys.exit (1)
- fg = gr.flow_graph()
+ tb = gr.top_block()
src = gr.file_source(atsc.sizeof_atsc_soft_data_segment, "/tmp/atsc_pipe_5")
viterbi = atsc.viterbi_decoder()
@@ -41,8 +41,8 @@ def main(args):
derand = atsc.derandomizer()
depad = atsc.depad()
dst = gr.file_sink(gr.sizeof_char,outfile)
- fg.connect(src, viterbi, deinter, rs_dec, derand, depad, dst)
- fg.run ()
+ tb.connect(src, viterbi, deinter, rs_dec, derand, depad, dst)
+ tb.run ()
if __name__ == '__main__':
diff --git a/gr-atsc/src/python/xlate.py b/gr-atsc/src/python/xlate.py
index 75808def7..e1c8685a9 100755
--- a/gr-atsc/src/python/xlate.py
+++ b/gr-atsc/src/python/xlate.py
@@ -1,6 +1,6 @@
#!/usr/bin/env /usr/bin/python
#
-# Copyright 2004 Free Software Foundation, Inc.
+# Copyright 2004,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -36,7 +36,7 @@ from gnuradio import gr
def graph ():
sampling_freq = 19200000
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
src0 = gr.file_source (gr.sizeof_gr_complex,"/tmp/atsc_pipe_1")
@@ -46,9 +46,9 @@ def graph ():
c2f = gr.complex_to_float()
file = gr.file_sink(gr.sizeof_float,"/tmp/atsc_pipe_2")
- fg.connect( src0, duc, c2f, file )
+ tb.connect( src0, duc, c2f, file )
- fg.run()
+ tb.run()
if __name__ == '__main__':
graph ()