;$Id: pspecm_scl5.pro,v 1.4 2020/08/06 17:06:00 roper Exp $
if !d.name eq 'PS' then begin
  ;device,xsize=18,ysize=8,yoffset=3
  device,xsize=18,ysize=16,yoffset=3
  !p.charthick=3 & !p.thick=3 & !x.thick=3 & !y.thick=3
end
;
;  mv idl.ps ~/tex/roper/GW/fig/pspecm_scl2.ps
;  mv idl.ps ~/tex/prop/computing/pdc/18/fig/pspecm_scl3n.ps
;
siz=1.3
@parameters
!p.charsize=1.7
;!p.charsize=1.8
!x.margin=[7.6,0.5]
!y.margin=[3.2,0.2]
!p.multi=[0,1,2]
pc_read_param,obj=param
kf=param.kpeak_aa
fac_h=1.263e-18
fac2=2.
;
cwd,run
half='!s!u 1!n!r!s-!r!d 2!n'
file='specm.sav'
restore,file
;
;  determine normalization
;
k1=k & k1[0]=1. & k1=1./k1 & k1[0]=0.
EEM=total(spec1m)
kM=EEM/total(k1*spec1m)
kGW=sqrt(total(k^2*grav1m)/total(grav1m))
if cstress_prefactor eq '1' then begin
  print,'AXEL0'
endif else begin
  print,'AXEL1'
endelse
;
default,kin,0
default,hdone,1
default,fac16pi,1.
default,maglabel,'mag'
default,green_lines,0
default,plot_polarization,1
default,yr_pspecm_scl2,[2d-5,2d1]
default,yr_pspechm_scl3,[2d-25,2d-18]
;ytickf='logticks_exp'
yr=yr_pspecm_scl3
;
;  1st panel
;
!p.title='!6';+run
!x.title='!6'
!y.title='!6!8h!6!s!d0!n!r!u2!n!7X!6!dGW!n(!8f!6), !6!8h!6!s!d0!n!r!u2!n!7X!6!d'+maglabel+'!n(!8f!6)'
;
Hstar=2.066d10
a0=1.2545d15
freq=Hstar/(2.*!pi*a0)
H0=3.24d-18
;
rhocrit_fac=3./(8.*!pi)
fac=(Hstar/H0)^2/rhocrit_fac*(1./a0)^4
facGW=1./(16.*!pi)
xr=[1e-4,8e-2]
circ_sym,0.7,1
mixed=0.
grav_tot=grav1m+grah1m/tm^2+mixed
OmegaGW=facGW*fac*k*grav_tot
plot_oo,freq*k,OmegaGW,xr=xr,yr=yr,ytickf=ytickf
;if plot_polarization then begin
;oplot,freq*k,fac16pi*facGW*fac*k*grav2m,col=122,ps=8
;oplot,freq*k,-fac16pi*facGW*fac*k*grav2m,col=55,ps=8
;endif
;
;circ_sym,0.3,0
;oplot,freq*k,fac*k*spec1m
;if plot_polarization then begin
;oplot,freq*k,.5*fac*k^2*spec2m,col=122,ps=8
;oplot,freq*k,-.5*fac*k^2*spec2m,col=55,ps=8
;endif
;
xyouts,6e-4,1.4e-10,'!6GW',siz=siz
xyouts,2e-3,1.5e-7,'!6'+maglabel+'',siz=siz
;
xyouts,3e-7,2e-8,label
;
;@postproc
;
;xx=[3e-7,3e-3] & oplot,xx,1e-10/(xx/.001)
;xx=[3.2e-3,8e-2] & oplot,xx,3e-10*(xx/.01)^2
;xx=[3e-7,3e-3] & oplot,xx,1e-12/(xx/.001)
;xx=[3.2e-3,8e-2] & oplot,xx,3e-12*(xx/.01)^2
;
if green_lines then begin
loadct,6
xx=6*[1.6e-3,0.7e-2] & oplot,xx,6*4.0e-7/(xx/.001)^0.667,col=122
xx=6*[2.0e-3,1.0e-2] & oplot,xx,2.0e-7/(xx/.001)^2.667,col=122
xyouts,.05,1e-7,'!9A!8f!6!u-2/3!n',col=122,siz=siz
xyouts,.04,5e-13,'!9A!8f!6!u-8/3!n',col=122,siz=siz
;
xx=[5e-4,1.4e-3] & oplot,xx,2e-7*(xx/.001)^5.,col=122
;xx=[5e-4,1.4e-3] & oplot,xx,1e-9*(xx/.001)^3.,col=122
xx=[5e-4,2.4e-3] & oplot,xx,1e-9*(xx/.001)^2.2,col=122
xyouts,4e-4,5e-8,'!9A!8f!6!u5!n',col=122,siz=siz
xyouts,2.7e-4,4e-11,'!9A!8f!6!u2.2!n',col=122,siz=siz
loadct,5
endif
;
;  Caprini+16, Cornish, Maggiore00 points
;
dir='~/tex/roper/PencilGW/data/'
file=dir+'Cornish.rtf'
c1=rtable(file,2,head=1)
oplot,10^c1[0,*],((10^c1[1,*]/fac_h)*10^c1[0,*])^2,li=2
;
file=dir+'Cornish20Yrs.dat'
c2=rtable(file,2,head=1)
oplot,10^c2[0,*],((10^c2[1,*]/fac_h)*10^c2[0,*])^2,li=3
;
file=dir+'Maggiore.rtf'
m1=rtable(file,2,head=1)
;
file=dir+'Caprini-C1.rtf'
a1=rtable(file,2,head=1)
oplot,10^a1[0,*],10^a1[1,*]
;
file=dir+'Caprini-C3.rtf'
a3=rtable(file,2,head=1)
oplot,10^a3[0,*],10^a3[1,*]
;
;  2nd panel
;
!y.title='!8h!6!dc!n(!8f!6)'
!x.title='!8f!6 [Hz]'
default,kin,0
default,hdone,1
;ytickf='logticks_exp'
yr=yr_pspechm_scl3
;
fach=1.263e-18/(freq*k)
circ_sym,0.7,1
plot_oo,freq*k,fach*sqrt(OmegaGW),xr=xr,yr=yr,ytickf=ytickf
;if plot_polarization then begin
;oplot,freq*k,fach*sqrt(facGW*fac*k*grav2m),col=122,ps=8
;oplot,freq*k,-fach*sqrt(facGW*fac*k*grav2m),col=55,ps=8
;endif
;
;  apply factor sqrt(2.) because hrms^2 = hij^2 = sqrt(2.*(hT^2+hX^2))
;
empirical=1.
empirical2=1.
oplot,empirical2*freq*k,empirical*8e-16*sqrt(k*grah1m),co=188,li=2,thick=5
;
xyouts,3e-7,2e-8,label
;
;@postproc
;
;xx=[3e-7,3e-3] & oplot,xx,(fac_h/xx)*sqrt(1e-10/(xx/.001))
;xx=[3.2e-3,8e-2] & oplot,xx,(fac_h/xx)*sqrt(3e-10*(xx/.01)^2)
;xx=[3e-7,3e-3] & oplot,xx,(fac_h/xx)*sqrt(1e-12/(xx/.001))
;xx=[3.2e-3,8e-2] & oplot,xx,(fac_h/xx)*sqrt(3e-12*(xx/.01)^2)
;
;  continous limits
;
oplot,10^c1[0,*],10^c1[1,*],li=2
oplot,10^c2[0,*],10^c2[1,*],li=3
;oplot,10^m1[0,*],10^m1[1,*],li=1
oplot,10^a1[0,*],fac_h*sqrt(10^a1[1,*])/10^a1[0,*]
oplot,10^a3[0,*],fac_h*sqrt(10^a3[1,*])/10^a3[0,*]
;
if green_lines then begin
loadct,6
xx=6*[2.0e-3,1.8e-2] & oplot,xx,5.0e-19/(xx/.001)^(7./3.),col=122
xyouts,.02,2e-23,'!9A!8f!6!u-7/3!n',col=122,siz=siz
;
xx=[5e-4,2.4e-3] & oplot,xx,7e-21*(xx/.001)^(.1),col=122
xyouts,2.7e-4,1e-21,'!9A!8f!6!u0.1!n',col=122,siz=siz
loadct,5
endif
;
fo="(a,3f6.1)"
print,'kM,kGW=',kM,kGW,fo=fo
print,'$mv idl.ps ~/tex/roper/GW/fig/pspecm_scl3_'+run+'.ps
;
END
