summaryrefslogtreecommitdiff
path: root/gr-digital/python/qa_ts_insert_zeros.py
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-03-18 17:38:06 -0400
committerTom Rondeau <trondeau@vt.edu>2013-03-18 17:38:06 -0400
commit04682315bf151fb2c7c24673676cd8e07ab5fe2e (patch)
treebfa4a5157719b134adc5f6f3783f790220ae2f6b /gr-digital/python/qa_ts_insert_zeros.py
parent78527080d5cfcc611646d4694ecb9a026b343652 (diff)
parent3206f12930a131914ca2c0d15969c54d8dee5775 (diff)
Merge branch 'next' of gnuradio.org:gnuradio into next
Conflicts: gr-digital/examples/ofdm/ofdm_bugsquatch.py gr-digital/include/digital/scale_tags.h gr-digital/include/digital/tagged_stream_check.h gr-digital/include/digital/ts_insert_zeros_cc.h gr-digital/python/qa_ofdm_sync_sc_cfb.py gr-digital/python/qa_scale_tags.py gr-digital/python/qa_ts_insert_zeros.py gr-digital/swig/digital_swig.i
Diffstat (limited to 'gr-digital/python/qa_ts_insert_zeros.py')
-rw-r--r--gr-digital/python/qa_ts_insert_zeros.py78
1 files changed, 0 insertions, 78 deletions
diff --git a/gr-digital/python/qa_ts_insert_zeros.py b/gr-digital/python/qa_ts_insert_zeros.py
deleted file mode 100644
index 2af6832cf5..0000000000
--- a/gr-digital/python/qa_ts_insert_zeros.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2012,2013 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., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-import time
-import itertools
-
-from gnuradio import gr, gr_unittest
-try: import pmt
-except: from gruel import pmt
-import blocks_swig as blocks
-import digital_swig as digital
-from utils import tagged_streams
-
-class qa_ts_insert_zeros (gr_unittest.TestCase):
-
- def test_one(self):
- n_packets = 10
- packet_length = 1000
- packets = [[i]*packet_length for i in range(1, n_packets+1)]
- tagname = "packet_length"
- data, tags = tagged_streams.packets_to_vectors(packets, tagname)
- tb = gr.top_block()
- src = blocks.vector_source_c(data, False, 1, tags)
- rate_in = 16000
- rate_out = 48000
- ratio = float(rate_out) / rate_in
- throttle1 = blocks.throttle(gr.sizeof_gr_complex, rate_in)
- insert_zeros = digital.ts_insert_zeros_cc(tagname)
- throttle2 = blocks.throttle(gr.sizeof_gr_complex, rate_out)
- head = blocks.head(gr.sizeof_gr_complex, int(n_packets * packet_length * ratio*2))
- snk = blocks.vector_sink_c()
- tb.connect(src, throttle1, insert_zeros, throttle2, head, snk)
- tb.run()
- data = snk.data()
- state = 1
- pos = 0
- last_non_zero = 0
- for i, d in enumerate(data):
- if d != 0:
- last_non_zero = i
- if pos == 0:
- if (d == state):
- pos = pos + 1
- elif (d != 0):
- raise ValueError("Invalid")
- elif pos > 0:
- if (d != state):
- raise ValueError("Invalid")
- pos = pos + 1
- if pos == packet_length:
- state += 1
- pos = 0
- min_ratio = ratio-1
- max_ratio = ratio+1
- self.assertEqual(state-1, n_packets)
- self.assertTrue(last_non_zero > min_ratio*packet_length*n_packets)
- self.assertTrue(last_non_zero < max_ratio*packet_length*n_packets)
-
-if __name__ == '__main__':
- gr_unittest.run(qa_ts_insert_zeros, "qa_ts_insert_zeros.xml")