dustem_read_all_res.pro 3.14 KB
FUNCTION dustem_read_all_res,dir_out,silent=silent,help=help

;+
; NAME:
;    dustem_read_all_res
; PURPOSE:
;    Reads all Dustem outputs
; CATEGORY:
;    Dustem
; CALLING SEQUENCE:
;    st=dustem_read_all_res(dir_out[,/silent][,/help])
; INPUTS:
;    dir_out: Dustem output directory
; OPTIONAL INPUT PARAMETERS:
;    None
; OUTPUTS:
;    st: Dustem output structure
;      structure:
;      DUSTEM          STRUCT    -> <Anonymous> Array[800]
;        WAV             FLOAT         0.0400000
;        EM_GRAIN_1      FLOAT           0.00000
;        EM_GRAIN_2      FLOAT           0.00000
;        EM_GRAIN_3      FLOAT           0.00000
;        EM_GRAIN_4      FLOAT           0.00000
;        EM_GRAIN_5      FLOAT           0.00000
;        EM_TOT          FLOAT           0.00000
;      EXT             STRUCT    -> <Anonymous> Array[799]
;        WAV             FLOAT         0.0406570
;        ABS_GRAIN       FLOAT     Array[5]
;        SCA_GRAIN       FLOAT     Array[5]
; OPTIONAL OUTPUT PARAMETERS:
;    None
; ACCEPTED KEY-WORDS:
;    help      = If set, print this help
;    silent    = If set, function is silent
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    None
; RESTRICTIONS:
;    The dustem idl wrapper must be installed
; PROCEDURE:
;    None
; EXAMPLES
;    dustem_init,/wrap
;    dir=getenv('DUSTEM_RES')
;    st=dustem_read_all_res(dir)
;    help,st,/str
; 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_read_all_res'
  st=0.
  goto,the_end
ENDIF

;CASE getenv('DUSTEM_WHICH') OF
CASE !dustem_which OF
  'VERSTRAETE':BEGIN
    file=dir_out+'les_RES/'+'SED.RES'
    st_sed=dustem_read_dustem_lv(file,silent=silent)
    file=dir_out+'les_RES/'+'EXT_M.RES'
    st_ext=dustem_read_ext_lv(file,silent=silent)
    st={sed:st_sed,ext:st_ext}
  END
  'RELEASE': BEGIN
    file=dir_out+'out/'+'SED.RES'
    st_sed=dustem_read_dustem_lv(file,silent=silent)
    file=dir_out+'out/'+'EXT.RES'
    st_ext=dustem_read_ext_lv(file,silent=silent)
;VGb : add polarization
    
    IF !run_pol THEN BEGIN
      file=dir_out+'out/'+'SED_POL.RES'
      st_polsed=dustem_read_dustem_lv(file,silent=silent)
      file=dir_out+'out/'+'EXT_POL.RES'
      st_polext=dustem_read_ext_lv(file,silent=silent)
    	IF !run_circ THEN BEGIN
        	file=dir_out+'out/'+'EXT_CIRC.RES'
        	st_circext=dustem_read_circ_vg(file,silent=silent)
        	st={sed:st_sed,ext:st_ext,polext:st_polext,polsed:st_polsed,circext:st_circext}
	    ENDIF ELSE BEGIN
        	st={sed:st_sed,ext:st_ext,polext:st_polext,polsed:st_polsed}
	    ENDELSE
    ENDIF ELSE BEGIN
        st={sed:st_sed,ext:st_ext}
    ENDELSE
;VGe
  END
  ELSE: BEGIN
    file=dir_out+'DUSTEM.RES'
    st_sed=dustem_read_dustem(file,silent=silent)
    file=dir_out+'SECTEFFIR.RES'
    st_secteffir=dustem_read_secteffir(file,silent=silent)

    file=dir_out+'SECTEFFUV.RES'
    st_secteffuv=dustem_read_secteffuv(file,silent=silent)
    st={sed:st_sed,secteffir:st_secteffir,secteffuv:st_secteffuv}
  END
ENDCASE

;stop
the_end:

RETURN,st

END