def test_003_make_f(self):
     src = gr.glfsr_source_f(16)
     src.start()
     time.sleep(
         1)  # Add sleep here to allow serviceFunction to start and run
     self.assertEquals(src.mask, 0x8016)
     self.assertEquals(src.period, 2**16 - 1)
 def test_001_correlate(self):
     degree = 10
     length = 2**degree-1
     src = gr.glfsr_source_f(degree)
     head = gr.head(gr.sizeof_float, length*length)
     f2c = gr.float_to_complex()
     corr = gr.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))
    def test_005_correlation_f(self):
        for degree in range(1,11):                # Higher degrees take too long to correlate
            src = gr.glfsr_source_f(degree, False)
            dst = gr.vector_sink_f()
            self.fg.connect(src, dst)
            self.fg.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
Ejemplo n.º 4
0
    def test_005_correlation_f(self):
        for degree in range(1,11):                # Higher degrees take too long to correlate
            src = gr.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
 def test_004_degree_f(self):
     self.assertRaises(RuntimeError,
                       lambda: gr.glfsr_source_f(0))
     self.assertRaises(RuntimeError,
                       lambda: gr.glfsr_source_f(33))
 def test_003_make_f(self):
     src = gr.glfsr_source_f(16)
     self.assertEquals(src.mask(), 0x8016)
     self.assertEquals(src.period(), 2**16-1)
 def test_003_make_f(self):
     src = gr.glfsr_source_f(16)
     src.start()
     time.sleep(1) # Add sleep here to allow serviceFunction to start and run
     self.assertEquals(src.mask, 0x8016)
     self.assertEquals(src.period, 2**16-1)
Ejemplo n.º 8
0
 def test_004_degree_f(self):
     self.assertRaises(RuntimeError,
                       lambda: gr.glfsr_source_f(0))
     self.assertRaises(RuntimeError,
                       lambda: gr.glfsr_source_f(33))
Ejemplo n.º 9
0
 def test_003_make_f(self):
     src = gr.glfsr_source_f(16)
     self.assertEquals(src.mask(), 0x8016)
     self.assertEquals(src.period(), 2**16-1)