function pow1d,inima ; ; Calculation of the 1-D power spectrum of an 1-D array ; Usage: Result = pow1d(array) siz=size(inima) if siz(0) ne 1 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 ; 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 be one-dimensional' ps=0 fin: return,ps end