[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/02: filter: minor reorg of pfb_channeliz
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/02: filter: minor reorg of pfb_channelizer test cases after merge from maint. |
Date: |
Mon, 5 May 2014 13:15:54 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch master
in repository gnuradio.
commit 967489ad32b6235b61dd47890c2d6511e593df7b
Author: Tom Rondeau <address@hidden>
Date: Mon May 5 07:50:29 2014 -0400
filter: minor reorg of pfb_channelizer test cases after merge from maint.
---
gr-filter/python/filter/qa_pfb_channelizer.py | 32 +++++++++++++--------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/gr-filter/python/filter/qa_pfb_channelizer.py
b/gr-filter/python/filter/qa_pfb_channelizer.py
index 009f4a3..e370f51 100755
--- a/gr-filter/python/filter/qa_pfb_channelizer.py
+++ b/gr-filter/python/filter/qa_pfb_channelizer.py
@@ -43,7 +43,7 @@ class test_pfb_channelizer(gr_unittest.TestCase):
self.fs = 5000
# Input samp rate to channelizer.
self.ifs = self.M*self.fs
-
+
self.taps = filter.firdes.low_pass_2(
1, self.ifs, self.fs/2, self.fs/10,
attenuation_dB=80,
@@ -63,6 +63,18 @@ class test_pfb_channelizer(gr_unittest.TestCase):
self.check_channelizer(filter.pfb.channelizer_hier_ccf(
self.M, n_filterbanks=1, taps=self.taps))
+ def test_0002(self):
+ """Test roundig error handling for oversample rate (ok)."""
+ channels, oversample = 36, 25.
+ filter.pfb.channelizer_ccf(channels, taps=self.taps,
+ oversample_rate=channels/oversample)
+
+ def test_0003(self):
+ """Test roundig error handling for oversample rate, (bad)."""
+ self.assertRaises(RuntimeError,
+ filter.pfb.channelizer_ccf,
+ 36, taps=self.taps, oversample_rate=10.1334)
+
def get_input_data(self):
"""
Get the raw data generated by addition of sinusoids.
@@ -108,7 +120,7 @@ class test_pfb_channelizer(gr_unittest.TestCase):
expected_data = self.get_expected_data(L)
received_data = [snk.data() for snk in snks]
-
+
for expected, received in zip(expected_data, received_data):
self.compare_data(expected, received)
@@ -119,12 +131,12 @@ class test_pfb_channelizer(gr_unittest.TestCase):
expected = [x/expected[0] for x in expected]
received = [x/received[0] for x in received]
self.assertComplexTuplesAlmostEqual(expected, received, 3)
-
+
def get_freq(self, data):
freqs = []
for r1, r2 in zip(data[:-1], data[1:]):
- diff = cmath.phase(r1) - cmath.phase(r2)
+ diff = cmath.phase(r1) - cmath.phase(r2)
if diff > math.pi:
diff -= 2*math.pi
if diff < -math.pi:
@@ -150,18 +162,6 @@ class test_pfb_channelizer(gr_unittest.TestCase):
1j*math.sin(2.*math.pi*f*x), t) for f in
self.freqs]
return expected_data
- def test_0002(self):
- """Test roundig error handling for oversample rate (ok)."""
- channels, oversample = 36, 25.
- filter.pfb.channelizer_ccf(channels, taps=self.taps,
- oversample_rate=channels/oversample)
-
- def test_0003(self):
- """Test roundig error handling for oversample rate, (bad)."""
- self.assertRaises(RuntimeError,
- filter.pfb.channelizer_ccf,
- 36, taps=self.taps, oversample_rate=10.1334)
-
if __name__ == '__main__':
gr_unittest.run(test_pfb_channelizer, "test_pfb_channelizer.xml")