add tests for low-pass and high-pass channels

This commit is contained in:
Roman Zeyde
2014-08-12 18:02:33 +03:00
parent 97fc5b52f4
commit 903d66bc35

View File

@@ -6,6 +6,7 @@ import numpy as np
from amodem import send from amodem import send
from amodem import recv from amodem import recv
from amodem import common from amodem import common
from amodem import sigproc
import logging import logging
logging.basicConfig(level=logging.DEBUG, logging.basicConfig(level=logging.DEBUG,
@@ -35,6 +36,19 @@ def run(size, chan):
assert rx_data == tx_data 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.8], a=[1.0, -0.2], x=x))
def test_highpass():
run(1024, lambda x: apply_filter(b=[0.8], a=[1.0, 0.2], x=x))
def test_small(): def test_small():
run(1024, lambda x: x) run(1024, lambda x: x)