summaryrefslogtreecommitdiff
path: root/gr-error-correcting-codes/src/python
diff options
context:
space:
mode:
authormichaelld <michaelld@221aa14e-8319-0410-a670-987f0aec2ac5>2006-08-27 23:12:06 +0000
committermichaelld <michaelld@221aa14e-8319-0410-a670-987f0aec2ac5>2006-08-27 23:12:06 +0000
commit4279fc2bf97c7cd2b970b9fe55fd727626ae48ae (patch)
treed8d9ec8cef21c1e43f2dcab1b9aa1bdf3697c3fb /gr-error-correcting-codes/src/python
parentef47957bdc5340fca828635988e8fd64a9a3fc71 (diff)
Fixed python qa code in gr-ecc. Moved the non-standard qa tests into
gr-ecc/examples for now until the gr-ecc blocks are fully operational. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3447 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-error-correcting-codes/src/python')
-rw-r--r--gr-error-correcting-codes/src/python/Makefile.am5
-rwxr-xr-xgr-error-correcting-codes/src/python/qa_ecc.py (renamed from gr-error-correcting-codes/src/python/qa_test_encoder_convolutional_2.py)19
-rwxr-xr-xgr-error-correcting-codes/src/python/qa_test_coding_1.py94
-rwxr-xr-xgr-error-correcting-codes/src/python/qa_test_coding_2.py91
-rwxr-xr-xgr-error-correcting-codes/src/python/qa_test_encoder_convolutional_1.py74
5 files changed, 14 insertions, 269 deletions
diff --git a/gr-error-correcting-codes/src/python/Makefile.am b/gr-error-correcting-codes/src/python/Makefile.am
index 6014946b35..983231f55b 100644
--- a/gr-error-correcting-codes/src/python/Makefile.am
+++ b/gr-error-correcting-codes/src/python/Makefile.am
@@ -23,10 +23,9 @@ include $(top_srcdir)/Makefile.common
EXTRA_DIST = run_tests.in
-# Disabled until fix for finding an audio module in build tree
-# TESTS = run_tests
+TESTS = run_tests
-noinst_PYTHON = qa_test_coding_1.py qa_test_coding_2.py
+noinst_PYTHON = qa_ecc.py
grpython_PYTHON =
diff --git a/gr-error-correcting-codes/src/python/qa_test_encoder_convolutional_2.py b/gr-error-correcting-codes/src/python/qa_ecc.py
index f2ccadb1ce..0cd5ecec2f 100755
--- a/gr-error-correcting-codes/src/python/qa_test_encoder_convolutional_2.py
+++ b/gr-error-correcting-codes/src/python/qa_ecc.py
@@ -20,16 +20,21 @@
# Boston, MA 02111-1307, USA.
#
-from gnuradio import gr
-from gnuradio.eng_option import eng_option
+from gnuradio import gr, gr_unittest
import ecc
-def main ():
- e1 = ecc.streams_encode_convolutional (100, 3, 2, [1, 0, 5, 0, 1, 6])
+class qa_ecc (gr_unittest.TestCase):
- e2 = ecc.streams_encode_convolutional (100, 2, 3, [1, 0, 0, 1, 5, 6])
+ def setUp (self):
+ self.fg = gr.flow_graph ()
- e3 = ecc.streams_encode_convolutional_feedback (100, 2, 3, [1, 7, 0, 1, 5, 6], [1, 1, 1, 1, 017, 017])
+ def tearDown (self):
+ self.fg = None
+
+ def test_000_nop (self):
+ """Just see if we can import the module...
+ They may not have drivers, etc. Don't try to run anything"""
+ pass
if __name__ == '__main__':
- main ()
+ gr_unittest.main ()
diff --git a/gr-error-correcting-codes/src/python/qa_test_coding_1.py b/gr-error-correcting-codes/src/python/qa_test_coding_1.py
deleted file mode 100755
index 90c479dffc..0000000000
--- a/gr-error-correcting-codes/src/python/qa_test_coding_1.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2005 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 2, 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, audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-# must be imported from local directory so that make check
-# can run before installation
-import ecc
-
-class my_graph(gr.flow_graph):
-
- def __init__(self):
- gr.flow_graph.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
- (options, args) = parser.parse_args ()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = int(options.sample_rate)
- audio_option = options.audio_output
- src = audio.source (sample_rate, audio_option)
- src_out_chan = src.output_signature().max_streams()
- dst = audio.sink (sample_rate, str(src_out_chan))
- dst_in_chan = dst.input_signature().max_streams()
- audio_el_size = src.output_signature().sizeof_stream_item(1)
- frame_size = 1000
- do_mux_outputs = 0
- enc_code_in_chan = src_out_chan
- code_generators = [05, 06] #, 03, 04] # , 0, 07]
- enc_code_out_chan = len (code_generators) / enc_code_in_chan
- do_termination = 1
-
- if do_mux_outputs == 1:
- enc_dec_chan = 1
- else:
- enc_dec_chan = enc_code_out_chan
-
- ss_enc = ecc.streams_encode_convolutional (frame_size,
- enc_code_in_chan,
- enc_code_out_chan,
- code_generators,
- do_termination)
-# for now
- ss2s = gr.streams_to_stream (1, enc_dec_chan);
- ns = gr.null_sink (1);
-# end for now
-
-# ss_dec = error-correcting-codes.frames_to_streams (audio_el_size, 1, 1000)
-
- for i in range (src_out_chan):
- self.connect ((src, i), (ss_enc, i))
-# for now
- for i in range (enc_dec_chan):
- self.connect ((ss_enc, i), (ss2s, i))
- self.connect (ss2s, ns)
-# end for now
-
-# for i in range (enc_dec_chan):
-# self.connect ((ss_enc, i), (ss_dec, i))
-
-# for i in range (dst_in_chan):
-# self.connect ((ss_dec, i), (dst, i))
-
-if __name__ == '__main__':
- try:
- my_graph().run()
- except KeyboardInterrupt:
- pass
diff --git a/gr-error-correcting-codes/src/python/qa_test_coding_2.py b/gr-error-correcting-codes/src/python/qa_test_coding_2.py
deleted file mode 100755
index 1ddd50c2b6..0000000000
--- a/gr-error-correcting-codes/src/python/qa_test_coding_2.py
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2006 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 2, 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, audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-# must be imported from local directory so that make check
-# can run before installation
-import ecc
-
-class my_graph(gr.flow_graph):
-
- def __init__(self):
- gr.flow_graph.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
- (options, args) = parser.parse_args ()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = int(options.sample_rate)
- audio_option = options.audio_output
- src = audio.source (sample_rate, audio_option)
- enc_chan_in = 2
- src_out_chan = src.output_signature().max_streams()
- dst = audio.sink (sample_rate, str(enc_chan_in))
- dst_in_chan = dst.input_signature().max_streams()
- audio_el_size = dst.input_signature().sizeof_stream_item(0)
- frame_size = 10
- enc_code_in_chan = enc_chan_in
- code_generators = [05, 06] #, 03, 04] #, 0, 07]
- enc_code_out_chan = len (code_generators) / enc_code_in_chan
- do_termination = 1
-
- ss_enc = ecc.streams_encode_convolutional (frame_size,
- enc_code_in_chan,
- enc_code_out_chan,
- code_generators,
- do_termination)
-
- for i in range (src_out_chan):
- p2up = gr.packed_to_unpacked_bb (1, 1)
- self.connect ((src, i), p2up, (ss_enc, i))
-
- tau_bits = 0 # 0 -> decode all first
- ss_dec = error-correcting-codes.dec_blk_conv_soft_full (audio_el_size,
- frame_size,
- do_termination,
- do_mux_outputs,
- enc_code_in_chan,
- enc_code_out_chan,
- code_generators)
- up2bf0 = gr.chunks_to_symbols_bf ([1.0, -1.0])
- self.connect ((ss_enc, 0), p2up0, up2bf0, (ss_dec, 0))
- if enc_dec_chan > 1:
- p2up1 = gr.packed_to_unpacked_bb (1, 1)
- up2bf1 = gr.chunks_to_symbols_bf ([1.0, -1.0])
- self.connect ((ss_enc, 1), p2up1, up2bf1, (ss_dec, 1))
-
- for i in range (dst_in_chan):
- self.connect ((ss_dec, i), (dst, i))
-
-if __name__ == '__main__':
- try:
- my_graph().run()
- except KeyboardInterrupt:
- pass
diff --git a/gr-error-correcting-codes/src/python/qa_test_encoder_convolutional_1.py b/gr-error-correcting-codes/src/python/qa_test_encoder_convolutional_1.py
deleted file mode 100755
index 0eeca99285..0000000000
--- a/gr-error-correcting-codes/src/python/qa_test_encoder_convolutional_1.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2005 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 2, 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, audio
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-# must be imported from local directory so that make check
-# can run before installation
-import ecc
-
-class my_graph(gr.flow_graph):
-
- def __init__(self):
- gr.flow_graph.__init__(self)
-
- parser = OptionParser(option_class=eng_option)
- parser.add_option("-O", "--audio-output", type="string", default="",
- help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
- parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
- help="set sample rate to RATE (48000)")
- (options, args) = parser.parse_args ()
- if len(args) != 0:
- parser.print_help()
- raise SystemExit, 1
-
- sample_rate = int(options.sample_rate)
- audio_option = options.audio_output
- src = audio.source (sample_rate, audio_option)
- src_out_chan = src.output_signature().max_streams()
- dst = audio.sink (sample_rate, str(src_out_chan))
- dst_in_chan = dst.input_signature().max_streams()
- audio_el_size = src.output_signature().sizeof_stream_item(1)
- frame_size = 10
- enc_code_in_chan = src_out_chan
- code_generators = [05, 06] #, 03, 04] # , 0, 07]
- enc_code_out_chan = len (code_generators) / enc_code_in_chan
- do_termination = 1
-
- ss_enc = ecc.streams_encode_convolutional (frame_size,
- enc_code_in_chan,
- enc_code_out_chan,
- code_generators,
- do_termination)
- for i in range (enc_code_in_chan):
- self.connect ((src, i), (ss_enc, i))
-
- for i in range (enc_code_out_chan):
- ns = gr.null_sink (1)
- self.connect ((ss_enc, i), ns)
-
-if __name__ == '__main__':
- try:
- my_graph().run()
- except KeyboardInterrupt:
- pass