fix sigproc.Filter

This commit is contained in:
Roman Zeyde
2014-08-12 17:56:02 +03:00
parent 8a156c7e54
commit 97fc5b52f4
2 changed files with 18 additions and 3 deletions

View File

@@ -23,3 +23,15 @@ def test_linreg():
a_, b_ = sigproc.linear_regression(x, y)
assert abs(a - a_) < 1e-10
assert abs(b - b_) < 1e-10
def test_filter():
f = sigproc.Filter(b=[1], a=[1])
x = range(10)
y = list(f(x))
assert [float(i) for i in x] == y
f = sigproc.Filter(b=[0.5], a=[1, -0.5])
x = [1] + [0] * 10
y = list(f(x))
assert y == [0.5 ** (i+1) for i in range(len(x))]