def test_complex_to_float_1(self):
     src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
     expected_data = (1.0, 3.0, 5.0, 7.0, 9.0)
     src = blocks.vector_source_c(src_data)
     op = blocks.complex_to_float()
     dst = blocks.vector_sink_f()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
Exemple #2
0
 def test_complex_to_float_1(self):
     src_data = (1 + 2j, 3 + 4j, 5 + 6j, 7 + 8j, 9 + 10j)
     expected_data = (1.0, 3.0, 5.0, 7.0, 9.0)
     src = blocks.vector_source_c(src_data)
     op = blocks.complex_to_float()
     dst = blocks.vector_sink_f()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
 def test_complex_to_float_2(self):
     src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
     expected_data1 = (1.0, 3.0, 5.0, 7.0, 9.0)
     expected_data2 = (2.0, 4.0, 6.0, 8.0, 10.0)
     src = blocks.vector_source_c(src_data)
     op = blocks.complex_to_float()
     dst1 = blocks.vector_sink_f()
     dst2 = blocks.vector_sink_f()
     self.tb.connect(src, op)
     self.tb.connect((op, 0), dst1)
     self.tb.connect((op, 1), dst2)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data1, dst1.data())
     self.assertFloatTuplesAlmostEqual(expected_data2, dst2.data())
Exemple #4
0
 def test_complex_to_float_2(self):
     src_data = (1 + 2j, 3 + 4j, 5 + 6j, 7 + 8j, 9 + 10j)
     expected_data1 = (1.0, 3.0, 5.0, 7.0, 9.0)
     expected_data2 = (2.0, 4.0, 6.0, 8.0, 10.0)
     src = blocks.vector_source_c(src_data)
     op = blocks.complex_to_float()
     dst1 = blocks.vector_sink_f()
     dst2 = blocks.vector_sink_f()
     self.tb.connect(src, op)
     self.tb.connect((op, 0), dst1)
     self.tb.connect((op, 1), dst2)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data1, dst1.data())
     self.assertFloatTuplesAlmostEqual(expected_data2, dst2.data())