diff options
author | Brett Gottula <brett@astranis.com> | 2020-04-21 15:39:52 -0700 |
---|---|---|
committer | Michael Dickens <michael.dickens@ettus.com> | 2020-04-23 15:15:58 -0400 |
commit | cfdf6546024944b8cbbf2bd24b01c5efa5a6c237 (patch) | |
tree | c07346f3863710ae0187d3e3989eb314f411cb88 /gr-filter | |
parent | 7a30ee7b7528f5852884ab0a8045c0375d623840 (diff) |
filter: Fix firdes RRC filter gain for alpha == 1
* Fix gain of firdes.root_raised_cosine() when alpha is set to 1.0. Was
2x the expected gain for alpha==1.0 previously.
* Adds corresponding unit test.
Diffstat (limited to 'gr-filter')
-rw-r--r-- | gr-filter/lib/firdes.cc | 1 | ||||
-rw-r--r-- | gr-filter/python/filter/qa_firdes.py | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/gr-filter/lib/firdes.cc b/gr-filter/lib/firdes.cc index 4b388f9a0..aa5992475 100644 --- a/gr-filter/lib/firdes.cc +++ b/gr-filter/lib/firdes.cc @@ -571,6 +571,7 @@ vector<float> firdes::root_raised_cosine( } else { if (alpha == 1) { taps[i] = -1; + scale += taps[i]; continue; } x3 = (1 - alpha) * x1; diff --git a/gr-filter/python/filter/qa_firdes.py b/gr-filter/python/filter/qa_firdes.py index 0cac3c013..348fe61ee 100644 --- a/gr-filter/python/filter/qa_firdes.py +++ b/gr-filter/python/filter/qa_firdes.py @@ -163,6 +163,13 @@ class test_firdes(gr_unittest.TestCase): new_taps = filter.firdes.root_raised_cosine(1, 4, 1, 0.35, 11) self.assertFloatTuplesAlmostEqual(known_taps, new_taps, 5) + def test_root_raised_cosine_gain(self): + """Confirm DC gain is as expected""" + taps = filter.firdes.root_raised_cosine(1, 4, 1, 0.35, 11) + self.assertAlmostEqual(sum(taps), 1.0) + taps = filter.firdes.root_raised_cosine(1, 4, 1, 1.0, 11) + self.assertAlmostEqual(sum(taps), 1.0) + def test_gaussian(self): known_taps = (0.0003600157215259969, 0.0031858310103416443, 0.0182281993329525, 0.06743486225605011, |