diff options
author | mormj <mormjb@gmail.com> | 2020-10-30 10:59:50 -0400 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-10-30 17:52:53 +0100 |
commit | 7a0948ba85758fba1cc3858ef99bfa600dcc7416 (patch) | |
tree | 610d7f9d773a193562def6df2d4b50f1bb3b3f86 /gr-digital/python/digital/qa_costas_loop_cc.py | |
parent | 12192ee7d58de95ddca35a3e93bfc172bdb5c820 (diff) |
qa: run autopep8 formatting on qa python files
find ./ -iname qa*.py | xargs autopep8 --in-place -a -a
mostly formats whitespace and gets rid of trailing semicolons
Diffstat (limited to 'gr-digital/python/digital/qa_costas_loop_cc.py')
-rw-r--r-- | gr-digital/python/digital/qa_costas_loop_cc.py | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/gr-digital/python/digital/qa_costas_loop_cc.py b/gr-digital/python/digital/qa_costas_loop_cc.py index a71e3f4596..6c82992917 100644 --- a/gr-digital/python/digital/qa_costas_loop_cc.py +++ b/gr-digital/python/digital/qa_costas_loop_cc.py @@ -15,6 +15,7 @@ import cmath from gnuradio import gr, gr_unittest, digital, blocks from gnuradio.digital import psk + class test_costas_loop_cc(gr_unittest.TestCase): def setUp(self): @@ -30,7 +31,7 @@ class test_costas_loop_cc(gr_unittest.TestCase): order = 2 self.test = digital.costas_loop_cc(natfreq, order) - data = 100*[complex(1,0),] + data = 100 * [complex(1, 0), ] self.src = blocks.vector_source_c(data, False) self.snk = blocks.vector_sink_c() @@ -47,7 +48,7 @@ class test_costas_loop_cc(gr_unittest.TestCase): order = 2 self.test = digital.costas_loop_cc(natfreq, order) - data = [complex(2*random.randint(0,1)-1, 0) for i in range(100)] + data = [complex(2 * random.randint(0, 1) - 1, 0) for i in range(100)] self.src = blocks.vector_source_c(data, False) self.snk = blocks.vector_sink_c() @@ -65,12 +66,12 @@ class test_costas_loop_cc(gr_unittest.TestCase): order = 2 self.test = digital.costas_loop_cc(natfreq, order) - rot = cmath.exp(0.2j) # some small rotation - data = [complex(2*random.randint(0,1)-1, 0) for i in range(100)] + rot = cmath.exp(0.2j) # some small rotation + data = [complex(2 * random.randint(0, 1) - 1, 0) for i in range(100)] - N = 40 # settling time + N = 40 # settling time expected_result = data[N:] - data = [rot*d for d in data] + data = [rot * d for d in data] self.src = blocks.vector_source_c(data, False) self.snk = blocks.vector_sink_c() @@ -90,13 +91,23 @@ class test_costas_loop_cc(gr_unittest.TestCase): order = 4 self.test = digital.costas_loop_cc(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 range(100)] - - N = 40 # settling time + 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 range(100)] + + N = 40 # settling time expected_result = data[N:] - data = [rot*d for d in data] + data = [rot * d for d in data] self.src = blocks.vector_source_c(data, False) self.snk = blocks.vector_sink_c() @@ -116,16 +127,16 @@ class test_costas_loop_cc(gr_unittest.TestCase): order = 8 self.test = digital.costas_loop_cc(natfreq, order) - rot = cmath.exp(-cmath.pi / 8.0j) # rotate to match Costas rotation + rot = cmath.exp(-cmath.pi / 8.0j) # rotate to match Costas rotation const = psk.psk_constellation(order) - data = [random.randint(0,7) for i in range(100)] - data = [2*rot*const.points()[d] for d in data] + data = [random.randint(0, 7) for i in range(100)] + data = [2 * rot * const.points()[d] for d in data] - N = 40 # settling time + N = 40 # settling time expected_result = data[N:] - rot = cmath.exp(0.1j) # some small rotation - data = [rot*d for d in data] + rot = cmath.exp(0.1j) # some small rotation + data = [rot * d for d in data] self.src = blocks.vector_source_c(data, False) self.snk = blocks.vector_sink_c() @@ -135,9 +146,10 @@ class test_costas_loop_cc(gr_unittest.TestCase): dst_data = self.snk.data()[N:] - # generously compare results; the loop will converge near to, but + # generously compare results; the loop will converge near to, but # not exactly on, the target data self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 2) + if __name__ == '__main__': gr_unittest.run(test_costas_loop_cc) |