pro timpow1a,mov,out ;Version 1a with re-scaling intensities to local time-averages ;and removing linear temporal trends. ; ; A program to compute the time-changes power spectra at each ; spatial position of the movie and to output the mean power ; in 5 frequency channels. ; INPUT: movie MOV (3-D array) with spatial scale of about 0.5"/pix. ; OUTPUT: 3-D array OUT, where x- and y- dimensions are equal to those ; of MOV, and the z- dimension equal to the number of channels. ; Definition of channels ([begin,end] in pixels) ch=[[2,12],[15,38]] ;... P 1,2 ; ch=[[1,9],[11,30]] ;... P 4,5,6 ; ; bands 30-6, 5-2 minutes ;--------------------------------------------- si=size(mov) if si(0) ne 3 then begin print,'This is not a 3-D array. STOPPED.' out=0 goto,fin endif sch=size(ch) nch=sch(2) out=fltarr(si(1),si(2),nch) ts=findgen(si(3)) ; apodization window u n=si(3) perc=5. ; percentage of array 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)) ; loop over positions x,y for y=0,si(2)-1 do begin for x=0,si(1)-1 do begin tt=reform(mov(x,y,*)) ; time-column tt=tt/mean(tt) ; re-scaling nic=poly_fit(ts,tt,1,ttf) ; linear fit ttf tt=tt-ttf ; trend removal and mean=0 tt=tt*u ; apodization fo=fft(tt,-1) rfo=float(fo) ifo=imaginary(fo) psp=rfo*rfo+ifo*ifo ; power sp. ; mean power in channels for c=0,nch-1 do out(x,y,c)=mean(psp(ch(0,c):ch(1,c))) endfor print,si(2)-1-y endfor fin: end