add linear filter utility function.

This commit is contained in:
Roman Zeyde
2014-08-14 08:56:09 +03:00
parent 35f077982b
commit 787b356dd0
3 changed files with 12 additions and 13 deletions

View File

@@ -36,18 +36,13 @@ def run(size, chan):
assert rx_data == tx_data
def apply_filter(b, a, x):
f = sigproc.Filter(b=b, a=a)
y = list(f(list(x)))
return np.array(y)
def test_lowpass():
run(1024, lambda x: apply_filter(b=[0.9], a=[1.0, -0.1], x=x))
run(1024, lambda x: sigproc.lfilter(b=[0.9], a=[1.0, -0.1], x=x))
def test_highpass():
run(1024, lambda x: apply_filter(b=[0.9], a=[1.0, 0.1], x=x))
run(1024, lambda x: sigproc.lfilter(b=[0.9], a=[1.0, 0.1], x=x))
def test_small():