comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: very fast spline interp function for heavy oversampling?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: very fast spline interp function for heavy oversampling? [message #20377] Wed, 21 June 2000 00:00
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
Thanks Craig and Martin!

I've implemented the spl_interp method and WOW, it is a factor of 36 faster
than the SPLINE function call (for my program anyway).

So why doesn't the canned IDL routine spline.pro, just call these functions?

re: the "don't have time to do this" in my original message. I will be
crunching
a lot of data tonight for a client, and one function call is a spline like
this.
I did not want to add in my own untested coded immediately prior to this
important crunching. This solution (spl_interp) is great, it helps a whole
lot! I may
even be able to get to sleep tonight!

Cheers,
bob





Craig Markwardt <craigmnet@cow.physics.wisc.edu> wrote in message
news:onem5r10ay.fsf@cow.physics.wisc.edu...
>
> "R.G. Stockwell" <stockwell@co-ra.comremove> writes:
> snip
>> Are there any user routines out there that can do this interpolation
>> efficiently?
>
> I second Martin's suggestion. I went from SPLINE to SPL_INTERP, and
> never looked back. SPL_INTERP is much faster, and appears to be less
> prone to artifacts.
>
> Craig
>
> --
> ------------------------------------------------------------ --------------
> Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
> Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
> ------------------------------------------------------------ --------------
Re: very fast spline interp function for heavy oversampling? [message #20379 is a reply to message #20377] Wed, 21 June 2000 00:00 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"R.G. Stockwell" <stockwell@co-ra.comremove> writes:

> Greetings,
>
> I have a situation where I take a time series, and need to interpolate the
> function to many more samples.
> i.e. original time index = [1,2,3,4....10]
> and I need samples at new time index =
> [1.000,1.001,1.002.......9.999,10.000].
>
> The canned IDL routine spline() works great, but is slow. Unfortunately, I
> don't have time to rewrite the interpolation to something more efficient.
>
> I don't want to use any linear scheme to interpolate, since I want a smooth
> function (i.e. smooth "derivatives") around the data points. I would guess
> that
> it would be easy to efficiently calculate this interp with spline, perhaps
> some vectorization could be put into the function. Or perhaps an
> "upsample" function would work, but modifications would be needed as the
> time series is not evenly sampled.
>
>
> Are there any user routines out there that can do this interpolation
> efficiently?

I second Martin's suggestion. I went from SPLINE to SPL_INTERP, and
never looked back. SPL_INTERP is much faster, and appears to be less
prone to artifacts.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: very fast spline interp function for heavy oversampling? [message #20382 is a reply to message #20377] Wed, 21 June 2000 00:00 Go to previous message
pit is currently offline  pit
Messages: 92
Registered: January 1996
Member
In article <7nS35.70$482.44454@den-news1.rmi.net>,
"R.G. Stockwell" <stockwell@co-ra.comremove> writes:
> Greetings,
>
> I have a situation where I take a time series, and need to interpolate the
> function to many more samples.
> i.e. original time index = [1,2,3,4....10]
> and I need samples at new time index =
> [1.000,1.001,1.002.......9.999,10.000].

You could try fourier interpolation by zero padding, i.e. calculating
the FFT and insert zeroes (remember the ordering inthe fft!) for the
high frequency terms, then transform it back.

Peter

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
Dr. Peter "Pit" Suetterlin http://www.astro.uu.nl/~suetter
Sterrenkundig Instituut Utrecht
Tel.: +31 (0)30 253 5225 P.Suetterlin@astro.uu.nl
____________________________________________________________ ______________
Re: very fast spline interp function for heavy oversampling? [message #20383 is a reply to message #20377] Wed, 21 June 2000 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
"R.G. Stockwell" wrote:
>
> Greetings,
>
> I have a situation where I take a time series, and need to interpolate the
> function to many more samples.
> i.e. original time index =
> and I need samples at new time index =
> .
>
> The canned IDL routine spline() works great, but is slow. Unfortunately, I
> don't have time to rewrite the interpolation to something more efficient.
>
> I don't want to use any linear scheme to interpolate, since I want a smooth
> function (i.e. smooth "derivatives") around the data points. I would guess
> that
> it would be easy to efficiently calculate this interp with spline, perhaps
> some vectorization could be put into the function. Or perhaps an
> "upsample" function would work, but modifications would be needed as the
> time series is not evenly sampled.
>
> Are there any user routines out there that can do this interpolation
> efficiently?
>
> Cheers,
> bob

Well, if you don't have time to solve the problem, then you must have
enough
time to wait for the results ;-) But, seriously, as far as I
understand, IDL
uses the Numeical Recipes SPLINE functions, and there are two related
functions which operate in two steps:
SPL_INIT and SPL_INTERP
Since SPL_INIT is executed only once with your coarse data set as input,
this might be
what you are looking for. See the online help for more info.

Martin

--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Draw widget updates and mouse movement
Next Topic: Re: multi conditional for loops

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:40:46 PDT 2025

Total time taken to generate the page: 0.00526 seconds