power,'_kin','_mag',k=k,spec1=spec1,spec2=spec2,i=n,tt=t,/noplot & print,n
power,'hel_kin','hel_mag',k=k,spec1=spec1h,spec2=spec2h,i=n,tt=t,/noplot & print,n
;
;  $Id: ppower_all.pro,v 1.10 2024/05/24 15:33:33 brandenb Exp $
;
;  This routine is used to view all power spectra
;  that were written during the run (controlled by dspec)
;  The plot range yr is set to a default value.
;  The time interval of plotting is "w" (default value)
;
;   5-oct-02/axel: written
;
spawn,'if (! -f param.pro) touch parameters.pro'
@parameters
xr=[1,max(k)]
default,yr,[1e-10,1e-2]
istride=100
istride=1
default,w,.2
default,t1,.0
default,iover,0
default,istride,1
ampl15=3e-10 & ampl4=1e-13
ampl15=3e-6 & ampl4=1e-8
;
for i=0,n-2,istride do begin
  if(t(i) ge t1) then begin
    if iover eq 0 or i eq 0 then begin
      plot_oo,k,spec1(*,i),xr=xr,yr=yr,tit='t='+str(t(i))
    endif else begin
      oplot,k,spec1(*,i)
    endelse
    oplot,k,spec2(*,i),col=122
    oplot,k,abs(spec1h(*,i))/(2.*k),li=2
    oplot,k,abs(spec2h(*,i))*k/2.,li=2,col=122
    ;kk=[4,20] & oplot,kk,.02/kk^1.66667
    kk=[1,20] & oplot,kk,ampl15*kk^1.5,col=188
    kk=[1,20] & oplot,kk,.01*ampl15*kk^1.5,col=188
    kk=[1,20] & oplot,kk,.001*ampl15*kk^4,col=188
    ;kk=[1,5] & oplot,kk,ampl4*kk^4,col=55
    print,i
    wait,w
  end
end
;
print,'E_K (white), E_M (red), E_T (yellow)'
;
; averages
;
mspec1=total(spec1,2)/i
mspec2=total(spec2,2)/i
mspec1h=total(spec1h,2)/i
mspec2h=total(spec2h,2)/i
;
save,file='mean_spec.sav',k,mspec1,mspec2,mspec1h,mspec2h
;
END
