def test_001_correlate(self):
     degree = 10
     length = 2**degree-1
     src = digital.glfsr_source_f(degree)
     head = gr.head(gr.sizeof_float, length*length)
     f2c = gr.float_to_complex()
     corr = digital.pn_correlator_cc(degree)
     dst = gr.vector_sink_c()
     self.tb.connect(src, head, f2c, corr, dst)
     self.tb.run()
     data = dst.data()
     self.assertEqual(data[-1], (1.0+0j))
Esempio n. 2
0
 def test_001_correlate(self):
     degree = 10
     length = 2**degree - 1
     src = digital.glfsr_source_f(degree)
     head = gr.head(gr.sizeof_float, length * length)
     f2c = gr.float_to_complex()
     corr = digital.pn_correlator_cc(degree)
     dst = gr.vector_sink_c()
     self.tb.connect(src, head, f2c, corr, dst)
     self.tb.run()
     data = dst.data()
     self.assertEqual(data[-1], (1.0 + 0j))
Esempio n. 3
0
    def test_005_correlation_f(self):
        for degree in range(1,11):                # Higher degrees take too long to correlate
            src = digital.glfsr_source_f(degree, False)
            dst = blocks.vector_sink_f()
	    del self.tb # Discard existing top block
	    self.tb = gr.top_block()
            self.tb.connect(src, dst)
            self.tb.run()

            actual_result = dst.data()
            R = auto_correlate(actual_result)
            self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at origin
            for i in range(len(R)-1):
                self.assertEqual(R[i+1], -1.0)    # Auto-correlation minimum everywhere else
Esempio n. 4
0
    def test_005_correlation_f(self):
        for degree in range(1,11):                # Higher degrees take too long to correlate
            src = digital.glfsr_source_f(degree, False)
            dst = gr.vector_sink_f()
	    del self.tb # Discard existing top block
	    self.tb = gr.top_block()
            self.tb.connect(src, dst)
            self.tb.run()

            actual_result = dst.data()
            R = auto_correlate(actual_result)
            self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at origin
            for i in range(len(R)-1):
                self.assertEqual(R[i+1], -1.0)    # Auto-correlation minimum everywhere else
Esempio n. 5
0
 def test_004_degree_f(self):
     self.assertRaises(RuntimeError,
                       lambda: digital.glfsr_source_f(0))
     self.assertRaises(RuntimeError,
                       lambda: digital.glfsr_source_f(33))
Esempio n. 6
0
 def test_003_make_f(self):
     src = digital.glfsr_source_f(16)
     self.assertEquals(src.mask(), 0x8016)
     self.assertEquals(src.period(), 2**16-1)
Esempio n. 7
0
 def test_004_degree_f(self):
     self.assertRaises(RuntimeError, lambda: digital.glfsr_source_f(0))
     self.assertRaises(RuntimeError, lambda: digital.glfsr_source_f(33))
Esempio n. 8
0
 def test_003_make_f(self):
     src = digital.glfsr_source_f(16)
     self.assertEquals(src.mask(), 0x8016)
     self.assertEquals(src.period(), 2**16 - 1)