@parameters
default,t1,1e4
;
;  run first:
;  .r ppower_all2
;
;  This routine is used to determine the decay exponent for IA.
;
!p.multi=[0,1,2]
ltt=alog10(ts.t[1:*])
lIA=alog10(ts.arms[1:*]^2)
plot,ltt,lIA
good=where(ts.t ge t1)
lttgood=ltt(good)
lIAgood=lIA(good)
p=linfit(lttgood,lIAgood)
oplot,lttgood,lttgood*p[1]+p[0],col=122
;
Lu=xiMag*sqrt(2.*Emag)/eta
plot_oo,t,xiMag*sqrt(2.*Emag)/eta
good=where(t ge t1)
Lum=mean(Lu(good))
tgood=t(good)
oplot,t(good),tgood*0+Lum,col=122
;
cwd,run
fo='(e7.1,e11.2,2x,a)'
openw,1,'.decay'
printf,1,Lum,-p[1],run,fo=fo
close,1
spawn,'cat .decay'
spawn,'cat .decay >>../idl/anastrophy.txt'
!p.multi=0
END
