I have an array of numbers each corresponding to an event and the times when the events occurred. For example,
ev=[0, 14, 23, 53, 3]
time=[0, 0.4, 0.75, 0.9, 1.1]
Imagine ev vs. time to be a (right-continuous) step function which changes values at the values in the time array. Now by resampling, I mean defining a new array of time values and looking up the values of ev function at these times. I want to resample the variable ev under an evenly spaced time array. For example, if t1 is an evenly spaced array, ev1 is the corresponding event list I need.
t1=[0, 0.2, 0.4, 0.6, 0.8, 1, 1.2]
ev1=[0, 0, 14, 14, 23, 53, 3]
Is it possible to do such a resampling of an event array in Python? Is there a direct command? Thanks.
interp1dwithkind="zero"would work for you.