dustem_cc_print.pro 3.97 KB
PRO dustem_cc_print,filters,norestart=norestart,help=help

;+
; NAME:
;    dustem_cc_print
;
; PURPOSE:
;    Print out numerical values of color correction for a given spectrum in a given filter
;    This is a sanity checking routine.
;    Output should be compared to the color-correction tables published by different
;    instrument teams. See also dustem_cc_verify.pro
;    e.g. 1  MIPS HandBook, page 98
;    http://irsa.ipac.caltech.edu/data/SPITZER/docs/mips/mipsinstrumenthandbook/MIPS_Instrument_Handbook.pdf
;    http://irsa.ipac.caltech.edu/data/SPITZER/docs/mips/mipsinstrumenthandbook/51/
;    AND
;    e.g. 2  IRAS Explanatory Supplement, Table VI.C.6
;    https://irsa.ipac.caltech.edu/IRASdocs/exp.sup/ch6/tabsupC6.html  
;
; CATEGORY:
;    DustEMWrap, Distributed, Low-Level, User convenience, Development
;
; CALLING SEQUENCE:
;    dustem_cc_print,filters[,restart=restart,help=help]
;
; INPUTS:
;    filter: names of filters for which color correction will be printed
;
; OPTIONAL INPUT PARAMETERS:
;    None
;
; OUTPUTS:
;
; OPTIONAL OUTPUT PARAMETERS:
;
; ACCEPTED KEY-WORDS:
;    help      = If set, print this help
;    norestart   = If set, do not reinitialise DustEMWrap
;
; COMMON BLOCKS:
;    None
;
; SIDE EFFECTS:
;    None
;
; RESTRICTIONS:
;    The DustEM fortran code must be installed
;    The DustEMWrap IDL code must be installed
;    If restart is not set, this routine should be called after the
;    successful completion of a DustEMWrap run (i.e. without quitting the
;    IDL session) since it will use existing system variables 
;
; PROCEDURES AND SUBROUTINES USED:
;    
; EXAMPLES
;    dustem_cc_print,['MIRI1','MIRI6']
;    dustem_cc_print,['IRAS1','IRAC2'],/norestart
;
; 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_cc_print'
  goto,the_end
ENDIF

;== Check if user gave us filters
  if not keyword_set(filters) then begin
     message,'You must provide a list of filters',/info
     stop
  end

;== Initialize DustemWrap if restart requested
  if not keyword_set(norestart) then begin
     dustem_init
     Nwav=50000 & wavmin=0.1 & wavmax=500.
     wavs=findgen(Nwav)/(Nwav-1)*(wavmax-wavmin)+wavmin
     wavs=10^(alog10(wavmin)+alog10(wavmax)*(dindgen(Nwav+1)/Nwav))
     restart=0
  end else begin
     st=dustem_run()
     wavs=st.sed.wav
  end

Nfilt=n_elements(filters)
wavref=dustem_filter2wav(filters)

;== Compute color corrections for power laws of frequency
pows=[3,2.5,2,2.5,1,0.5,0,-0.5,-1,-1.5,-2.,-2.5]
Nv=n_elements(pows)
K=fltarr(Nv,Nfilt)
frmt_tit1='(A10,A10,A10,13F9.3)'
frmt1='(A10,A10,15F9.3)'
FOR i=0L,Nv-1 DO BEGIN
   spec=wavs^(-1.*pows[i])
   sed=dustem_cc(wavs,spec,filters,cc=cc,fluxconv=fluxconv,help=help)
   K[i,*]=cc
ENDFOR

print,'====== Power laws, spectral index between -3 and 3 ======'
print,'Filters','AltName','lambda0',pows,format=frmt_tit1
print,'========================================================='
FOR i=0L,Nfilt-1 DO print,filters[i],dustem_filter2name(filters[i]),wavref[i],K[*,i],format=frmt1
print,'========================================================='
print,'========================================================='
print,''

;== Compute color corrections for Black Bodies
Ts=1.e3*[3.,4,6,8,10.]
Nv=n_elements(Ts)
K=fltarr(Nv,Nfilt)
frmt_tit2='(A10,A10,A10,16I9)'
FOR i=0L,Nv-1 DO BEGIN
  spec=dustem_planck_function(Ts[i],wavs)
  sed=dustem_cc(wavs,spec,filters,cc=cc,fluxconv=fluxconv,help=help)
  K[i,*]=cc
ENDFOR

;== print results
print,'====== Blackbodies, temperatures between 20 and 10000K ======'
print,'Filters','AltName','lambda0',Ts,format=frmt_tit2
print,'============================================================='
FOR i=0L,Nfilt-1 DO print,filters[i],dustem_filter2name(filters[i]),wavref[i],K[*,i],format=frmt1
print,'============================================================='
print,'============================================================='

;stop

the_end:
END