diff options
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) |