dustem_plot_extinction.pro 2.87 KB
PRO dustem_plot_extinction,st,st_model,_Extra=extra,help=help

;+
; NAME:
;     dustem_plot_extinction
; PURPOSE:
;    Plots a Dustem extinction
; CATEGORY:
;    Dustem
; CALLING SEQUENCE:
;    dustem_plot_extinction,st,st_model[,/help][,_extra=]
; INPUTS:
;    st        = Dustem model output structure
;    st_model  = Dustem model parameters structure
; OPTIONAL INPUT PARAMETERS:
;    _extra    = extra parameters for the plot routine
; OUTPUTS:
;    None
; OPTIONAL OUTPUT PARAMETERS:
;    None
; ACCEPTED KEY-WORDS:
;    help      = If set, print this help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    model is plotted
; RESTRICTIONS:
;    The dustem idl wrapper must be installed
; PROCEDURE:
;    None
; EXAMPLES
;    dustem_init,/wrap
;    dir_in=getenv('DUSTEM_SOFT_DIR')+'/src/dustem3.8_web/'
;    st_model=dustem_read_all(dir_in)
;    dir=getenv('DUSTEM_RES')
;    st=dustem_read_all_res(dir_in)
;    loadct,13
;    dustem_plot_extinction,st,st_model,yr=[1.e-6,1.e0],/ysty,xr=[1.,400],/xsty
; MODIFICATION HISTORY:
;    Written by J.-Ph. Bernard
;    see evolution details on the dustem cvs maintained at CESR
;    Contact J.-Ph. Bernard (Jean-Philippe.Bernard@cesr.fr) in case of problems.
;-

IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_plot_extinction'
  goto,the_end
ENDIF

;stop
;Ngrains=n_tags(st.dustem)-2
Ngrains=st_model.Ngrains

colors=dustem_grains_colors(Ngrains)
;colmax=210 & colmin=30
;colors=findgen(Ngrains)/(1.*Ngrains-1)*(colmax-colmin)+colmin

xtit=textoidl('\lambda (\mum)')
;ytit=textoidl('extinction (cm^2/g)') & fact=1.
ytit=textoidl('\sigma_{ext} (1e-21 cm^2/H)')
mH=1.66e-24
fact=mH*1.e21
tit='Dustem extinction'

;stop

i=0L
;plot_oo,st.ext.wav,st.ext.abs_grain(i)*fact,/nodata,_Extra=extra,xtit=xtit,ytit=ytit,tit=tit
ffact=fact*st_model.grains[i].MDUST_O_MH
;plot_oo,st.ext.wav,(st.ext.abs_grain(i)+st.ext.sca_grain(i))*ffact,/nodata,_Extra=extra,xtit=xtit,ytit=ytit,tit=tit
cgplot,st.ext.wav,(st.ext.abs_grain[i]+st.ext.sca_grain(i))*ffact,/nodata,_Extra=extra,xtit=xtit,ytit=ytit,tit=tit,/xlog,/ylog
abs_tot=st.ext.abs_grain(i)*0.
sca_tot=st.ext.sca_grain(i)*0.
FOR i=0L,Ngrains-1 DO BEGIN
  ffact=fact*st_model.grains(i).MDUST_O_MH
  ;oplot,st.ext.wav,(st.ext.abs_grain(i)+st.ext.sca_grain(i))*ffact,color=colors(i),psym=psym
  cgoplot,st.ext.wav,(st.ext.abs_grain[i]+st.ext.sca_grain[i])*ffact,color=colors(i),psym=psym
;  oplot,st.ext.wav,st.ext.abs_grain(i)*fact,color=colors(i-1),psym=psym
;  oplot,st.ext.wav,st.ext.sca_grain(i)*fact,color=colors(i-1),psym=psym,linestyle=2
  abs_tot=abs_tot+st.ext.abs_grain[i]*ffact
  sca_tot=sca_tot+st.ext.sca_grain[i]*ffact
ENDFOR
;oplot,st.ext.wav,(abs_tot+sca_tot),color=255,psym=psym
cgoplot,st.ext.wav,(abs_tot+sca_tot),color=255,psym=psym
;oplot,st.dustem.wav,(abs_tot+sca_tot),color=255,psym=psym
;oplot,st.dustem.wav,abs_tot*fact,color=255,psym=psym
;oplot,st.dustem.wav,sca_tot*fact,color=255,psym=psym,linestyle=2

the_end:

END