summaryrefslogtreecommitdiff
path: root/gr-fft/python/fft/qa_window.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-fft/python/fft/qa_window.py')
-rw-r--r--gr-fft/python/fft/qa_window.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/gr-fft/python/fft/qa_window.py b/gr-fft/python/fft/qa_window.py
new file mode 100644
index 0000000000..f5afd2640d
--- /dev/null
+++ b/gr-fft/python/fft/qa_window.py
@@ -0,0 +1,37 @@
+#!/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.win_type.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)