diff options
Diffstat (limited to 'gr-digital/python/qa_costas_loop_cc.py')
-rw-r--r-- | gr-digital/python/qa_costas_loop_cc.py | 60 |
1 files changed, 21 insertions, 39 deletions
diff --git a/gr-digital/python/qa_costas_loop_cc.py b/gr-digital/python/qa_costas_loop_cc.py index 464534723..d310c4278 100644 --- a/gr-digital/python/qa_costas_loop_cc.py +++ b/gr-digital/python/qa_costas_loop_cc.py @@ -34,11 +34,9 @@ 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 = nfreq = max_freq = min_freq = 0.0 order = 2 - self.test = digital_swig.costas_loop_cc(alpha, beta, - max_freq, min_freq, - order) + self.test = digital_swig.costas_loop_cc(damp, nfreq, order) data = 100*[complex(1,0),] self.src = gr.vector_source_c(data, False) self.snk = gr.vector_sink_c() @@ -52,14 +50,10 @@ 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 + nfreq = 0.4 order = 2 - self.test = digital_swig.costas_loop_cc(alpha, beta, - max_freq, min_freq, - order) + self.test = digital_swig.costas_loop_cc(damp, nfreq, 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 +68,10 @@ 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 + nfreq = 0.4 order = 2 - self.test = digital_swig.costas_loop_cc(alpha, beta, - max_freq, min_freq, - order) + self.test = digital_swig.costas_loop_cc(damp, nfreq, 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 +93,10 @@ 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.25 + nfreq = 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, nfreq, 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,22 +119,21 @@ 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 + nfreq = 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, nfreq, order) + rot1 = 1.41*cmath.exp(1j*cmath.pi/8.0) # rotate and scale to align in and out + rot2 = cmath.exp(0.2j) # some small phase 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] - + N = 40 # settling time + data = [rot1*const[d] for d in data] # rotate to align with sync expected_result = data[N:] - data = [rot*d for d in data] + + # apply "channel" rotation to input data + data = [rot2*d for d in data] self.src = gr.vector_source_c(data, False) self.snk = gr.vector_sink_c() @@ -158,9 +143,6 @@ class test_digital(gr_unittest.TestCase): 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 self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 2) |