function pow2d,inima ; ; Calculation of the 2-D power spectrum of an 2-D image ; Usage: Result = pow2d(image) siz=size(inima) if siz(0) ne 2 then goto,wrong if siz(1) ne siz(2) then goto,wrong n=siz(1) ima=inima ; apodization mea=mean(ima) ima=ima-mea perc=5. ; percentage of frame size to be damped np=nint(n*perc/100.) u=fltarr(n)+1. u(0)=0. for i=1,np do u(i)=(1.-cos(!pi*i/np))/2. u(n-np:n-1)=reverse(u(1:np)) ima=ima*(u#u) ; apodized frame (mean subtracted) ; Fourier transform fo=fft(ima,-1) rfo=float(fo) ifo=imaginary(fo) ; Power spectrum = Re(fo)^2 + Im(fo)^2 ps=rfo*rfo+ifo*ifo goto,fin wrong: print,'ERROR: The array must have two equal dimensions' ps=0 fin: return,ps end