dustem_fitsio_example.pro 6.18 KB
PRO dustem_fitsio_example,help=help,nostop=nostop

;+
; NAME:
;    dustem_fitsio_example
;
; PURPOSE:
;    Testing the save/restore of FITS files
;
; CATEGORY:
;    DustEMWrap, Distributed, Low-Level, Development
;
; CALLING SEQUENCE:
;    dustem_fitsio_example
;
; INPUTS:
;    None
;
; OPTIONAL INPUT PARAMETERS:
;
; OUTPUTS:
;
; OPTIONAL OUTPUT PARAMETERS:
;
; ACCEPTED KEY-WORDS:
;    help = print this help
;    nostop = if set, do not stop between code blocks
;  
; 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 AH Apr-2023
;    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_fitsio_example'
  goto,the_end
END

goto,spectro

stokesi:
dustem_fit_intensity_example,Nitermax=10,fits_save='/tmp/example_fit_intensity_only.fits'
;exit/.reset
dustem_read_fits_table,filename='/tmp/example_fit_intensity_only.fits',dustem_st=dustem_spectra_st
yr=[1.00e-4,1.00E2] ; y-axis limits
xr=[1.00E0,6.00e4] ; x-axis limits
tit='FIT INTENSITY EXAMPLE' ; plot title
ytit=textoidl('I_\nu (MJy/sr) for N_H=10^{20} H/cm^2') ; y-axis title
xtit=textoidl('\lambda (\mum)') ; x-axis title
res=*(*!dustem_fit).CURRENT_PARAM_VALUES
dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'


if not keyword_set(nostop) then stop
spectro:
dustem_fit_spectro_example,Nitermax=2,fits_save='/tmp/example_fit_spectro.fits'
;exit/.reset
dustem_read_fits_table,filename='/tmp/example_fit_spectro.fits',dustem_st=dustem_spectra_st
xr = [1.,5e5]
yr = [5e-8,1.00e6]
tit='FIT SPECTRO EXAMPLE' ; plot title
res=*(*!dustem_fit).CURRENT_PARAM_VALUES
dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'


if not keyword_set(nostop) then stop

dustem_fit_intensity_mbb_example,Nitermax=2,fits_save='/tmp/example_fit_mbb.fits'
;exit/.reset
dustem_read_fits_table,filename='/tmp/example_fit_mbb.fits',dustem_st=dustem_spectra_st
yr=[1.00e-4,1.00E2] ; y-axis limits
xr=[1.00E0,6.00e4] ; x-axis limits
tit='MBB FIT EXAMPLE' ; plot title
ytit=textoidl('I_\nu (MJy/sr) for N_H=10^{20} H/cm^2') ; y-axis title
xtit=textoidl('\lambda (\mum)') ; x-axis title
res=*(*!dustem_fit).CURRENT_PARAM_VALUES
dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'


if not keyword_set(nostop) then stop
dustem_fit_polarization_example,Nitermax=2,fits_save='/tmp/example_fit_polar.fits'
;exit/.reset
dustem_read_fits_table,filename='/tmp/example_fit_polar.fits',dustem_st=dustem_spectra_st
yr=[1.00e-4,1.00E2] ; y-axis limits
xr=[1.00E0,6.00e4] ; x-axis limits
tit='FIT POLARISATION SED EXAMPLE' ; plot title
res=*(*!dustem_fit).CURRENT_PARAM_VALUES
dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'


if not keyword_set(nostop) then stop
dustem_fit_ext_example,Nitermax=2,fits_save='/tmp/example_fit_ext.fits'
;exit/.reset
dustem_read_fits_table,filename='/tmp/example_fit_ext.fits',dustem_st=dustem_spectra_st
xr=[0.01,30]
yr=[1.00E-10,10]
tit='FIT EXTINCTION EXAMPLE' ; plot title
res=*(*!dustem_fit).CURRENT_PARAM_VALUES
dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'


if not keyword_set(nostop) then stop
dustem_fit_ext_pol_example,Nitermax=2,fits_save='/tmp/example_fit_ext_polar.fits'
;exit/.reset
dustem_read_fits_table,filename='/tmp/example_fit_ext_polar.fits',dustem_st=dustem_spectra_st
xr=[0.01,30]
yr=[1.00E-10,50]
tit='FIT POLARISED EXTINCTION EXAMPLE' ; plot title
res=*(*!dustem_fit).CURRENT_PARAM_VALUES
dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'

if not keyword_set(nostop) then stop
dustem_fit_sed_ext_stokesi_example,Nitermax=2,fits_save='/tmp/example_fit_sed_ext_stokesi.fits'
;exit/.reset
dustem_read_fits_table,filename='/tmp/example_fit_sed_ext_stokesi.fits',dustem_st=dustem_spectra_st
xr_x = [0.01,30]
yr_x = [5.00E-8,10]
xr_m = [1.,5e5]
yr_m = [5e-8,1.00e6]
tit_m='Spectral Energy Distribution' 
tit_x='Dust Optical Depth' 
tit='FIT STOKESI EXTINCTION AND EMISSION EXAMPLE' ; plot title
res=*(*!dustem_fit).CURRENT_PARAM_VALUES
dustemwrap_plot,res,st=dustem_spectra_st,xr_x=xr_x,xr_m=xr_m,/xstyle,yr_x=yr_x,yr_m=yr_m,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'


if not keyword_set(nostop) then stop
dustem_fit_sed_ext_pol_example,Nitermax=2,fits_save='/tmp/example_fit_sed_ext_polar.fits'
;exit/.reset
dustem_read_fits_table,filename='/tmp/example_fit_sed_ext_polar.fits',dustem_st=dustem_spectra_st
xr_x = [0.01,30]
yr_x = [5.00E-8,10]
xr_m = [1.,5e5]
yr_m = [5e-8,1.00e6]
tit_m='Spectral Energy Distribution' 
tit_x='Dust Optical Depth' 
tit='FIT POLARISED EXTINCTION AND EMISSION EXAMPLE' ; plot title
res=*(*!dustem_fit).CURRENT_PARAM_VALUES
dustemwrap_plot,res,st=dustem_spectra_st,xr_x=xr_x,xr_m=xr_m,/xstyle,yr_x=yr_x,yr_m=yr_m,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'

if not keyword_set(nostop) then stop
dustem_myisrf_example,Nitermax=2,fits_save='/tmp/example_fit_isrf.fits'
;exit/.reset
dustem_read_fits_table,filename='/tmp/example_fit_isrf.fits',dustem_st=dustem_spectra_st
xr_m = [1.,5e5]
yr_m = [5e-8,1.00e6]
tit_m='Spectral Energy Distribution' 
tit='FIT WITH USER ISRF EXAMPLE' ; plot title
res=*(*!dustem_fit).CURRENT_PARAM_VALUES
dustemwrap_plot,res,st=dustem_spectra_st,xr_m=xr_m,/xstyle,yr_m=yr_m,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'


if not keyword_set(nostop) then stop
dustem_stellarpopisrf_example,Nitermax=3,fits_save='/tmp/example_fit_stellarpop.fits'
;exit/.reset
dustem_read_fits_table,filename='/tmp/example_fit_stellarpop.fits',dustem_st=dustem_spectra_st
xr_m = [1.,5e5]
yr_m = [5e-8,1.00e6]
tit_m='Spectral Energy Distribution' 
tit='FIT WITH STELLARPOP ISRF EXAMPLE' ; plot title
res=*(*!dustem_fit).CURRENT_PARAM_VALUES
dustemwrap_plot,res,st=dustem_spectra_st,xr_m=xr_m,/xstyle,yr_m=yr_m,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'

the_end:

end