From 881798b30b9fa2c5c836ef3f2e038cd30f373267 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sat, 5 Jul 2014 12:29:13 +0300 Subject: [PATCH] fix sampling UT --- test_sampling.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test_sampling.py b/test_sampling.py index 0a67b11..5e85873 100644 --- a/test_sampling.py +++ b/test_sampling.py @@ -1,12 +1,18 @@ import sampling import numpy as np +import pylab def test_resample(): x = np.arange(300) - s = sampling.Sampler(x) + s = sampling.Sampler(x, ) y = np.array(list(s)) - k = s.interp.width - 1 - x = x[k:-k-1] - err = np.max(np.abs(x - y)) - assert err < 1e-10 + w = s.interp.width + x = x[w-1:-w] + err = x - y + assert np.max(np.abs(err)) < 1e-10 + +def test_coeffs(): + I = sampling.Interpolator(width=4, resolution=16) + err = I.filt[0] - [0,0,0,1,0,0,0,0] + assert np.max(np.abs(err)) < 1e-10