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

Home » Public Forums » archive » IDL 5.5, 2D FFT indexing confusion.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
IDL 5.5, 2D FFT indexing confusion. [message #44831] Tue, 19 July 2005 04:23 Go to previous message
Pitufa is currently offline  Pitufa
Messages: 8
Registered: July 2005
Junior Member
Hi,

I have been trying to generate an real even function in fourier space
that I can INVERSE FFT in order to get a function which has no
imaginary part. I have no problems when the function is a vector, but I
get an imaginary part when it is a two dimensional array.

Below is the test program that shows my problem. Am I defining wrong
the variables 'centre' or 'nshift'?

I would be really grateful if someone could let me know what I am doing
wrong.

Thanks!

Pitufa.

pro test_index

npix = 100
centre = npix/2.d - 1.d
nshift = npix/2 + 1

;1d example:

f = abs(findgen(npix) - centre)
ifft = fft(shift(f,nshift),1,/double)

print,'1D: Imaginary maximum:', Max(Abs(Imaginary(ifft)))
print,'1D: Real maximum :', Max(Abs(Double(ifft)))

;2d example:

;angle of position vector w.r.t x axis:

phi = dblarr(NPIX,NPIX)
FOR X = 0, NPIX-1 DO FOR Y = 0, NPIX-1 DO $
PHI[X,Y] = ATAN(Y*1.D - centre,X*1.D - centre)

TEST = sin(2.d*phi)
IFFTTEST = FFT(SHIFT(TEST,nshift,nshift),1,/DOUBLE)

print,'2D: Imaginary maximum: ', $
MAX(ABS(imaginary(IFFTTEST))),mean(ABS(imaginary(IFFTTEST)))
print,'2D: Real maximum : ',MAX(ABS(double(IFFTTEST)))

end
[Message index]
 
Read Message
Read Message
Previous Topic: Strange behaviour of format
Next Topic: IDL and FORTRAN

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

Current Time: Sat Oct 11 13:12:41 PDT 2025

Total time taken to generate the page: 1.28643 seconds