summaryrefslogtreecommitdiff
path: root/gr-blocks/python
diff options
context:
space:
mode:
authorJohnathan Corgan2012-06-23 09:25:42 -0700
committerJohnathan Corgan2012-06-23 09:25:42 -0700
commit737b3dc0c41a867ea38c1475a3877bc0fb6f3ee2 (patch)
treefbd543740b7dc1e232c4915b64a23080a0d7a16d /gr-blocks/python
parent48ba99044710dc69c0ebdd3fbe97798622713a9f (diff)
downloadgnuradio-737b3dc0c41a867ea38c1475a3877bc0fb6f3ee2.tar.gz
gnuradio-737b3dc0c41a867ea38c1475a3877bc0fb6f3ee2.tar.bz2
gnuradio-737b3dc0c41a867ea38c1475a3877bc0fb6f3ee2.zip
blocks: added gr::blocks::complex_to_mag_squared
Diffstat (limited to 'gr-blocks/python')
-rwxr-xr-xgr-blocks/python/qa_type_conversions.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/gr-blocks/python/qa_type_conversions.py b/gr-blocks/python/qa_type_conversions.py
index 92590feac..4b8904f0e 100755
--- a/gr-blocks/python/qa_type_conversions.py
+++ b/gr-blocks/python/qa_type_conversions.py
@@ -127,6 +127,16 @@ class test_type_conversions(gr_unittest.TestCase):
self.tb.run()
self.assertFloatTuplesAlmostEqual(expected_data, dst.data(), 5)
+ def test_complex_to_mag_squared(self):
+ src_data = (1+2j, 3-4j, 5+6j, 7-8j, -9+10j)
+ expected_data = (5.0, 25.0, 61.0, 113.0, 181.0)
+ src = gr.vector_source_c(src_data)
+ op = blocks_swig.complex_to_mag_squared()
+ dst = gr.vector_sink_f()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
+
if __name__ == '__main__':
gr_unittest.run(test_type_conversions, "test_type_conversions.xml")