mirror of
https://github.com/romanz/amodem.git
synced 2026-02-06 16:48:06 +08:00
add tests for low-pass and high-pass channels
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user