150 lines
3.1 KiB
Prolog
150 lines
3.1 KiB
Prolog
pro pmodels,files,ipar,mode,ipl,hc, $
|
|
colbeg=colbeg,colstep=colstep,nohead=nohead,_extra=e
|
|
;
|
|
; plots the output from Tlusty or Tlusdisk - unit 7 (*.card file)
|
|
; files - filename(s)
|
|
; ipar - model quantity to be plotted (0=temperature; 1=electron density;
|
|
; 2=density; 3= first population; 2+i = i-th population);
|
|
; Note: in case of disks; ipar=3 plots z(m)
|
|
; mode = 0 - absolute value(s) (logarithms for number densities);
|
|
; = 1 - differences; the first file is the reference one);
|
|
; ipl = 0 - plot
|
|
; = 1 - overplot
|
|
; hc = 0 - plot appears on screen
|
|
; > 0 - the run generates an idl.ps file to be printed on a postscript
|
|
; printer
|
|
|
|
common modpar,t,dt,dm,dml,dm0,temp0,tmi,tit,x
|
|
;
|
|
if n_params(0) le 4 then hc=0
|
|
if n_params(0) le 3 then ipl=0
|
|
if n_params(0) le 2 then mode=0
|
|
if n_params(0) le 1 then ipar=0
|
|
;
|
|
if n_elements(colbeg) eq 0 then colbeg=40
|
|
if n_elements(colstep) eq 0 then colstep=15
|
|
s=size(files)
|
|
nmod=s(1)
|
|
f=strarr(nmod)
|
|
|
|
!ignore=0
|
|
;
|
|
if hc gt 0 then begin
|
|
set_plot,'ps'
|
|
device,/landscape
|
|
endif
|
|
;
|
|
; set up the plot title (list of files)
|
|
;
|
|
tit=''
|
|
for ip=0,nmod-1 do begin
|
|
if strpos(files(ip),'.') gt -1 then f(ip)=files(ip) else f(ip)=files(ip)+'.7'
|
|
tit=tit+files(ip)
|
|
if ip lt nmod-1 then tit=tit+','
|
|
endfor
|
|
|
|
;
|
|
; set up title for y-axis
|
|
;
|
|
yt=''
|
|
if mode eq 0 then begin
|
|
if ipar eq 0 then yt='temperature'
|
|
if ipar eq 1 then yt='log n(e)'
|
|
if ipar eq 2 then yt='log density'
|
|
endif
|
|
if mode eq 1 then begin
|
|
if ipar eq 0 then yt='Delta T'
|
|
if ipar eq 1 then yt='Delta log n(e)'
|
|
if ipar eq 2 then yt='Delta log density'
|
|
endif
|
|
|
|
; read first model
|
|
;
|
|
get_lun,l1
|
|
openr,l1,f(0)
|
|
readf,l1,nd,np
|
|
dm=fltarr(nd)
|
|
x=fltarr(np,nd)
|
|
readf,l1,dm
|
|
readf,l1,x
|
|
dml=alog10(dm)
|
|
if ipar eq 0 then t=x(0,*) else t=alog10(x(ipar,*))
|
|
if mode eq 1 then begin
|
|
dm0=dml
|
|
temp0=t
|
|
dt0=t-temp0
|
|
endif
|
|
free_lun,l1
|
|
|
|
; plot first model
|
|
;
|
|
if mode eq 0 then begin
|
|
if ipl eq 0 then plot,dml,t,xtit='log mass',ytit=yt,_extra=e else oplot,dml,t
|
|
endif
|
|
;
|
|
; read and plot next models
|
|
;
|
|
if nmod ge 1 then begin
|
|
|
|
for ip=1,nmod-1 do begin
|
|
get_lun,l1
|
|
openr,l1,f(ip)
|
|
readf,l1,nd,np
|
|
dm=fltarr(nd)
|
|
x=fltarr(np,nd)
|
|
readf,l1,dm
|
|
readf,l1,x
|
|
dml=alog10(dm)
|
|
if ipar eq 0 then t=x(0,*) else t=alog10(x(ipar,*))
|
|
if mode eq 1 then begin
|
|
dml=alog10(dm)
|
|
tmi=interpol(t,dml,dm0)
|
|
dt=tmi-temp0
|
|
if ip eq 1 then if ipl eq 0 then $
|
|
plot,dm0,dt,psym=3,xtit='log mass',ytit=yt,_extra=e $
|
|
else oplot,dm0,dt
|
|
endif
|
|
free_lun,l1
|
|
|
|
if hc eq 0 then begin
|
|
co=ip*20+100
|
|
co=colbeg+colstep*ip
|
|
li=0
|
|
endif else begin
|
|
co=0
|
|
li=ip
|
|
endelse
|
|
;
|
|
if mode eq 0 then oplot,dml,t,color=co,line=li else $
|
|
oplot,dm0,dt,color=co,line=li
|
|
|
|
endfor
|
|
endif
|
|
|
|
if mode eq 1 then oplot,dm0,dt0
|
|
|
|
;
|
|
if n_elements(nohead) eq 0 then begin
|
|
if ipl eq 0 then begin
|
|
spawn,'date >tmp'
|
|
openr,2,'tmp'
|
|
a=''
|
|
readf,2,a
|
|
if hc eq 0 then xyouts,0.8,0.98,a,/normal else $
|
|
xyouts,0.8,0.98,a,/normal,size=0.5
|
|
close,2
|
|
spawn,'rm -f tmp'
|
|
xyouts,0.5,0.98,tit,alignment=0.5,size=2,/normal
|
|
endif
|
|
endif
|
|
;
|
|
if hc gt 0 then begin
|
|
device,/close
|
|
spawn,'mac_ps idl.ps'
|
|
set_plot,'x'
|
|
endif
|
|
;
|
|
return
|
|
end
|
|
|