Blame view

src/idl/dustem_fitsio_example.pro 6.18 KB
e431104b   Annie Hughes   general updates f...
1
PRO dustem_fitsio_example,help=help,nostop=nostop
1f71e137   Annie Hughes   first commit
2
3
4
5
6
7

;+
; NAME:
;    dustem_fitsio_example
;
; PURPOSE:
e431104b   Annie Hughes   general updates f...
8
;    Testing the save/restore of FITS files
1f71e137   Annie Hughes   first commit
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
;
; 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
e431104b   Annie Hughes   general updates f...
27
;    nostop = if set, do not stop between code blocks
1f71e137   Annie Hughes   first commit
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
;  
; 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

e431104b   Annie Hughes   general updates f...
54
goto,spectro
1f71e137   Annie Hughes   first commit
55

e431104b   Annie Hughes   general updates f...
56
57
stokesi:
dustem_fit_intensity_example,Nitermax=10,fits_save='/tmp/example_fit_intensity_only.fits'
1f71e137   Annie Hughes   first commit
58
59
;exit/.reset
dustem_read_fits_table,filename='/tmp/example_fit_intensity_only.fits',dustem_st=dustem_spectra_st
1f71e137   Annie Hughes   first commit
60
61
62
63
64
65
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
e431104b   Annie Hughes   general updates f...
66
dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'
1f71e137   Annie Hughes   first commit
67
68


e431104b   Annie Hughes   general updates f...
69
70
if not keyword_set(nostop) then stop
spectro:
1f71e137   Annie Hughes   first commit
71
72
dustem_fit_spectro_example,Nitermax=2,fits_save='/tmp/example_fit_spectro.fits'
;exit/.reset
e431104b   Annie Hughes   general updates f...
73
dustem_read_fits_table,filename='/tmp/example_fit_spectro.fits',dustem_st=dustem_spectra_st
1f71e137   Annie Hughes   first commit
74
75
76
77
xr = [1.,5e5]
yr = [5e-8,1.00e6]
tit='FIT SPECTRO EXAMPLE' ; plot title
res=*(*!dustem_fit).CURRENT_PARAM_VALUES
e431104b   Annie Hughes   general updates f...
78
dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'
1f71e137   Annie Hughes   first commit
79
80


e431104b   Annie Hughes   general updates f...
81
if not keyword_set(nostop) then stop
1f71e137   Annie Hughes   first commit
82
83
84
85
86
87
88
89
90
91

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
e431104b   Annie Hughes   general updates f...
92
dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'
1f71e137   Annie Hughes   first commit
93
94


e431104b   Annie Hughes   general updates f...
95
if not keyword_set(nostop) then stop
1f71e137   Annie Hughes   first commit
96
97
98
99
100
101
102
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
e431104b   Annie Hughes   general updates f...
103
dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'
1f71e137   Annie Hughes   first commit
104
105


e431104b   Annie Hughes   general updates f...
106
if not keyword_set(nostop) then stop
1f71e137   Annie Hughes   first commit
107
108
109
110
111
112
113
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
e431104b   Annie Hughes   general updates f...
114
dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'
1f71e137   Annie Hughes   first commit
115
116


e431104b   Annie Hughes   general updates f...
117
if not keyword_set(nostop) then stop
1f71e137   Annie Hughes   first commit
118
119
120
121
122
123
124
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
e431104b   Annie Hughes   general updates f...
125
dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)'
1f71e137   Annie Hughes   first commit
126

e431104b   Annie Hughes   general updates f...
127
if not keyword_set(nostop) then stop
1f71e137   Annie Hughes   first commit
128
129
130
131
132
133
134
135
136
137
138
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
e431104b   Annie Hughes   general updates f...
139
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)'
1f71e137   Annie Hughes   first commit
140
141


e431104b   Annie Hughes   general updates f...
142
if not keyword_set(nostop) then stop
1f71e137   Annie Hughes   first commit
143
144
145
146
147
148
149
150
151
152
153
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
e431104b   Annie Hughes   general updates f...
154
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)'
1f71e137   Annie Hughes   first commit
155

e431104b   Annie Hughes   general updates f...
156
if not keyword_set(nostop) then stop
1f71e137   Annie Hughes   first commit
157
158
159
160
161
162
163
164
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
e431104b   Annie Hughes   general updates f...
165
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)'
1f71e137   Annie Hughes   first commit
166
167


e431104b   Annie Hughes   general updates f...
168
169
170
171
172
173
174
175
176
177
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)'
1f71e137   Annie Hughes   first commit
178

e431104b   Annie Hughes   general updates f...
179
the_end:
1f71e137   Annie Hughes   first commit
180
181

end