<div dir="ltr"><div><div><div><div><div>Hello everybody,<br><br></div>please consider the following code:<br><br>---<br>import numpy<br>from scipy.interpolate import interp1d                    <br>                    <br>t = numpy.array([0.000, 0.004, 0.008, 0.012, 0.016, 0.02])<br>sig = numpy.array([0, 1, 2, 3, 4, 5])<br>t_new = numpy.array([0.0, 0.001, 0.003,  0.004,  0.008, 0.012,  0.016,  0.0196, 0.02])<br>                <br>f = interp1d(t, sig, kind='zero')<br>s_resampled = f(t_new)<br>print s_resampled<br>---<br><br></div>The result I get on my machine is: <br>>C:\Anaconda2\pythonw -u "test_zero_order_hold.py"<br>[ 0.  0.  0.  1.  2.  3.  4.  4.  4.]<br>>Exit code: 0<br><br></div>Now why is the last value 4, and not 5? I'd expect it to be 5, as the last timestamps in t and t_new are identical. Is this a bug in interp1d or am I missing something important - if so, what?<br><br></div>Thanks a lot, in advance,<br><br></div>Nenad<br></div>