nx=1024
icount=0
for ix=0,1023 do begin
f=fff_last[ix,*]
ntfull=n_elements(f)
;nt=256
;nt=64
it2=ntfull-1
;it1=it2-nt+1
it1=0
nt=it2-it1+1
fom=fft(f[it1:it2])
dt=tt_last[it2]-tt_last[it2-1]
yr=[1e-16,1e-10]
;
dom=2.*!pi/(nt*dt)
om=dom*findgen(nt)
om_first=om[0:it2/2-1]
;
xr=[1,128*4]
iom2=128
iom2=32
omcut=10.
omdisper=sqrt(om[1:iom2]^2+omcut^2)
om_over_k=omdisper/k
it2_grah=n_elements(t)-1
plot_oo,k[1:*],grah1[1:*,it2_grah],xr=xr,yr=yr
;oplot,k[1:*],grah1[1:*,35]*om_over_k,col=122
;sp=2*!pi*abs(fom(1:iom2))^2*2.
sp=2*!pi*abs(fom(0:it2/2-1))^2*2.
oplot,om_first,sp
if icount eq 0 then ssp=sp/nx else ssp=ssp+sp/nx
;plot_io,om[1:*],abs(fom(1:*))^2
icount=icount+1
oplot,om_first,ssp*nt/icount,col=55
;oplot,om[1:iom2],ssp,col=55
print,nt/icount
wait,.002
endfor
;
grah1_last=grah1[*,it2_grah]
save,file='grah_specs.sav',grah1_last,k,om_first,ssp
END
