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

Home » Public Forums » archive » Re: Fractional SHIFT
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Fractional SHIFT [message #28352 is a reply to message #28348] Mon, 03 December 2001 13:10 Go to previous message
Ralf Flicker is currently offline  Ralf Flicker
Messages: 19
Registered: October 2001
Junior Member
trouble wrote:
>
> Hi,
>
> Does anyone have a method for doing non-integer shifts ? Interpolate
> doesn't wrap in the way SHIFT does and my hack (based on MOD) is a bit
> dodgy.
>
> To shift orig by 1.5 pixels:
>
> orig = FINDGEN(10)
>
> index = FINDGEN(10)
> delta = 1.5
> index2 = (index+delta) MOD 10
>
> new = INTERPOLATE(orig,index2,/GRID)
>
> PRINT,new
>
> 1.50000 2.50000 3.50000 4.50000 5.50000
> 6.50000
> 7.50000 8.50000 9.00000 0.500000
>
> The 2nd last element of new is wrong (should be 9.5).
>
> Does anyone know a robust way ?

If you had periodic arrays you could FFT, multiply by a complex
exponential, and FFT back. In your example above, I guess you
could make orig periodic by mirroring it across the origin. No
idea if this will work for you, but I sometimes use the FFT +
complex exponential rather than interpolating for shifting
arrays non-integer steps.

cheers
ralf

--
Ralf Flicker UIN : 65334076
Gemini Observatory http://www.gemini.edu/
670 N. A'Ohoku Pl. Tel : (808) 974-2569
Hilo 96720, HI, USA Fax : (808) 935-9235
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: DICOM writer
Next Topic: Windows XP

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

Current Time: Sun Oct 12 12:10:41 PDT 2025

Total time taken to generate the page: 2.00073 seconds