From 903d66bc35f5d7293ea565aaf80f0ae204c20a70 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Tue, 12 Aug 2014 18:02:33 +0300 Subject: [PATCH] add tests for low-pass and high-pass channels --- tests/test_full.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_full.py b/tests/test_full.py index bad58db..1cc2893 100644 --- a/tests/test_full.py +++ b/tests/test_full.py @@ -6,6 +6,7 @@ import numpy as np from amodem import send from amodem import recv from amodem import common +from amodem import sigproc import logging logging.basicConfig(level=logging.DEBUG, @@ -35,6 +36,19 @@ 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.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(): run(1024, lambda x: x)