;$Id: wtab_line.pro,v 1.1 2021/11/18 03:01:00 brandenb Exp $
;
T_in100GeV=1.5d-3 & gstar_in100=.15
T_in100GeV=1. & gstar_in100=1.
astar=1.
Hstar=2.066d10*T_in100GeV^2*gstar_in100^.5
H0=3.241d-18
a0=1.254d15*T_in100GeV*gstar_in100^(1./3.)
fact=(Hstar/H0)^2*(astar/a0)^4
print,'fact=',fact
;
hbar=1.0545718e-27 ;(erg*s)
c=2.99792458d10 ;(cm/s)
kB=1.3806503d-16;(erg/K)
T=2.73
B2unit=(kB*T)^4/(hbar*c)^3
;
file='pe_line.txt'
fo="(a,4(' & ',a), '\\')"
fo="(a,7(' & ',a), '\\')"
;
close,1
openw,1,'runs.tex'
printf,1,'%force     nu    EEKMmax   EEGWm    hrms    tmax  kf  run'
; force     nu    EEKMmax   EEGWm    hrms    tmax  kf  run
;7.0e-03 5.0e-05 4.05e-01 3.00e-05 3.08e-05  2.07 600  M512sig1_k6_ramp1b_f007
;2.0e-03 2.0e-06 9.67e-02 5.62e-07 5.23e-06  2.38 600  M512sig1_k6_ramp1c_f002
;1.0e-03 2.0e-07 3.35e-02 3.53e-08 1.34e-06  2.09 600  M512sig1_k6_ramp1a_f001
;6.0e-04 2.0e-07 1.68e-02 5.31e-09 7.07e-07  1.98 600  M512sig1_k6_ramp1a
;
a=rtable(file,head=1,7)
f0=reform(a[0,*])
nu=reform(a[1,*])
EEM=reform(a[2,*])
EEGW=reform(a[3,*])
hrms=reform(a[4,*])
n=n_elements(f0)
;
Bugauss=sqrt(8.*!pi*EEM*B2unit)/1e-6
OmGW=EEGW*fact
hc=hrms/a0
;
name=''
for i=0,n-1 do begin
  printf,1,name+latex(f0[i],0), $
  latex(nu[i],0), $
  latex(EEM[i],2), $
  latex(EEGW[i],1), $
  latex(hrms[i],1), $
  latex_float(Bugauss[i],1), $
  latex(OmGW[i],2), $
  latex(hc[i],2), fo=fo
endfor
close,1
;
spawn,'cat runs.tex'
END
