python - scipy.signal.resample: malfunction with even number of points? -
it seems scipy.signal.resample() makes errors when downsampling number of points. example, if upsample function multiple of original points , downsample again, should original function back.
from scipy import signal import numpy np def test_resample(n1,n2): # upsample n1 n2 points , x1=np.arange(n1) y1=np.sin(x1) y2,x2=signal.resample(y1,n2,x1) y3,x3=signal.resample(y2,n1,x2) print np.allclose(y1,y3) but fails when lower number of points even:
test_resample(10,20) false test_resample(11,22) true test_resample(11,33) true the problem occurs @ downsampling step. errors large, @ least several percent functions tested.
update of 4/8/17: seems coding error. reported details of bug here.
Comments
Post a Comment