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

Home » Public Forums » archive » interpol
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
interpol [message #12402] Thu, 30 July 1998 00:00 Go to next message
Earl Thompson is currently offline  Earl Thompson
Messages: 1
Registered: July 1998
Junior Member
greetings...

I am calling interpol and getting results that do not make sense.
The call is of the form

x=interpol(xin,yin,y2in)

I run two cases -
1. In the first case, xin, yin, and y2in each have 30 elements.
2. In the second case xin, yin, and y2in are each only 20 elements
long. They contain a portion of the the first cases's data
( the last 20 points ).

The problem is that the values of x in the 20 element
case are different than in the 30 element case even
though the xin, yin, and y2in arrays are the same
for the 20 input elements common to both cases.

I could be doing something stupid and just not seeing
it or the routine has a bug.

Anybody got a few words of wisdom?
Re: INTERPOL [message #26941 is a reply to message #12402] Wed, 03 October 2001 19:09 Go to previous messageGo to next message
Roland Bammer, Ph.D. is currently offline  Roland Bammer, Ph.D.
Messages: 2
Registered: October 2001
Junior Member
Hi Craig and others,

"in_vec" is a vector of length "ydim" taken from a column of an image.
the content of this vector should be shifted "shift" and scaled "mag"
(squeezed or magnified) and resampled on a regular grid ("new_vec").
The first and last few elements of "in_vec" are usually mere noise.
Problems occur at the edges of the array when warp_x(0) > 0 or
warp_x(ydim-1) < ydim-1, ie. some elements have some unreasonable high
values. I would understand if this problem arises in the "extrapolation
zone" but these distortions extent into the area where gridpoints are
available (from in_vec and warp_y); and the slightly (a few %) elevated
signal intensity compared to the input is still an enigma.
Any guesses? It occurs for all interpolation schemes (/SPLINE, ...)
Mirroring the data around warp_x(0) and warp_x(ydim-1) helps but the
intensity shift is still there...

Roland.



Craig Markwardt wrote:

> Hi Roland,
>
> Can you fill us in a little on what this procedure should do, like
> with an example of what you did, what was the result, and what you
> were expecting?
>
> Craig
>
>
> "Roland Bammer, Ph.D." <roland@s-word.stanford.edu> writes:
>
>> Hi all,
>>
>> I have encountered some problems (some data fluctuations at the edges)
>> with the INTERPOL-Function:
>> when warp_x(0) > 0 or warp(ydim-1) < ydim-1 in the code below.
>> Moreover, it seems that the overall signal values are shifted towards
>> higher values. Restricting the values of regrid to CEIL(warp_x(0))<=
>> regrid <= FLOOR(warp(ydim-1)) (i.e. no extrapolation) did not help at all.
>>
>> Any suggestions?
>>
>> PRO regridding, in_vec, new_vec, ydim, mag, shift_y
>> x0 = ydim/2.0 - 0.5
>> regrid = FINDGEN(ydim)
>> x1 = x0 + (regrid-x0)*mag
>> warp_x = x1 + shift_y
>> new_vec = INTERPOL(in_vec,warp_x,regrid,/SPLINE)
>> END;
>>
>> Roland.
>>
>>
>
Re: INTERPOL [message #26944 is a reply to message #12402] Wed, 03 October 2001 18:10 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Hi Roland,

Can you fill us in a little on what this procedure should do, like
with an example of what you did, what was the result, and what you
were expecting?

Craig


"Roland Bammer, Ph.D." <roland@s-word.stanford.edu> writes:
> Hi all,
>
> I have encountered some problems (some data fluctuations at the edges)
> with the INTERPOL-Function:
> when warp_x(0) > 0 or warp(ydim-1) < ydim-1 in the code below.
> Moreover, it seems that the overall signal values are shifted towards
> higher values. Restricting the values of regrid to CEIL(warp_x(0))<=
> regrid <= FLOOR(warp(ydim-1)) (i.e. no extrapolation) did not help at all.
>
> Any suggestions?
>
> PRO regridding, in_vec, new_vec, ydim, mag, shift_y
> x0 = ydim/2.0 - 0.5
> regrid = FINDGEN(ydim)
> x1 = x0 + (regrid-x0)*mag
> warp_x = x1 + shift_y
> new_vec = INTERPOL(in_vec,warp_x,regrid,/SPLINE)
> END;
>
> Roland.
>

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: INTERPOL [message #27016 is a reply to message #26941] Mon, 08 October 2001 13:15 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Hi Roland--

Sorry for the delay, I got preoccupied.

I guess what I was hoping for is some simplified example of why you
think something is not working right. It doesn't actually have to be
the original data, in fact it is better if it is *not*. Best if you
can make a 20-element vector that shows the problem.

I can't see anything obviously wrong with your code. However I use
INTERPOL() regularly inside of PLOTIMAGE and it rarely misses a beat.
Have you tried SPL_INIT/SPL_INTERP? That has also always been a
winner for me.

Craig


"Roland Bammer, Ph.D." <roland@s-word.stanford.edu> writes:
> Hi Craig and others,
>
> "in_vec" is a vector of length "ydim" taken from a column of an image.
> the content of this vector should be shifted "shift" and scaled "mag"
> (squeezed or magnified) and resampled on a regular grid ("new_vec").
> The first and last few elements of "in_vec" are usually mere noise.
> Problems occur at the edges of the array when warp_x(0) > 0 or
> warp_x(ydim-1) < ydim-1, ie. some elements have some unreasonable high
> values. I would understand if this problem arises in the "extrapolation
> zone" but these distortions extent into the area where gridpoints are
> available (from in_vec and warp_y); and the slightly (a few %) elevated
> signal intensity compared to the input is still an enigma.
> Any guesses? It occurs for all interpolation schemes (/SPLINE, ...)
> Mirroring the data around warp_x(0) and warp_x(ydim-1) helps but the
> intensity shift is still there...
>
> Roland.
>
>
>
> Craig Markwardt wrote:
>
>> Hi Roland,
>>
>> Can you fill us in a little on what this procedure should do, like
>> with an example of what you did, what was the result, and what you
>> were expecting?
>>
>> Craig
>>
>>
>> "Roland Bammer, Ph.D." <roland@s-word.stanford.edu> writes:
>>
>>> Hi all,
>>>
>>> I have encountered some problems (some data fluctuations at the edges)
>>> with the INTERPOL-Function:
>>> when warp_x(0) > 0 or warp(ydim-1) < ydim-1 in the code below.
>>> Moreover, it seems that the overall signal values are shifted towards
>>> higher values. Restricting the values of regrid to CEIL(warp_x(0))<=
>>> regrid <= FLOOR(warp(ydim-1)) (i.e. no extrapolation) did not help at all.
>>>
>>> Any suggestions?
>>>
>>> PRO regridding, in_vec, new_vec, ydim, mag, shift_y
>>> x0 = ydim/2.0 - 0.5
>>> regrid = FINDGEN(ydim)
>>> x1 = x0 + (regrid-x0)*mag
>>> warp_x = x1 + shift_y
>>> new_vec = INTERPOL(in_vec,warp_x,regrid,/SPLINE)
>>> END;
>>>
>>> Roland.
>>>
>>>
>>
>

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: CASE statement
Next Topic: VARRAY for SGI IRIX64

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

Current Time: Wed Oct 08 14:22:00 PDT 2025

Total time taken to generate the page: 0.00619 seconds