summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/python
diff options
context:
space:
mode:
authorjcorgan2008-04-11 21:31:25 +0000
committerjcorgan2008-04-11 21:31:25 +0000
commitc989df7703fb0c2869dc1de7e18df311e2bf626a (patch)
tree2b4f504ae311ed1912ba7ce59af048767ecf8be0 /gnuradio-core/src/python
parenta761af14ad4a589637658f20ed3e58fcf7131bdd (diff)
downloadgnuradio-c989df7703fb0c2869dc1de7e18df311e2bf626a.tar.gz
gnuradio-c989df7703fb0c2869dc1de7e18df311e2bf626a.tar.bz2
gnuradio-c989df7703fb0c2869dc1de7e18df311e2bf626a.zip
Adds gr.repeat(), an interpolating block to repeat a sample N times on the output.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8186 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core/src/python')
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_repeat.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py b/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py
new file mode 100755
index 000000000..88dbae06e
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+#
+# Copyright 2008 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.
+#
+
+from gnuradio import gr, gr_unittest
+import math
+
+class test_repeat (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_float(self):
+ src_data = [1.0, 2.0, 3.0]
+ dst_data = [1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0]
+ src = gr.vector_source_f(src_data)
+ rpt = gr.repeat(gr.sizeof_float, 3)
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, rpt, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)
+
+if __name__ == '__main__':
+ gr_unittest.main ()