dustem_show_file_dependencies.pro 4.35 KB
PRO dustem_show_file_dependencies,help=help,outfile=outfile,compfile=compfile

;+
; 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
;
; 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-2011
;    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 


;/Users/jpb/Soft_Libraries/dustem-wrapper_idl/src/idl/dustem_run_example.pro
;/Users/jpb/Soft_Libraries/dustem-wrapper_idl/src/idl/dustem_stellarpopisrf_example.pro
;===== The following is the list of non regression tests performed under idl and fawlty
dustem_init,/wrap,/plot
dustem_run_example,'MC10',show="all"
dustem_make_polarization_sed_example,model='G17_MODELA'
dustem_fit_intensity_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile1.fits'
dustem_fit_polarization_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile2.fits'
dustem_fit_ext_pol_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile3.fits'
dustem_fit_sed_ext_pol_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile4.fits'
dustem_fit_intensity_mbb_example,Nitermax=1,postscript='/tmp/dustemwrap_postcript_example.ps'
;=== for some reason plot goes red here under fawlty
dustem_myisrf_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile5.fits'
dustem_stellarpopisrf_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile6.fits'
dustem_fit_intensity_example,Nitermax=1,/noobj

; 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)
mathch2,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[xx],'.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