forked from gnuradio/gnuradio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqa_window.py
42 lines (34 loc) · 797 Bytes
/
qa_window.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
#
# Copyright 2020 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
"""
Unit tests for fft.window
"""
import numpy
from gnuradio import gr_unittest
from gnuradio import fft
class test_window(gr_unittest.TestCase):
"""
Unit tests for fft.window
"""
def setUp(self):
pass
def tearDown(self):
pass
def test_normwin(self):
"""
Verify window normalization
"""
win = fft.window.build(
fft.window.WIN_BLACKMAN_hARRIS,
21,
normalize=True)
power = numpy.sum([x * x for x in win]) / len(win)
self.assertAlmostEqual(power, 1.0)
if __name__ == '__main__':
gr_unittest.run(test_window)