I have two 1D-array, of the same length, containing a time series and value series, for example

```
t = linspace(0, 5, 5) # [0, 1.25, 2.5, 3.75, 5]
x = array(range(10, 25)) # [10, 11, 12, 13, 14]

```

I have to resample the x array using different sampling points in time, (with same start and end point, but could have any number of elements) for example

```
r = linspace(0, 5, 4) # [ 0, 1.667, 3.333, 5]
x2 = resample(t, x, r) # [10, 11, 12, 14]

```

That is, each time point of r is placed between two time points of t, and I'd like to find the index of the lower point of the two in t. From an array of indexes, is then possible to get the relative points of x.

I'd like a vector-based solution, without loops, possibly using scipy's operators.
Better if using scipy's functions.

EDIT: here's a code that do what I need, but a shorter, faster and vector-based solution would be better. I could not find one (till trying though).

```
def resample(t, r):
    i, j, k = 0, 1, 0
    s = []
    while j < len(t):
        if t[i] <= r[k] < t[j]:
            s.append(i)
            k += 1
        else:
            i += 1
            j += 1
    s.append(len(t) - 1)
    return array(s)

```