diff options
author | Marcus Müller <marcus@hostalia.de> | 2018-08-31 23:02:22 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2018-08-31 23:02:22 +0200 |
commit | 254fe5e89403d4de1fa6663d09efdf946996aff3 (patch) | |
tree | 62877d7ac7fdedf6c397c51e22ac6f97eba97ddf /gr-blocks/python/blocks/qa_rms.py | |
parent | 896d1c9da31963ecf5b0d90942c2af51ca998a69 (diff) | |
parent | 5ad935c3a3dd46ce2860b13e2b774e4841784616 (diff) |
Merge remote-tracking branch 'origin/next' into merge_next
Diffstat (limited to 'gr-blocks/python/blocks/qa_rms.py')
-rw-r--r-- | gr-blocks/python/blocks/qa_rms.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gr-blocks/python/blocks/qa_rms.py b/gr-blocks/python/blocks/qa_rms.py index 0b07c37bdc..53c13b54d1 100644 --- a/gr-blocks/python/blocks/qa_rms.py +++ b/gr-blocks/python/blocks/qa_rms.py @@ -20,19 +20,21 @@ # Boston, MA 02110-1301, USA. # +from __future__ import division + from gnuradio import gr, gr_unittest, blocks import math def sig_source_f(samp_rate, freq, amp, N): - t = map(lambda x: float(x)/samp_rate, xrange(N)) - y = map(lambda x: amp*math.cos(2.*math.pi*freq*x), t) + t = [float(x) / samp_rate for x in range(N)] + y = [amp*math.cos(2.*math.pi*freq*x) for x in t] return y def sig_source_c(samp_rate, freq, amp, N): - t = map(lambda x: float(x)/samp_rate, xrange(N)) - y = map(lambda x: amp*math.cos(2.*math.pi*freq*x) + \ - 1j*amp*math.sin(2.*math.pi*freq*x), t) + t = [float(x) / samp_rate for x in range(N)] + y = [amp*math.cos(2.*math.pi*freq*x) + \ + 1j*amp*math.sin(2.*math.pi*freq*x) for x in t] return y class test_rms(gr_unittest.TestCase): @@ -48,7 +50,7 @@ class test_rms(gr_unittest.TestCase): src_data = sig_source_f(1, 0.01, amp, 200) N = 750000 - expected_data = amp/math.sqrt(2.0) + expected_data = amp / math.sqrt(2.0) src = blocks.vector_source_f(src_data, True) head = blocks.head(gr.sizeof_float, N) |