dustem_plot_extinction.pro 2.36 KB
PRO dustem_plot_extinction,st,st_model,_extra=_extra,help=help

;+
; NAME:
;     dustem_plot_extinction
;
; PURPOSE:
;    Plots a DustEM extinction curve
;
; CATEGORY:
;    DustEM, Plotting, Low-Level
;
; 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 DustEMWrap idl code must be installed
;
; PROCEDURE:
;    None
;
; EXAMPLES
;    dustem_init,/wrap
;    dir_in=getenv('DUSTEM_SOFT_DIR')
;    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
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
;-


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

Ngrains=st_model.Ngrains

colors=dustem_grains_colors(Ngrains,/cgplot)

mH=1.66e-24              ;g 
fact=mH*1.e21

;stop

;st.ext is supposed to be in cm^2/g (of dust)

i=0L
ffact=fact*st_model.grains[i].MDUST_O_MH
yr=[0,2.5]
xr=[1,10]
;cgplot,1./st.ext.wav,st.ext.EXT_TOT,color='red',xtit=xtit,ytit=ytit,tit=tit,yr=yr,/ysty,xr=xr,/xsty
cgplot,1./st.ext.wav,st.ext.EXT_TOT,color='red',_extra=_extra
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
  ffact=1.            ;because it looks as if the values are already in 1e-21 cm^2/H
  abs=st.ext.abs_grain[i]*ffact
  sca=st.ext.sca_grain[i]*ffact
  ext=abs+sca
  cgoplot,1./(st.ext.wav),abs,color=colors[i],psym=psym,linestyle=1
  cgoplot,1./(st.ext.wav),sca,color=colors[i],psym=psym,linestyle=2
  cgoplot,1./(st.ext.wav),ext,color=colors[i],psym=psym,linestyle=0
  abs_tot=abs_tot+st.ext.abs_grain[i]*ffact
  sca_tot=sca_tot+st.ext.sca_grain[i]*ffact
ENDFOR
total_extinction=abs_tot+sca_tot

cgoplot,1./(st.ext.wav),total_extinction,color='black',psym=psym

the_end:
;stop

END