dustem_show_file_dependencies.pro 8.83 KB
PRO dustem_show_file_dependencies,help=help $
                                  ,outfile=outfile $
                                  ,compfile=compfile $
                                  ,steps=steps

;+
; NAME:
;    dustem_show_file_dependencies
;
; PURPOSE:
;    Generate a list of routines used during a DustEMWrap run
;
; CATEGORY:
;    DustEMWrap, Distributed, Low-Level, Development
;
; CALLING SEQUENCE:
;    dustem_show_file_dependencies[,help=help][,outfile=]
;
; INPUTS:
;    None
;
; OPTIONAL INPUT PARAMETERS:
;    outfile = string, .xcat file (and path) with list of compiled routines and
;            functions. Default is './DustEMWrap_dependencies.xcat'
;    compfile = string, .xcat file (and path) with list of unused
;            routines in !dustem_wrap_soft_dir/src/idl/.
;            Default is './DustEMWrap_unused_routines.xcat'
;
; OUTPUTS:
;
; OPTIONAL OUTPUT PARAMETERS:
;
; ACCEPTED KEY-WORDS:
;    help      = If set, print this help
;    steps     = Stop after each proc
;  
; COMMON BLOCKS:
;    None
;
; SIDE EFFECTS:
;    None
;
; RESTRICTIONS:
;    The DustEM fortran code must be installed
;    The DustEMWrap IDL code must be installed
;
; PROCEDURES AND SUBROUTINES USED:
;    
; EXAMPLES
; 
; MODIFICATION HISTORY:
;    Written by JPB Apr-2022
;    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_show_file_dependencies'
  goto,the_end
END

use_outfile='./DustEMWrap_dependencies.xcat'
use_compfile='./DustEMWrap_unused_routines.xcat'
if keyword_set(outfile) then use_outfile=outfile
if keyword_set(compfile) then use_compfile=compfile

; HERE IS WHERE YOU PUT THE TOP-LEVEL ROUTINES TO RUN 
;===== The following is the list of non regression tests performed under idl and fawlty

dustem_init,/wrap
dustem_init,/wrap,/plot
dustem_init,model='LD01',/wrap,/plot
dustem_init,model='DL01_RV3P1_BC6',/wrap,/plot
dustem_init,model='WD01',/wrap,/plot

;;dustem_init,model='J13',/wrap,/plot,/pol ; this should fail
dustem_init,model='G17_MODELA',/wrap,/plot,/pol
dustem_init,model='G17_MODELB',/wrap,/plot,/pol
dustem_init,model='G17_MODELD',/wrap,/plot,/pol,grain_keywords=['?','plaw','?'],st_model=g17model_params,/noerase
dustem_init,model='G17_MODELD',/wrap,/plot,/pol,grain_keywords=['?','logn-pol','logn-pol'],st_model=g17model_logn_params,/noerase

dustem_run_example,'MC10',show="all"
;;if keyword_set(steps) then stop
dustem_run_example,'DBP90',show="rfield"
;;if keyword_set(steps) then stop
dustem_run_example,'DL01',show="emis"
;;if keyword_set(steps) then stop
dustem_run_example,'DL07',show="extir"
;;if keyword_set(steps) then stop
dustem_run_example,'G17_MODELA',show="all"
;;if keyword_set(steps) then stop
dustem_run_example,'G17_MODELB',show="polsed"
;;if keyword_set(steps) then stop
dustem_run_example,'G17_MODELC',show="polext"
;;if keyword_set(steps) then stop
dustem_run_example,'G17_MODELD',show="align"
;;if keyword_set(steps) then stop
dustem_run_example,'J13',show="extuv"
;;if keyword_set(steps) then stop
dustem_run_example,'WD01_RV5P5B',show=["alb","sdist"]
;;if keyword_set(steps) then stop

dustem_run_example,'MC10',show="all"
;;if keyword_set(steps) then stop
dustem_run_example,'DBP90',show="all"
;;if keyword_set(steps) then stop
dustem_run_example,'COMPIEGNE_ETAL10',show="all"
dustem_run_example,'DL01',show="all"
dustem_run_example,'DL01_RV3P1_BC6',show="all"
;;dustem_run_example,'DL01_RV5P5B_BC3',show="all" ; model removed from 2023 release
;;dustem_run_example,'DL01_RV5P5B_BC0',show="all"  ; model removed from 2023 release

dustem_run_example,'DL07',show="extir"

dustem_run_example,'G17_MODELA',show="all"

dustem_run_example,'G17_MODELB',show="all"

dustem_run_example,'G17_MODELC',show="all"

dustem_run_example,'G17_MODELD',show="all"

dustem_run_example,'J13',show="all"
dustem_run_example,'AJ13',show="all"

dustem_run_example,'WD01_RV5P5B',show="all"

dustem_run_example,'LD01',show="all"


dustem_make_polarization_sed_example,model='G17_MODELA',outfile=!dustem_dat+'pol_sed_G17A.xcat'
dustem_make_polarization_sed_example,model='G17_MODELB',outfile=!dustem_dat+'pol_sed_G17B.xcat'
dustem_make_polarization_sed_example,model='G17_MODELC',outfile=!dustem_dat+'pol_sed_G17C.xcat'
dustem_make_polarization_sed_example,model='G17_MODELD',outfile=!dustem_dat+'pol_sed_G17D.xcat'

dustem_make_polarization_ext_example,model='G17_MODELA',outfile=!dustem_dat+'pol_ext_G17A.xcat'
dustem_make_polarization_ext_example,model='G17_MODELB',outfile=!dustem_dat+'pol_ext_G17B.xcat'
dustem_make_polarization_ext_example,model='G17_MODELC',outfile=!dustem_dat+'pol_ext_G17C.xcat'
dustem_make_polarization_ext_example,model='G17_MODELD',outfile=!dustem_dat+'pol_ext_G17D.xcat'

dustem_fit_intensity_example,Nitermax=2
dustem_fit_intensity_example,Nitermax=2,/noobj
dustem_fit_intensity_example,Nitermax=2,postscript=!dustem_dat+'dustemwrap_fit_intensity_example.ps'

dustem_fit_spectro_example,Nitermax=2
dustem_fit_spectro_example,Nitermax=2,/noob

dustem_fit_spectro_example,Nitermax=2,postscript=!dustem_dat+'dustemwrap_fit_spectro_example.ps'

dustem_fit_intensity_mbb_example,Nitermax=2
dustem_fit_intensity_mbb_example,Nitermax=2,/noobj
dustem_fit_intensity_mbb_example,Nitermax=2,postscript=!dustem_dat+'dustemwrap_fit_intensity_mbb_example.ps'

;;dustem_fit_polarization_example,Nitermax=2,model='DL01' ; should fail

dustem_fit_polarization_example,Nitermax=2
dustem_fit_polarization_example,Nitermax=2,/noobj
dustem_fit_polarization_example,Nitermax=2,postscript=!dustem_dat+'dustemwrap_fit_polarization_example.ps'
dustem_fit_polarization_example,Nitermax=3,sed_file=!dustem_dat+'pol_sed_G17D.xcat'

;;dustem_make_polarization_ext_example,model='MC10' ; should fail


dustem_fit_ext_example,Nitermax=2
dustem_fit_ext_example,Nitermax=2,/noobj
dustem_fit_ext_example,Nitermax=2,postscript=!dustem_dat+'dustemwrap_fit_ext_example.ps'

;;dustem_fit_ext_pol_example,model='J13' ; should fail

dustem_fit_ext_pol_example,Nitermax=3
dustem_fit_ext_pol_example,Nitermax=3,/noobj
dustem_fit_ext_pol_example,Nitermax=2,postscript=!dustem_dat+'dustemwrap_fit_ext_pol_example.ps'
dustem_fit_ext_pol_example,Nitermax=3,ext_file=!dustem_dat+'pol_ext_G17D.xcat'


dustem_fit_sed_ext_stokesi_example 
dustem_fit_sed_ext_stokesi_example,/noobj 
dustem_fit_sed_ext_stokesi_example, postscript=!dustem_dat+'dustemwrap_fit_sed_ext_stokesi_example.ps'


dustem_fit_sed_ext_pol_example,Nitermax=2
dustem_fit_sed_ext_pol_example,Nitermax=2, postscript=!dustem_dat+'dustemwrap_fit_sed_ext_pol_example.ps'
dustem_fit_sed_ext_pol_example,Nitermax=2,/noobj
dustem_fit_sed_ext_pol_example,Nitermax=2,ext_file=!dustem_dat+'pol_ext_G17D.xcat'
dustem_fit_sed_ext_pol_example,Nitermax=2,ext_file=!dustem_dat+'pol_ext_G17D.xcat',sed_file=!dustem_dat+'pol_sed_G17D.xcat'

dustem_myisrf_example,Nitermax=3
dustem_myisrf_example,Nitermax=3,/noobj
dustem_myisrf_example,Nitermax=2, postscript=!dustem_dat+'dustemwrap_myisrf_example.ps'

dustem_stellarpopisrf_example,Nitermax=3
dustem_stellarpopisrf_example,Nitermax=3,/noobj
dustem_stellarpopisrf_example,Nitermax=2, postscript=!dustem_dat+'dustemwrap_stellarpop_example.ps'


;dustem_fitsio_example,/nostop

; END LIST OF TOP-LEVEL ROUTINES

; CONSTRUCT A STRUCTURE WITH ROUTINES THAT WERE COMPILED DURING ABOVE RUNS
help,/function,output=ff
help,/pro,output=pp
   
ff=ff[1:*]
pp=pp[2:*]

nff=n_elements(ff)
npp=n_elements(pp)

one_func={name:'',path:'',args:ptr_new()}
one_pro={name:'',path:'',args:ptr_new()}

func_list=replicate(one_func,nff)
pro_list=replicate(one_pro,npp)

message,'Found '+string(nff)+' functions',/info

FOR i=0L,nff-1 DO BEGIN
  str=strcompress(ff(i))
  vv=str_sep(str,' ')
  func_list(i).name=vv(0)
  func_list(i).args=ptr_new(vv(1:*))
  wh=which_pro(strlowcase(func_list(i).name))
  func_list(i).path=wh(0)
ENDFOR

message,'Found '+string(npp)+' routines',/info
FOR i=0L,npp-1 DO BEGIN
  str=strcompress(pp(i))
  vv=str_sep(str,' ')
  pro_list(i).name=vv(0)
  pro_list(i).args=ptr_new(vv(1:*))
  wh=which_pro(strlowcase(pro_list(i).name))
  pro_list(i).path=wh(0)
ENDFOR

one_st={name:'',path:''}
st=replicate(one_st,nff+npp)
st.name=[func_list.name,pro_list.name]
st.path=[func_list.path,pro_list.path]

;=== remove empty names
ind=where(st.name NE '')
st=st(ind)
;=== remove empty path (are entries without .pro)
ind=where(st.path NE '')
st=st(ind)

;=== order by path
order=sort(st.path)
st=st(order)

write_xcat,st,use_outfile,/wiki
write_xcat,st,use_outfile
message,'Wrote '+use_outfile,/info


; CONSTRUCT A STRUCTURE WITH ROUTINES IN SRC/IDL THAT WERE NOT
; COMPILED DURING THE EXAMPLES
allpro=file_search(!dustem_wrap_soft_dir+'src/idl/*pro',count=nall)
match2,st.path,allpro,a,b
idx=where(b eq -1, ct)
if ct ne 0 then begin
   ust=replicate(one_st,ct)
   ust.path=allpro[idx]
   ust.name=strupcase(file_basename(allpro[idx],'.pro'))
   write_xcat,ust,use_compfile
   message,'Wrote '+use_compfile,/info
end else begin
   message,'No unused DustEMWrap routines',/info
end


stop
the_end:
END