dustem_create_stext.pro 1.51 KB
FUNCTION dustem_create_stext ,st, key=key, val=val, scope, help=help

;+
; NAME:
;    dustem_create_stext
;
; PURPOSE:
;    Produces stokes extinction parameters (cross sections / optical depths)
;
; CATEGORY:
;    DUSTEM Wrapper, Plugin, Distributed
;
; CALLING SEQUENCE:
;    dustem_create_stext(st,key=key,val=val)
;
; INPUTS:
;    st (st = dustem_run(p_dim))
;
; OPTIONAL INPUT PARAMETERS:
;    key  = input parameter number
;    val  = input parameter value
;
; OUTPUTS:
;    out = array containing the extinction stokes parameters
;
; OPTIONAL OUTPUT PARAMETERS:
;    None
;
; ACCEPTED KEY-WORDS:
;    help                  = if set, print this help
;
; COMMON BLOCKS:
;    None
;
; SIDE EFFECTS:
;    None
;
; RESTRICTIONS:
;    The DustEM fortran code must be installed
;    The DustEMWrap IDL code must be installed
;
; PROCEDURE:
;    This is a dustem plugin
; EXAMPLES
;    
; MODIFICATION HISTORY:
;    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_create_stext'
  goto,the_end
ENDIF


psi_ref_ext=0 
  

out=['']

IF keyword_set(key) THEN BEGIN 
  a=where(key EQ 1,count1)


  IF count1 NE 0 then begin
  psi_ref_ext=(val(a))(0)
  ;test to not devide by zero
  frac=st.polext.ext_tot/st.ext.ext_tot
  tes=where(finite(frac) eq 0)
  frac(tes)=0.
 
  polar_ippsi2iqu,((st.polext).ext_tot),Q_ext,U_ext,frac,psi_ref_ext
  
  out=[out,Q_ext,U_ext]
  endif    
ENDIF

scope=((*!dustem_scope).stext)

return, out[1:*]

the_end:
END