diff options
Diffstat (limited to 'gr-digital/python')
-rw-r--r-- | gr-digital/python/qa_costas_loop_cc.py | 61 |
1 files changed, 24 insertions, 37 deletions
diff --git a/gr-digital/python/qa_costas_loop_cc.py b/gr-digital/python/qa_costas_loop_cc.py index 464534723..0a1f4a97d 100644 --- a/gr-digital/python/qa_costas_loop_cc.py +++ b/gr-digital/python/qa_costas_loop_cc.py @@ -34,11 +34,11 @@ class test_digital(gr_unittest.TestCase): def test01 (self): # test basic functionality by setting all gains to 0 - alpha = beta = max_freq = min_freq = 0.0 + damp = 0.4 + natfreq = 0.25 order = 2 - self.test = digital_swig.costas_loop_cc(alpha, beta, - max_freq, min_freq, - order) + self.test = digital_swig.costas_loop_cc(damp, natfreq, order) + data = 100*[complex(1,0),] self.src = gr.vector_source_c(data, False) self.snk = gr.vector_sink_c() @@ -52,14 +52,11 @@ class test_digital(gr_unittest.TestCase): def test02 (self): # Make sure it doesn't diverge given perfect data - alpha = 0.1 - beta = 0.25*alpha*alpha - max_freq = 0.25 - min_freq = -0.25 + damp = 0.4 + natfreq = 0.25 order = 2 - self.test = digital_swig.costas_loop_cc(alpha, beta, - max_freq, min_freq, - order) + self.test = digital_swig.costas_loop_cc(damp, natfreq, order) + data = [complex(2*random.randint(0,1)-1, 0) for i in xrange(100)] self.src = gr.vector_source_c(data, False) self.snk = gr.vector_sink_c() @@ -74,14 +71,11 @@ class test_digital(gr_unittest.TestCase): def test03 (self): # BPSK Convergence test with static rotation - alpha = 0.25 - beta = 0.25*alpha*alpha - max_freq = 0.25 - min_freq = -0.25 + damp = 0.4 + natfreq = 0.25 order = 2 - self.test = digital_swig.costas_loop_cc(alpha, beta, - max_freq, min_freq, - order) + self.test = digital_swig.costas_loop_cc(damp, natfreq, order) + rot = cmath.exp(0.2j) # some small rotation data = [complex(2*random.randint(0,1)-1, 0) for i in xrange(100)] @@ -103,14 +97,11 @@ class test_digital(gr_unittest.TestCase): def test04 (self): # QPSK Convergence test with static rotation - alpha = 0.25 - beta = 0.25*alpha*alpha - max_freq = 0.25 - min_freq = -0.25 + damp = 0.4 + natfreq = 0.25 order = 4 - self.test = digital_swig.costas_loop_cc(alpha, beta, - max_freq, min_freq, - order) + self.test = digital_swig.costas_loop_cc(damp, natfreq, order) + rot = cmath.exp(0.2j) # some small rotation data = [complex(2*random.randint(0,1)-1, 2*random.randint(0,1)-1) for i in xrange(100)] @@ -133,21 +124,20 @@ class test_digital(gr_unittest.TestCase): def test05 (self): # 8PSK Convergence test with static rotation - alpha = 0.25 - beta = 0.25*alpha*alpha - max_freq = 0.25 - min_freq = -0.25 + damp = 0.5 + natfreq = 0.5 order = 8 - self.test = digital_swig.costas_loop_cc(alpha, beta, - max_freq, min_freq, - order) - rot = cmath.exp(cmath.pi/16.0j) # some small rotation + self.test = digital_swig.costas_loop_cc(damp, natfreq, order) + + rot = cmath.exp(-cmath.pi/8.0j) # rotate to match Costas rotation const = blks2.psk.make_constellation(order) data = [random.randint(0,7) for i in xrange(100)] - data = [rot*const[d] for d in data] + data = [2*rot*const[d] for d in data] N = 40 # settling time expected_result = data[N:] + + rot = cmath.exp(0.1j) # some small rotation data = [rot*d for d in data] self.src = gr.vector_source_c(data, False) @@ -157,9 +147,6 @@ class test_digital(gr_unittest.TestCase): self.tb.run() dst_data = self.snk.data()[N:] - - print expected_result - print dst_data # generously compare results; the loop will converge near to, but # not exactly on, the target data |