[SciPy-User] fast spline interpolation of multiple equal length waveforms

Hjalmar Turesson hturesson@gmail....
Sat Oct 1 05:53:22 CDT 2011

Hi Jonathan,

I finally got time to test the polynomial interpolation. Unfortunately, my
x_interpret had point slightly outside the interval of the original x.
polyterp didn't like extrapolation and became quite slow.
On the other hand, splmake and spleval works fine and are very quick.
Thus, my problem is solved.


On Fri, Sep 23, 2011 at 10:21 AM, Hjalmar Turesson <hturesson@gmail.com>wrote:

> Thanks for the reply.
> Both x and y values are different, but they have the same length.
> I'll try your simple piecewise polynomial interpolation over the weekend,
> and report back when I know how well it works.
> Thanks,
> Hjalmar
> On Fri, Sep 23, 2011 at 9:54 AM, Jonathan Stickel <jjstickel@vcn.com>wrote:
>> On 9/22/11 20:36 , scipy-user-request@scipy.org wrote:
>>> Date: Thu, 22 Sep 2011 21:59:59 -0400
>>> From: Hjalmar Turesson<hturesson@gmail.com>
>>> Subject: [SciPy-User] fast spline interpolation of multiple equal
>>>        length  waveforms
>>> To:scipy-user@scipy.org
>>> Message-ID:
>>>        <CAA7EFhTV8Zm9NPwyppatAy4W9G1P**DF3gUmgE79sROC8LjOzW8g@mail.**
>>> gmail.com<CAA7EFhTV8Zm9NPwyppatAy4W9G1PDF3gUmgE79sROC8LjOzW8g@mail.gmail.com>
>>> >
>>> Content-Type: text/plain; charset="iso-8859-1"
>>> Hi,
>>> I got a data set with hundreds of thousands for 40 point long waveforms.
>>> I
>>> want to use cubic splines to interpolate these at intermediate time
>>> points.
>>> However, the points are different all waveforms, only the number of
>>> points
>>> is the same. In other words, I want to interpolate a large number of
>>> equally
>>> short waveforms, each to its own grid of x-values/time points, and I want
>>> to
>>> do this as FAST as possible.
>>> Are there any functions that can take a whole array for waveforms and a
>>> size
>>> matched array of new x-values, and interpolate each waveform at a matched
>>> row (or column) of x-values?
>>> What I've found, this far, appear to require a loop to one by one go
>>> through
>>> the waveforms and corresponding grid of x-values. I fear that a long loop
>>> will be significantly slower than a direct evaluation of the entire
>>> array.
>>> Thanks,
>>> Hjalmar
>> For each data set (x,y), are the x-values the same and the y-values
>> different?  If so, you may find this code useful:
>> http://scipy-central.org/item/**21/1/simple-piecewise-**
>> polynomial-interpolation<http://scipy-central.org/item/21/1/simple-piecewise-polynomial-interpolation>
>> It is not splines, but nonetheless provides good quality interpolation and
>> is very fast.  For given x and x_interp, it can create an interpolation
>> matrix P.  Then y_interp = P*y.  If you have all your y-data in Y, then
>> Y_interp = P*Y.
>> HTH,
>> Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20111001/1d0f89f2/attachment.html 

More information about the SciPy-User mailing list