def test_float_to_complex_1(self):
     src_data = (1.0, 3.0, 5.0, 7.0, 9.0)
     expected_data = (1+0j, 3+0j, 5+0j, 7+0j, 9+0j)
     src = blocks.vector_source_f(src_data)
     op = blocks.float_to_complex()
     dst = blocks.vector_sink_c()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
Example #2
0
 def test_float_to_complex_1(self):
     src_data = (1.0, 3.0, 5.0, 7.0, 9.0)
     expected_data = (1 + 0j, 3 + 0j, 5 + 0j, 7 + 0j, 9 + 0j)
     src = blocks.vector_source_f(src_data)
     op = blocks.float_to_complex()
     dst = blocks.vector_sink_c()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
Example #3
0
 def test_001_correlate(self):
     degree = 10
     length = 2**degree - 1
     src = digital.glfsr_source_f(degree)
     head = blocks.head(gr.sizeof_float, length * length)
     f2c = blocks.float_to_complex()
     corr = digital.pn_correlator_cc(degree)
     dst = blocks.vector_sink_c()
     self.tb.connect(src, head, f2c, corr, dst)
     self.tb.run()
     data = dst.data()
     self.assertEqual(data[-1], (1.0 + 0j))
 def test_001_correlate(self):
     degree = 10
     length = 2**degree-1
     src = digital.glfsr_source_f(degree)
     head = blocks.head(gr.sizeof_float, length*length)
     f2c = blocks.float_to_complex()
     corr = digital.pn_correlator_cc(degree)
     dst = blocks.vector_sink_c()
     self.tb.connect(src, head, f2c, corr, dst)
     self.tb.run()
     data = dst.data()
     self.assertEqual(data[-1], (1.0+0j))
 def test_float_to_complex_2(self):
     src1_data = (1.0, 3.0, 5.0, 7.0, 9.0)
     src2_data = (2.0, 4.0, 6.0, 8.0, 10.0)
     expected_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
     src1 = blocks.vector_source_f(src1_data)
     src2 = blocks.vector_source_f(src2_data)
     op = blocks.float_to_complex()
     dst = blocks.vector_sink_c()
     self.tb.connect(src1, (op, 0))
     self.tb.connect(src2, (op, 1))
     self.tb.connect(op, dst)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
Example #6
0
 def test_float_to_complex_2(self):
     src1_data = (1.0, 3.0, 5.0, 7.0, 9.0)
     src2_data = (2.0, 4.0, 6.0, 8.0, 10.0)
     expected_data = (1 + 2j, 3 + 4j, 5 + 6j, 7 + 8j, 9 + 10j)
     src1 = blocks.vector_source_f(src1_data)
     src2 = blocks.vector_source_f(src2_data)
     op = blocks.float_to_complex()
     dst = blocks.vector_sink_c()
     self.tb.connect(src1, (op, 0))
     self.tb.connect(src2, (op, 1))
     self.tb.connect(op, dst)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data, dst.data())