Commit e431104b54e77b191451eb5d07c70a0a001ca910
1 parent
98f4f9e2
Exists in
master
general updates for self-consistency between examples
Showing
14 changed files
with
228 additions
and
126 deletions
Show diff stats
src/idl/dustem_fit_ext_example.pro
1 | 1 | PRO dustem_fit_ext_example,model=model $ |
2 | 2 | ,ext_file=ext_file $ |
3 | 3 | ,Nitermax=Nitermax $ |
4 | - ,fits_save=fits_save $ | |
4 | + ,postscript=postscript $ | |
5 | + ,fits_save=fits_save $ | |
5 | 6 | ,wait=wait $ |
6 | 7 | ,noobj=noobj $ |
7 | 8 | ,help=help $ |
... | ... | @@ -21,7 +22,7 @@ PRO dustem_fit_ext_example,model=model $ |
21 | 22 | ; DustEMWrap, Distributed, High-Level, User Example |
22 | 23 | ; |
23 | 24 | ; CALLING SEQUENCE: |
24 | -; dustem_fit_ext_example[,model=][ext_file=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
25 | +; dustem_fit_ext_example[,model=][ext_file=][,postscript=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
25 | 26 | ; |
26 | 27 | ; INPUTS: |
27 | 28 | ; None |
... | ... | @@ -42,10 +43,10 @@ PRO dustem_fit_ext_example,model=model $ |
42 | 43 | ; ext_file = string naming the path to text file in .xcat format that |
43 | 44 | ; describes the observational extinction SED. If not set, the file |
44 | 45 | ; 'Data/EXAMPLE_OBSDATA/Mathis90Fitz99_DISM_NH20.xcat' is used. |
46 | +; postscript = if set, final plot is saved as postscript file | |
45 | 47 | ; Nitermax = maximum number of fit iterations. Default is 5. |
46 | 48 | ; fits_save = if set, save the fit results in a binary |
47 | -; FITS file. The code then restore this file and plots | |
48 | -; the results using the saved results information. | |
49 | +; FITS file. | |
49 | 50 | ; help = if set, print this help |
50 | 51 | ; wait = if set, wait this many seconds between each step of |
51 | 52 | ; the code (for illustration purposes) |
... | ... | @@ -193,6 +194,28 @@ if keyword_set(wait) then begin |
193 | 194 | wait,wait |
194 | 195 | end |
195 | 196 | |
197 | +;=== MAKE THE FINAL PLOT | |
198 | +IF keyword_set(postscript) THEN BEGIN | |
199 | +; dir_ps='./' | |
200 | + mydevice=!d.name | |
201 | + set_plot,'PS' | |
202 | +; ps_file=dir_ps+postscript | |
203 | + ps_file=postscript | |
204 | + device,filename=ps_file,/color | |
205 | +ENDIF | |
206 | + | |
207 | +IF !dustem_noobj THEN BEGIN | |
208 | + dustemwrap_plot_noobj,*(*!dustem_fit).CURRENT_PARAM_VALUES,st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
209 | + ENDIF ELSE BEGIN | |
210 | + dustemwrap_plot,*(*!dustem_fit).CURRENT_PARAM_VALUES,st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
211 | +ENDELSE | |
212 | + | |
213 | +IF keyword_set(postscript) THEN BEGIN | |
214 | + device,/close | |
215 | + set_plot,mydevice | |
216 | + message,'Wrote '+ps_file,/info | |
217 | +ENDIF | |
218 | + | |
196 | 219 | IF keyword_set(fits_save) THEN BEGIN |
197 | 220 | message,'Writing out results structure: '+fits_save,/info |
198 | 221 | dustem_write_fits_table,filename=fits_save,help=help | ... | ... |
src/idl/dustem_fit_ext_pol_example.pro
1 | 1 | PRO dustem_fit_ext_pol_example,model=model $ |
2 | 2 | ,ext_file=ext_file $ |
3 | 3 | ,Nitermax=Nitermax $ |
4 | - ,fits_save=fits_save $ | |
4 | + ,postscript=postscript $ | |
5 | + ,fits_save=fits_save $ | |
5 | 6 | ,wait=wait $ |
6 | 7 | ,noobj=noobj $ |
7 | 8 | ,help=help $ |
... | ... | @@ -21,7 +22,7 @@ PRO dustem_fit_ext_pol_example,model=model $ |
21 | 22 | ; DustEMWrap, Distributed, High-Level, User Example |
22 | 23 | ; |
23 | 24 | ; CALLING SEQUENCE: |
24 | -; dustem_fit_ext_pol_example[,model=][ext_file=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
25 | +; dustem_fit_ext_pol_example[,model=][ext_file=][,postscript=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
25 | 26 | ; |
26 | 27 | ; INPUTS: |
27 | 28 | ; None |
... | ... | @@ -46,10 +47,9 @@ PRO dustem_fit_ext_pol_example,model=model $ |
46 | 47 | ; used to define the observational structure, and a synthetic |
47 | 48 | ; observation is generated using the dust model. |
48 | 49 | ; Nitermax = maximum number of fit iterations. Default is 5. |
50 | +; postscript = if set, final plot is saved as postscript file | |
49 | 51 | ; fits_save = if set, save the fit results in a binary |
50 | -; FITS file. The code then restore this file and plots | |
51 | -; the results using the saved results information. | |
52 | -; help = if set, print this help | |
52 | +; FITS file. | |
53 | 53 | ; wait = if set, wait this many seconds between each step of |
54 | 54 | ; the code (for illustration purposes) |
55 | 55 | ; verbose = if set, subroutines will run in verbose mode |
... | ... | @@ -240,6 +240,33 @@ if keyword_set(wait) then begin |
240 | 240 | wait,wait |
241 | 241 | end |
242 | 242 | |
243 | +;=== MAKE THE FINAL PLOT | |
244 | +IF keyword_set(postscript) THEN BEGIN | |
245 | +; dir_ps='./' | |
246 | + mydevice=!d.name | |
247 | + set_plot,'PS' | |
248 | +; ps_file=dir_ps+postscript | |
249 | + ps_file=postscript | |
250 | + device,filename=ps_file,/color | |
251 | +ENDIF | |
252 | + | |
253 | +;stop | |
254 | + | |
255 | +IF !dustem_noobj THEN BEGIN | |
256 | + dustemwrap_plot_noobj,*(*!dustem_fit).CURRENT_PARAM_VALUES,st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
257 | + ENDIF ELSE BEGIN | |
258 | + dustemwrap_plot,*(*!dustem_fit).CURRENT_PARAM_VALUES,st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
259 | +ENDELSE | |
260 | + | |
261 | +IF keyword_set(postscript) THEN BEGIN | |
262 | + device,/close | |
263 | + set_plot,mydevice | |
264 | + message,'Wrote '+ps_file,/info | |
265 | +ENDIF | |
266 | + | |
267 | + | |
268 | + | |
269 | + | |
243 | 270 | IF keyword_set(fits_save) THEN BEGIN |
244 | 271 | message,'Writing out results structure: '+fits_save,/info |
245 | 272 | dustem_write_fits_table,filename=fits_save,help=help |
... | ... | @@ -262,8 +289,8 @@ IF keyword_set(fits_save) THEN BEGIN |
262 | 289 | ENDIF |
263 | 290 | ENDIF |
264 | 291 | |
265 | -message,'Finished dustem_fit_ext_pol_example',/info | |
266 | 292 | |
267 | 293 | the_end: |
294 | +message,'Finished dustem_fit_ext_pol_example',/info | |
268 | 295 | |
269 | 296 | END | ... | ... |
src/idl/dustem_fit_intensity_example.pro
... | ... | @@ -52,8 +52,7 @@ PRO dustem_fit_intensity_example,model=model $ |
52 | 52 | ; sed_file = string naming the path to text file in .xcat format that |
53 | 53 | ; describes the observational SED. If not set, the file |
54 | 54 | ; 'Data/EXAMPLE_OBSDATA/example_SED_1.xcat' is used. |
55 | -; postscript = if set, final plot is saved as postscript in the | |
56 | -; current working directory | |
55 | +; postscript = if set, final plot is saved as postscript file | |
57 | 56 | ; Nitermax = maximum number of fit iterations. Default is 5. |
58 | 57 | ; fits_save = if set, save the fit results in a binary |
59 | 58 | ; FITS file. |
... | ... | @@ -319,12 +318,13 @@ if keyword_set(wait) then begin |
319 | 318 | wait,wait |
320 | 319 | end |
321 | 320 | |
322 | - | |
323 | 321 | ;=== MAKE THE FINAL PLOT |
324 | 322 | IF keyword_set(postscript) THEN BEGIN |
325 | - dir_ps='./' | |
323 | +; dir_ps='./' | |
324 | + mydevice=!d.name | |
326 | 325 | set_plot,'PS' |
327 | - ps_file=dir_ps+postscript | |
326 | +; ps_file=dir_ps+postscript | |
327 | + ps_file=postscript | |
328 | 328 | device,filename=ps_file,/color |
329 | 329 | ENDIF |
330 | 330 | |
... | ... | @@ -337,8 +337,8 @@ IF !dustem_noobj THEN BEGIN |
337 | 337 | ENDELSE |
338 | 338 | |
339 | 339 | IF keyword_set(postscript) THEN BEGIN |
340 | - set_plot,'X' | |
341 | 340 | device,/close |
341 | + set_plot,mydevice | |
342 | 342 | message,'Wrote '+ps_file,/info |
343 | 343 | ENDIF |
344 | 344 | ... | ... |
src/idl/dustem_fit_intensity_mbb_example.pro
... | ... | @@ -3,6 +3,7 @@ PRO dustem_fit_intensity_mbb_example,model=model $ |
3 | 3 | ,Nitermax=Nitermax $ |
4 | 4 | ,postscript=postscript $ |
5 | 5 | ,fits_save=fits_save $ |
6 | + ,noobj=noobj $ | |
6 | 7 | ,help=help $ |
7 | 8 | ,wait=wait $ |
8 | 9 | ,verbose=verbose |
... | ... | @@ -53,8 +54,7 @@ PRO dustem_fit_intensity_mbb_example,model=model $ |
53 | 54 | ; sed_file = string naming the path to text file in .xcat format that |
54 | 55 | ; describes the observational SED. If not set, the file |
55 | 56 | ; 'Data/EXAMPLE_OBSDATA/example_SED_1.xcat' is used. |
56 | -; postscript = if set, final plot is saved as postscript in the | |
57 | -; current working directory | |
57 | +; postscript = if set, final plot is saved as postscript | |
58 | 58 | ; Nitermax = maximum number of fit iterations. Default is 5. |
59 | 59 | ; fits_save = if set, save the fit results in a binary |
60 | 60 | ; FITS file. |
... | ... | @@ -62,6 +62,7 @@ PRO dustem_fit_intensity_mbb_example,model=model $ |
62 | 62 | ; wait = if set, wait this many seconds between each step of |
63 | 63 | ; the code (for illustration purposes) |
64 | 64 | ; verbose = if set, subroutines will run in verbose mode |
65 | +; noobj = if set, runs with no object graphics | |
65 | 66 | ; |
66 | 67 | ; COMMON BLOCKS: |
67 | 68 | ; None |
... | ... | @@ -164,7 +165,7 @@ end |
164 | 165 | dustem_init,model=use_model,polarization=use_polarization |
165 | 166 | !dustem_nocatch=1 |
166 | 167 | !dustem_verbose=use_verbose |
167 | -;!dustem_show_plot=1 | |
168 | +IF keyword_set(noobj) THEN !dustem_noobj=1 | |
168 | 169 | |
169 | 170 | |
170 | 171 | ;=== READ EXAMPLE SED DATA |
... | ... | @@ -224,11 +225,13 @@ ENDIF |
224 | 225 | ;=== MAKE THE FINAL PLOT |
225 | 226 | IF keyword_set(postscript) THEN BEGIN |
226 | 227 | ;dir_ps='./' |
228 | + mydevice=!d.name | |
227 | 229 | set_plot,'PS' |
228 | 230 | ;ps_file=dir_ps+postscript |
229 | 231 | ps_file=postscript |
230 | 232 | device,filename=ps_file,/color |
231 | -ENDIF | |
233 | + ENDIF | |
234 | + | |
232 | 235 | IF !dustem_noobj THEN BEGIN |
233 | 236 | dustemwrap_plot_noobj,*(*!dustem_fit).CURRENT_PARAM_VALUES,st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' |
234 | 237 | ENDIF ELSE BEGIN |
... | ... | @@ -236,8 +239,8 @@ ENDIF ELSE BEGIN |
236 | 239 | ENDELSE |
237 | 240 | |
238 | 241 | IF keyword_set(postscript) THEN BEGIN |
239 | - device,/close | |
240 | 242 | set_plot,'X' |
243 | + set_plot,mydevice | |
241 | 244 | message,'Wrote '+ps_file,/info |
242 | 245 | ENDIF |
243 | 246 | ... | ... |
src/idl/dustem_fit_polarization_example.pro
... | ... | @@ -4,6 +4,7 @@ PRO dustem_fit_polarization_example,model=model $ |
4 | 4 | ,postscript=postscript $ |
5 | 5 | ,fits_save=fits_save $ |
6 | 6 | ,help=help $ |
7 | + ,noobj=noobj $ | |
7 | 8 | ,wait=wait $ |
8 | 9 | ,verbose=verbose |
9 | 10 | ;+ |
... | ... | @@ -41,10 +42,9 @@ PRO dustem_fit_polarization_example,model=model $ |
41 | 42 | ; sed_file = string naming the path to text file in .xcat format that |
42 | 43 | ; describes the observational SED. If not set, the file |
43 | 44 | ; 'Data/EXAMPLE_OBSDATA/example_SED_3.xcat' is used. |
44 | -; postscript = if set, final plot is saved as postscript in the | |
45 | -; current working directory | |
45 | +; postscript = if set, final plot is saved as postscript file | |
46 | 46 | ; Nitermax = maximum number of fit iterations. Default is 5. |
47 | -; fits_save = if set, saves results in a fits file, | |
47 | +; fits_save = if set, saves results in a FITS file. | |
48 | 48 | ; help = if set, print this help |
49 | 49 | ; wait = if set, wait this many seconds between each step of |
50 | 50 | ; the code (for illustration purposes) |
... | ... | @@ -141,6 +141,7 @@ dustem_init,model=use_model,pol=use_polarization |
141 | 141 | !dustem_verbose=1 |
142 | 142 | ;!dustem_show_plot=1 |
143 | 143 | !dustem_nocatch=1 |
144 | +IF keyword_set(noobj) THEN !dustem_noobj=1 | |
144 | 145 | |
145 | 146 | ;=== READ EXAMPLE SED DATA |
146 | 147 | dir=!dustem_wrap_soft_dir+'/Data/EXAMPLE_OBSDATA/' |
... | ... | @@ -189,9 +190,11 @@ end |
189 | 190 | |
190 | 191 | ;=== MAKE THE FINAL PLOT |
191 | 192 | IF keyword_set(postscript) THEN BEGIN |
192 | - dir_ps='./' | |
193 | +; dir_ps='./' | |
194 | + mydevice=!d.name | |
193 | 195 | set_plot,'PS' |
194 | - ps_file=dir_ps+postscript | |
196 | +; ps_file=dir_ps+postscript | |
197 | + ps_file=postscript | |
195 | 198 | device,filename=ps_file,/color |
196 | 199 | ENDIF |
197 | 200 | |
... | ... | @@ -202,8 +205,8 @@ ENDIF ELSE BEGIN |
202 | 205 | ENDELSE |
203 | 206 | |
204 | 207 | IF keyword_set(postscript) THEN BEGIN |
205 | - set_plot,'X' | |
206 | 208 | device,/close |
209 | + set_plot,mydevice | |
207 | 210 | message,'Wrote '+ps_file,/info |
208 | 211 | ENDIF |
209 | 212 | |
... | ... | @@ -237,11 +240,9 @@ IF keyword_set(fits_save) THEN BEGIN |
237 | 240 | end |
238 | 241 | ENDIF |
239 | 242 | |
240 | -message,'Finished dustem_polarization_example',/info | |
241 | - | |
242 | -;stop | |
243 | 243 | |
244 | 244 | the_end: |
245 | +message,'Finished dustem_polarization_example',/info | |
245 | 246 | |
246 | 247 | END |
247 | 248 | ... | ... |
src/idl/dustem_fit_sed_ext_pol_example.pro
... | ... | @@ -3,6 +3,7 @@ PRO dustem_fit_sed_ext_pol_example,model=model $ |
3 | 3 | ,ext_file=ext_file $ |
4 | 4 | ,Nitermax=Nitermax $ |
5 | 5 | ,fits_save=fits_save $ |
6 | + ,postscript=postscript $ | |
6 | 7 | ,wait=wait $ |
7 | 8 | ,noobj=noobj $ |
8 | 9 | ,help=help $ |
... | ... | @@ -22,7 +23,7 @@ PRO dustem_fit_sed_ext_pol_example,model=model $ |
22 | 23 | ; DustEMWrap, Distributed, High-Level, User Example |
23 | 24 | ; |
24 | 25 | ; CALLING SEQUENCE: |
25 | -; dustem_fit_sed_ext_pol_example[,model=][sed_file=][ext_file=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
26 | +; dustem_fit_sed_ext_pol_example[,model=][sed_file=][ext_file=][postscript=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
26 | 27 | ; |
27 | 28 | ; INPUTS: |
28 | 29 | ; None |
... | ... | @@ -46,6 +47,7 @@ PRO dustem_fit_sed_ext_pol_example,model=model $ |
46 | 47 | ; ext_file = string naming the path to text file in .xcat format that |
47 | 48 | ; describes the observational extinction SED. If not set, the file |
48 | 49 | ; 'Data/EXAMPLE_OBSDATA/Mathis90Fitz99_DISM_NH20.xcat' is used. |
50 | +; postscript = if set, final plot is saved as postscript file | |
49 | 51 | ; Nitermax = maximum number of fit iterations. Default is 5. |
50 | 52 | ; fits_save = if set, save the fit results in a binary |
51 | 53 | ; FITS file. The code then restore this file and plots |
... | ... | @@ -269,9 +271,10 @@ end |
269 | 271 | |
270 | 272 | ;=== MAKE THE FINAL PLOT |
271 | 273 | IF keyword_set(postscript) THEN BEGIN |
272 | - dir_ps='./' | |
274 | +; dir_ps='./' | |
275 | + mydevice=!d.name | |
273 | 276 | set_plot,'PS' |
274 | - ps_file=dir_ps+postscript | |
277 | + ps_file=postscript | |
275 | 278 | device,filename=ps_file,/color |
276 | 279 | ENDIF |
277 | 280 | |
... | ... | @@ -282,8 +285,8 @@ ENDIF ELSE BEGIN |
282 | 285 | ENDELSE |
283 | 286 | |
284 | 287 | IF keyword_set(postscript) THEN BEGIN |
285 | - set_plot,'X' | |
286 | 288 | device,/close |
289 | + set_plot,mydevice | |
287 | 290 | message,'Wrote '+ps_file,/info |
288 | 291 | ENDIF |
289 | 292 | ... | ... |
src/idl/dustem_fit_sed_ext_stokesi_example.pro
... | ... | @@ -2,6 +2,7 @@ PRO dustem_fit_sed_ext_stokesi_example,model=model $ |
2 | 2 | ,sed_file=sed_file $ |
3 | 3 | ,ext_file=ext_file $ |
4 | 4 | ,Nitermax=Nitermax $ |
5 | + ,postscript=postscript $ | |
5 | 6 | ,fits_save=fits_save $ |
6 | 7 | ,wait=wait $ |
7 | 8 | ,noobj=noobj $ |
... | ... | @@ -22,7 +23,7 @@ PRO dustem_fit_sed_ext_stokesi_example,model=model $ |
22 | 23 | ; DustEMWrap, Distributed, High-Level, User Example |
23 | 24 | ; |
24 | 25 | ; CALLING SEQUENCE: |
25 | -; dustem_fit_sed_ext_stokesi_example[,model=][sed_file=][ext_file=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
26 | +; dustem_fit_sed_ext_stokesi_example[,model=][sed_file=][ext_file=][postscript=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
26 | 27 | ; |
27 | 28 | ; INPUTS: |
28 | 29 | ; None |
... | ... | @@ -52,9 +53,9 @@ PRO dustem_fit_sed_ext_stokesi_example,model=model $ |
52 | 53 | ; used to identify the wavelength range, and the dust model |
53 | 54 | ; is used to generate the corresponding extinction. |
54 | 55 | ; Nitermax = maximum number of fit iterations. Default is 5. |
56 | +; postscript = if set, final plot is saved as postscript file | |
55 | 57 | ; fits_save = if set, save the fit results in a binary |
56 | -; FITS file. The code then restore this file and plots | |
57 | -; the results using the saved results information. | |
58 | +; FITS file. | |
58 | 59 | ; help = if set, print this help |
59 | 60 | ; wait = if set, wait this many seconds between each step of |
60 | 61 | ; the code (for illustration purposes) |
... | ... | @@ -248,9 +249,10 @@ end |
248 | 249 | |
249 | 250 | ;=== MAKE THE FINAL PLOT |
250 | 251 | IF keyword_set(postscript) THEN BEGIN |
251 | - dir_ps='./' | |
252 | +; dir_ps='./' | |
253 | + mydevice=!d.name | |
252 | 254 | set_plot,'PS' |
253 | - ps_file=dir_ps+postscript | |
255 | + ps_file=postscript | |
254 | 256 | device,filename=ps_file,/color |
255 | 257 | ENDIF |
256 | 258 | |
... | ... | @@ -261,8 +263,8 @@ ENDIF ELSE BEGIN |
261 | 263 | ENDELSE |
262 | 264 | |
263 | 265 | IF keyword_set(postscript) THEN BEGIN |
264 | - set_plot,'X' | |
265 | 266 | device,/close |
267 | + set_plot,mydevice | |
266 | 268 | message,'Wrote '+ps_file,/info |
267 | 269 | ENDIF |
268 | 270 | ... | ... |
src/idl/dustem_fit_spectro_example.pro
1 | 1 | PRO dustem_fit_spectro_example,model=model $ |
2 | 2 | ,sed_file=sed_file $ |
3 | + ,postscript=postscript $ | |
3 | 4 | ,Nitermax=Nitermax $ |
4 | 5 | ,fits_save=fits_save $ |
5 | 6 | ,ucfactor=ucfactor $ |
... | ... | @@ -13,9 +14,8 @@ PRO dustem_fit_spectro_example,model=model $ |
13 | 14 | ; dustem_fit_spectro_example |
14 | 15 | ; |
15 | 16 | ; PURPOSE: |
16 | -; This routine is an example of how to fit an observational | |
17 | -; spectrometer data in emission (StokesI) with DustEM and | |
18 | -; DustEMWrap. | |
17 | +; This routine is an example of how to fit spectrometer data in | |
18 | +; emission (StokesI only) with DustEM and DustEMWrap. | |
19 | 19 | ; |
20 | 20 | ; See the DustEMWrap User Guide for more information. |
21 | 21 | ; |
... | ... | @@ -23,7 +23,7 @@ PRO dustem_fit_spectro_example,model=model $ |
23 | 23 | ; DustEMWrap, Distributed, High-Level, User Example |
24 | 24 | ; |
25 | 25 | ; CALLING SEQUENCE: |
26 | -; dustem_fit_spectro_example[,model=][sed_file=][ext_file=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
26 | +; dustem_fit_spectro_example[,model=][sed_file=][ext_file=][postscript=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
27 | 27 | ; |
28 | 28 | ; INPUTS: |
29 | 29 | ; None |
... | ... | @@ -49,6 +49,7 @@ PRO dustem_fit_spectro_example,model=model $ |
49 | 49 | ; spectrometer data. Default is 1. |
50 | 50 | ; fits_save = if set, save the fit results in a binary |
51 | 51 | ; FITS file. |
52 | +; postscript = if set, final plot is saved as postscript file | |
52 | 53 | ; help = if set, print this help |
53 | 54 | ; wait = if set, wait this many seconds between each step of |
54 | 55 | ; the code (for illustration purposes) |
... | ... | @@ -185,6 +186,7 @@ tol=1.e-10 ;fit tolerance |
185 | 186 | xr_m = [1.,5e5] |
186 | 187 | yr_m = [5e-8,1.00e6] |
187 | 188 | tit_m='FIT SPECTRO EXAMPLE' ; plot title |
189 | +tit=tit_m | |
188 | 190 | |
189 | 191 | ;=== RUN THE FIT |
190 | 192 | t1=systime(0,/sec) |
... | ... | @@ -200,6 +202,29 @@ if keyword_set(wait) then begin |
200 | 202 | wait,wait |
201 | 203 | end |
202 | 204 | |
205 | +;=== MAKE THE FINAL PLOT | |
206 | +IF keyword_set(postscript) THEN BEGIN | |
207 | +; dir_ps='./' | |
208 | + mydevice=!d.name | |
209 | + set_plot,'PS' | |
210 | +; ps_file=dir_ps+postscript | |
211 | + ps_file=postscript | |
212 | + device,filename=ps_file,/color | |
213 | +ENDIF | |
214 | + | |
215 | +;stop | |
216 | + | |
217 | +IF !dustem_noobj THEN BEGIN | |
218 | + dustemwrap_plot_noobj,*(*!dustem_fit).CURRENT_PARAM_VALUES,st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
219 | + ENDIF ELSE BEGIN | |
220 | + dustemwrap_plot,*(*!dustem_fit).CURRENT_PARAM_VALUES,st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
221 | +ENDELSE | |
222 | + | |
223 | +IF keyword_set(postscript) THEN BEGIN | |
224 | + device,/close | |
225 | + set_plot,mydevice | |
226 | + message,'Wrote '+ps_file,/info | |
227 | +ENDIF | |
203 | 228 | |
204 | 229 | |
205 | 230 | IF keyword_set(fits_save) THEN BEGIN | ... | ... |
src/idl/dustem_fitsio_example.pro
1 | -PRO dustem_fitsio_example,help=help | |
1 | +PRO dustem_fitsio_example,help=help,nostop=nostop | |
2 | 2 | |
3 | 3 | ;+ |
4 | 4 | ; NAME: |
5 | 5 | ; dustem_fitsio_example |
6 | 6 | ; |
7 | 7 | ; PURPOSE: |
8 | -; Testing the save/restore FITS files | |
8 | +; Testing the save/restore of FITS files | |
9 | 9 | ; |
10 | 10 | ; CATEGORY: |
11 | 11 | ; DustEMWrap, Distributed, Low-Level, Development |
... | ... | @@ -24,6 +24,7 @@ PRO dustem_fitsio_example,help=help |
24 | 24 | ; |
25 | 25 | ; ACCEPTED KEY-WORDS: |
26 | 26 | ; help = print this help |
27 | +; nostop = if set, do not stop between code blocks | |
27 | 28 | ; |
28 | 29 | ; COMMON BLOCKS: |
29 | 30 | ; None |
... | ... | @@ -50,32 +51,34 @@ if keyword_set(help) then begin |
50 | 51 | goto,the_end |
51 | 52 | END |
52 | 53 | |
54 | +goto,spectro | |
53 | 55 | |
54 | -dustem_fit_intensity_example,Nitermax=2,fits_save='/tmp/example_fit_intensity_only.fits' | |
56 | +stokesi: | |
57 | +dustem_fit_intensity_example,Nitermax=10,fits_save='/tmp/example_fit_intensity_only.fits' | |
55 | 58 | ;exit/.reset |
56 | 59 | dustem_read_fits_table,filename='/tmp/example_fit_intensity_only.fits',dustem_st=dustem_spectra_st |
57 | - | |
58 | 60 | yr=[1.00e-4,1.00E2] ; y-axis limits |
59 | 61 | xr=[1.00E0,6.00e4] ; x-axis limits |
60 | 62 | tit='FIT INTENSITY EXAMPLE' ; plot title |
61 | 63 | ytit=textoidl('I_\nu (MJy/sr) for N_H=10^{20} H/cm^2') ; y-axis title |
62 | 64 | xtit=textoidl('\lambda (\mum)') ; x-axis title |
63 | 65 | res=*(*!dustem_fit).CURRENT_PARAM_VALUES |
64 | -dustemwrap_plot,res,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
66 | +dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
65 | 67 | |
66 | 68 | |
67 | -stop | |
69 | +if not keyword_set(nostop) then stop | |
70 | +spectro: | |
68 | 71 | dustem_fit_spectro_example,Nitermax=2,fits_save='/tmp/example_fit_spectro.fits' |
69 | 72 | ;exit/.reset |
70 | -dustem_read_fits_table,filename='/tmp/example_fit_spectro_only.fits',dustem_st=dustem_spectra_st | |
73 | +dustem_read_fits_table,filename='/tmp/example_fit_spectro.fits',dustem_st=dustem_spectra_st | |
71 | 74 | xr = [1.,5e5] |
72 | 75 | yr = [5e-8,1.00e6] |
73 | 76 | tit='FIT SPECTRO EXAMPLE' ; plot title |
74 | 77 | res=*(*!dustem_fit).CURRENT_PARAM_VALUES |
75 | -dustemwrap_plot,res,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
78 | +dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
76 | 79 | |
77 | 80 | |
78 | -stop | |
81 | +if not keyword_set(nostop) then stop | |
79 | 82 | |
80 | 83 | dustem_fit_intensity_mbb_example,Nitermax=2,fits_save='/tmp/example_fit_mbb.fits' |
81 | 84 | ;exit/.reset |
... | ... | @@ -86,10 +89,10 @@ tit='MBB FIT EXAMPLE' ; plot title |
86 | 89 | ytit=textoidl('I_\nu (MJy/sr) for N_H=10^{20} H/cm^2') ; y-axis title |
87 | 90 | xtit=textoidl('\lambda (\mum)') ; x-axis title |
88 | 91 | res=*(*!dustem_fit).CURRENT_PARAM_VALUES |
89 | -dustemwrap_plot,res,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
92 | +dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
90 | 93 | |
91 | 94 | |
92 | -stop | |
95 | +if not keyword_set(nostop) then stop | |
93 | 96 | dustem_fit_polarization_example,Nitermax=2,fits_save='/tmp/example_fit_polar.fits' |
94 | 97 | ;exit/.reset |
95 | 98 | dustem_read_fits_table,filename='/tmp/example_fit_polar.fits',dustem_st=dustem_spectra_st |
... | ... | @@ -97,10 +100,10 @@ yr=[1.00e-4,1.00E2] ; y-axis limits |
97 | 100 | xr=[1.00E0,6.00e4] ; x-axis limits |
98 | 101 | tit='FIT POLARISATION SED EXAMPLE' ; plot title |
99 | 102 | res=*(*!dustem_fit).CURRENT_PARAM_VALUES |
100 | -dustemwrap_plot,res,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
103 | +dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
101 | 104 | |
102 | 105 | |
103 | -stop | |
106 | +if not keyword_set(nostop) then stop | |
104 | 107 | dustem_fit_ext_example,Nitermax=2,fits_save='/tmp/example_fit_ext.fits' |
105 | 108 | ;exit/.reset |
106 | 109 | dustem_read_fits_table,filename='/tmp/example_fit_ext.fits',dustem_st=dustem_spectra_st |
... | ... | @@ -108,10 +111,10 @@ xr=[0.01,30] |
108 | 111 | yr=[1.00E-10,10] |
109 | 112 | tit='FIT EXTINCTION EXAMPLE' ; plot title |
110 | 113 | res=*(*!dustem_fit).CURRENT_PARAM_VALUES |
111 | -dustemwrap_plot,res,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
114 | +dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
112 | 115 | |
113 | 116 | |
114 | -stop | |
117 | +if not keyword_set(nostop) then stop | |
115 | 118 | dustem_fit_ext_pol_example,Nitermax=2,fits_save='/tmp/example_fit_ext_polar.fits' |
116 | 119 | ;exit/.reset |
117 | 120 | dustem_read_fits_table,filename='/tmp/example_fit_ext_polar.fits',dustem_st=dustem_spectra_st |
... | ... | @@ -119,9 +122,9 @@ xr=[0.01,30] |
119 | 122 | yr=[1.00E-10,50] |
120 | 123 | tit='FIT POLARISED EXTINCTION EXAMPLE' ; plot title |
121 | 124 | res=*(*!dustem_fit).CURRENT_PARAM_VALUES |
122 | -dustemwrap_plot,res,st=dustem_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
125 | +dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
123 | 126 | |
124 | -stop | |
127 | +if not keyword_set(nostop) then stop | |
125 | 128 | dustem_fit_sed_ext_stokesi_example,Nitermax=2,fits_save='/tmp/example_fit_sed_ext_stokesi.fits' |
126 | 129 | ;exit/.reset |
127 | 130 | dustem_read_fits_table,filename='/tmp/example_fit_sed_ext_stokesi.fits',dustem_st=dustem_spectra_st |
... | ... | @@ -133,10 +136,10 @@ tit_m='Spectral Energy Distribution' |
133 | 136 | tit_x='Dust Optical Depth' |
134 | 137 | tit='FIT STOKESI EXTINCTION AND EMISSION EXAMPLE' ; plot title |
135 | 138 | res=*(*!dustem_fit).CURRENT_PARAM_VALUES |
136 | -dustemwrap_plot,res,st=dustem_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)' | |
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)' | |
137 | 140 | |
138 | 141 | |
139 | -stop | |
142 | +if not keyword_set(nostop) then stop | |
140 | 143 | dustem_fit_sed_ext_pol_example,Nitermax=2,fits_save='/tmp/example_fit_sed_ext_polar.fits' |
141 | 144 | ;exit/.reset |
142 | 145 | dustem_read_fits_table,filename='/tmp/example_fit_sed_ext_polar.fits',dustem_st=dustem_spectra_st |
... | ... | @@ -148,9 +151,9 @@ tit_m='Spectral Energy Distribution' |
148 | 151 | tit_x='Dust Optical Depth' |
149 | 152 | tit='FIT POLARISED EXTINCTION AND EMISSION EXAMPLE' ; plot title |
150 | 153 | res=*(*!dustem_fit).CURRENT_PARAM_VALUES |
151 | -dustemwrap_plot,res,st=dustem_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)' | |
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)' | |
152 | 155 | |
153 | -stop | |
156 | +if not keyword_set(nostop) then stop | |
154 | 157 | dustem_myisrf_example,Nitermax=2,fits_save='/tmp/example_fit_isrf.fits' |
155 | 158 | ;exit/.reset |
156 | 159 | dustem_read_fits_table,filename='/tmp/example_fit_isrf.fits',dustem_st=dustem_spectra_st |
... | ... | @@ -159,18 +162,20 @@ yr_m = [5e-8,1.00e6] |
159 | 162 | tit_m='Spectral Energy Distribution' |
160 | 163 | tit='FIT WITH USER ISRF EXAMPLE' ; plot title |
161 | 164 | res=*(*!dustem_fit).CURRENT_PARAM_VALUES |
162 | -dustemwrap_plot,res,st=dustem_st,xr_m=xr_m,/xstyle,yr_m=yr_m,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
163 | - | |
164 | - | |
165 | - | |
166 | - | |
167 | - | |
168 | -;=== fails when run with only the minimal dustemwrap installed (stellar . txt file is missing) | |
169 | -dustem_stellarpopisrf_example,Nitermax=3 | |
170 | - | |
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)' | |
171 | 166 | |
172 | 167 | |
168 | +if not keyword_set(nostop) then stop | |
169 | +dustem_stellarpopisrf_example,Nitermax=3,fits_save='/tmp/example_fit_stellarpop.fits' | |
170 | +;exit/.reset | |
171 | +dustem_read_fits_table,filename='/tmp/example_fit_stellarpop.fits',dustem_st=dustem_spectra_st | |
172 | +xr_m = [1.,5e5] | |
173 | +yr_m = [5e-8,1.00e6] | |
174 | +tit_m='Spectral Energy Distribution' | |
175 | +tit='FIT WITH STELLARPOP ISRF EXAMPLE' ; plot title | |
176 | +res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
177 | +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)' | |
173 | 178 | |
174 | -; END LIST OF TOP-LEVEL ROUTINES | |
179 | +the_end: | |
175 | 180 | |
176 | 181 | end | ... | ... |
src/idl/dustem_make_polarization_ext_example.pro
... | ... | @@ -11,7 +11,8 @@ PRO dustem_make_polarization_ext_example,model=model $ |
11 | 11 | ; dustem_make_polarization_ext_example |
12 | 12 | ; |
13 | 13 | ; PURPOSE: |
14 | -; This is an example of how to generate an extinction curve using DustEMWrap. | |
14 | +; This is an example of how to generate an extinction curve (Stokes | |
15 | +; IQU) using one of the physical dust models in DustEMWrap. | |
15 | 16 | ; It is meant to be an example to follow when writing your own |
16 | 17 | ; programs using DustEMWrap |
17 | 18 | ; |
... | ... | @@ -124,7 +125,7 @@ ext.SIGEXTQU=ext.EXT_I/1000. |
124 | 125 | |
125 | 126 | ;=== Set which model parameters to use for the EXT, this will depend |
126 | 127 | ;=== on the selected dust model. For model parameters not specified |
127 | -;=== here, the default Dustem fortran values will be used | |
128 | +;=== here, the default DustEM fortran values will be used | |
128 | 129 | pd = [ $ |
129 | 130 | '(*!dustem_params).grains(0).mdust_o_mh', $ ;PAH0_MC10 mass fraction |
130 | 131 | '(*!dustem_params).grains(1).mdust_o_mh', $ ;amCBE_0.3333x mass fraction |
... | ... | @@ -173,11 +174,12 @@ ext=dustem_fill_ext_dependent_columns(ext) |
173 | 174 | write_xcat,ext,use_outfile |
174 | 175 | message,'Wrote '+use_outfile,/continue |
175 | 176 | |
176 | -;======== move the file to the Data/EXAMPLE_OBSDATA/ subdirectory | |
177 | -;filename_final=!dustem_wrap_soft_dir+'/Data/EXAMPLE_OBSDATA/my_example_EXT_###.xcat' | |
177 | +;======== example of how to move the file to the Data/EXAMPLE_OBSDATA/ subdirectory | |
178 | +;filename_final=!dustem_wrap_soft_dir+'/Data/EXAMPLE_OBSDATA/my_example_EXT_G17MDL_D.xcat' | |
178 | 179 | ;str='cp '+use_outfile+' '+filename_final |
179 | 180 | ;message,'Do '+str+' to make change permanent',/continue |
180 | 181 | |
181 | 182 | the_end: |
183 | +message,'Finished dustem_make_polarization_ext_example',/info | |
182 | 184 | |
183 | 185 | END | ... | ... |
src/idl/dustem_make_polarization_sed_example.pro
... | ... | @@ -9,7 +9,7 @@ PRO dustem_make_polarization_sed_example,model=model $ |
9 | 9 | ; dustem_make_polarization_sed_example |
10 | 10 | ; |
11 | 11 | ; PURPOSE: |
12 | -; This is an example of how to generate an SED using DustEMWrap. | |
12 | +; This is an example of how to generate an SED (StokesIQU) using DustEMWrap. | |
13 | 13 | ; It is meant to be an example to follow when writing your own |
14 | 14 | ; programs using DustEMWrap |
15 | 15 | ; |
... | ... | @@ -173,5 +173,6 @@ message,'Wrote '+use_outfile,/continue |
173 | 173 | ;message,'Do '+str+' to make change permanent',/continue |
174 | 174 | |
175 | 175 | the_end: |
176 | +message,'Finished dustem_make_polarization_sed_example',/info | |
176 | 177 | |
177 | 178 | END | ... | ... |
src/idl/dustem_myisrf_example.pro
... | ... | @@ -49,12 +49,10 @@ PRO dustem_myisrf_example,model=model $ |
49 | 49 | ; describes the observational SED. If not set, the file |
50 | 50 | ; 'Data/EXAMPLE_OBSDATA/example_SED_1.xcat' is used. |
51 | 51 | ; isrf_file = text file describing ISRF |
52 | -; postscript = if set, final plot is saved as postscript in the | |
53 | -; current working directory | |
52 | +; postscript = if set, final plot is saved as postscript file | |
54 | 53 | ; Nitermax = maximum number of fit iterations. Default is 5. |
55 | 54 | ; fits_save = if set, save the fit results in a binary |
56 | -; FITS file. The code then restore this file and plots | |
57 | -; the results using the saved results information. | |
55 | +; FITS file. | |
58 | 56 | ; help = if set, print this help |
59 | 57 | ; wait = if set, wait this many seconds between each step of |
60 | 58 | ; the code (for illustration purposes) |
... | ... | @@ -187,7 +185,7 @@ endif |
187 | 185 | ;=== PLOT AS A SANITY CHECK |
188 | 186 | xtit=textoidl('\lambda (\mum)') |
189 | 187 | ytit=textoidl('log ISRF [4 \pi I_\nu (erg/cm^2/s/Hz)]') |
190 | -tit='DUSTEM MYISRF EXAMPLE' | |
188 | +tit='MYISRF EXAMPLE' | |
191 | 189 | yr=[min(st_model.isrf.isrf) < min(myisrf),5.*(max(st_model.isrf.isrf)>max(myisrf))] |
192 | 190 | xr=[0.001,1e6] |
193 | 191 | window,use_window,xs=600,ys=400,tit=tit & use_window=use_window+2 |
... | ... | @@ -242,7 +240,7 @@ IF keyword_set(Nitermax) THEN use_Nitermax=Nitermax |
242 | 240 | |
243 | 241 | xr = [1.,5e5] |
244 | 242 | yr = [5e-8,1.00e6] |
245 | -tit='MYISRF EXAMPLE' | |
243 | +tit='FIT WITH MYISRF EXAMPLE' | |
246 | 244 | ytit=textoidl('I_\nu (MJy/sr) for N_H=10^{20} H/cm^2') |
247 | 245 | xtit=textoidl('\lambda (\mum)') |
248 | 246 | |
... | ... | @@ -260,12 +258,11 @@ if keyword_set(wait) then begin |
260 | 258 | wait,wait |
261 | 259 | end |
262 | 260 | |
263 | - | |
264 | 261 | ;=== MAKE THE FINAL PLOT |
265 | 262 | IF keyword_set(postscript) THEN BEGIN |
266 | - dir_ps='./' | |
267 | - set_plot,'PS' | |
268 | - ps_file=dir_ps+postscript | |
263 | + mydevice=!d.name | |
264 | + set_plot,'PS' | |
265 | + ps_file=postscript | |
269 | 266 | device,filename=ps_file,/color |
270 | 267 | ENDIF |
271 | 268 | |
... | ... | @@ -276,8 +273,8 @@ IF !dustem_noobj THEN BEGIN |
276 | 273 | ENDELSE |
277 | 274 | |
278 | 275 | IF keyword_set(postscript) THEN BEGIN |
279 | - set_plot,'X' | |
280 | 276 | device,/close |
277 | + set_plot,mydevice | |
281 | 278 | message,'Wrote '+ps_file,/info |
282 | 279 | ENDIF |
283 | 280 | |
... | ... | @@ -308,9 +305,9 @@ IF keyword_set(fits_save) THEN BEGIN |
308 | 305 | ENDIF |
309 | 306 | ENDIF |
310 | 307 | |
311 | -message,'Finished dustem_myisrf_example',/info | |
312 | 308 | |
313 | 309 | |
314 | 310 | the_end: |
311 | +message,'Finished dustem_myisrf_example',/info | |
315 | 312 | |
316 | 313 | END | ... | ... |
src/idl/dustem_run_example.pro
src/idl/dustem_stellarpopisrf_example.pro
... | ... | @@ -2,7 +2,8 @@ PRO dustem_stellarpopisrf_example,model=model $ |
2 | 2 | ,sed_file=sed_file $ |
3 | 3 | ,isrf_file=isrf_file $ |
4 | 4 | ,Nitermax=Nitermax $ |
5 | - ,fits_save_and_restore=fits_save_and_restore $ | |
5 | + ,postscript=postscript $ | |
6 | + ,fits_save=fits_save $ | |
6 | 7 | ,wait=wait $ |
7 | 8 | ,noobj=noobj $ |
8 | 9 | ,verbose=verbose $ |
... | ... | @@ -30,7 +31,7 @@ PRO dustem_stellarpopisrf_example,model=model $ |
30 | 31 | ; DustEMWrap, Distributed, High-Level, User Example |
31 | 32 | ; |
32 | 33 | ; CALLING SEQUENCE: |
33 | -; dustem_fit_stellarpopisrf_example[,model=][sed_file=][isrf_file=][,postscript=][,Nitermax=][,fits_save_and_restore=][,/help,/wait,/verbose] | |
34 | +; dustem_fit_stellarpopisrf_example[,model=][sed_file=][isrf_file=][,postscript=][,Nitermax=][,fits_save=][,/help,/wait,/verbose] | |
34 | 35 | ; |
35 | 36 | ; INPUTS: |
36 | 37 | ; None |
... | ... | @@ -52,12 +53,11 @@ PRO dustem_stellarpopisrf_example,model=model $ |
52 | 53 | ; describes the observational SED. If not set, the file |
53 | 54 | ; 'Data/EXAMPLE_OBSDATA/example_SED_2.xcat' is used. |
54 | 55 | ; isrf_file = text file describing ISRF |
55 | -; postscript = if set, final plot is saved as postscript in the | |
56 | -; current working directory | |
56 | +; postscript = if set, final plot is saved as postscript file | |
57 | 57 | ; Nitermax = maximum number of fit iterations. Default is 5. |
58 | -; fits_save_and_restore = if set, save the fit results in a binary | |
59 | -; FITS file. The code then restore this file and plots | |
60 | -; the results using the saved results information. | |
58 | +; fits_save = if set, save the fit results in a binary | |
59 | +; FITS file. | |
60 | +; postscript = if set, final plot is saved as postscript file | |
61 | 61 | ; help = if set, print this help |
62 | 62 | ; wait = if set, wait this many seconds between each step of |
63 | 63 | ; the code (for illustration purposes) |
... | ... | @@ -76,10 +76,9 @@ PRO dustem_stellarpopisrf_example,model=model $ |
76 | 76 | ; |
77 | 77 | ; PROCEDURES AND SUBROUTINES USED: |
78 | 78 | ; |
79 | -; | |
80 | 79 | ; EXAMPLES |
81 | 80 | ; dustem_fit_stellarpopisrf_example |
82 | -; dustem_fit_stellarpopisrf_example,Nitermax=10,fits_save_and_restore='/tmp/mysavefile.fits' | |
81 | +; dustem_fit_stellarpopisrf_example,Nitermax=10,fits_save='/tmp/mysavefile.fits' | |
83 | 82 | ; dustem_fit_stellarpopisrf_example,model='DBP90',isrf_file='./myisrf_habing.dat',sed_file='./mysed.xcat' |
84 | 83 | ; |
85 | 84 | ; MODIFICATION HISTORY: |
... | ... | @@ -117,8 +116,8 @@ dustem_define_la_common |
117 | 116 | |
118 | 117 | ;;=============================== |
119 | 118 | ;; example parameter initialisation 1 |
120 | -;; Here we aim to fit the distance to a single O7V star | |
121 | -;; other ISRF contributions are fixed to ~zero | |
119 | +;; Here we attempt to fit the distance to a single O7V star | |
120 | +;; Other ISRF contributions are fixed to ~zero | |
122 | 121 | |
123 | 122 | pd = ['dustem_plugin_stellar_population_O7V3']; ;distance to O7V star |
124 | 123 | true_vals = [20] ; true distance to the star |
... | ... | @@ -174,11 +173,6 @@ dustem_init,model=use_model,polarization=use_polarization |
174 | 173 | !dustem_nocatch=1 |
175 | 174 | !dustem_verbose=1 |
176 | 175 | IF keyword_set(noobj) THEN !dustem_noobj=1 |
177 | -;; ;!dustem_dim=1 ; this option is to dim the stellar population ISRF with the current Dustem extinction | |
178 | -;; ;We're fitting total optical depths so the dimmed-ISRF scenario is a reasonable assumption. | |
179 | -;; ;Because of this the final parameter values are slightly lower than the initial (real) values. | |
180 | -;; ;But this is because the first run was not extinct with the current dustem extinction | |
181 | -;; ;since it comes prior to the dustem run. Meaning the first ISRF has to be extinct to see if the paramters are retrieved. | |
182 | 176 | |
183 | 177 | if keyword_set(isrf_file) then begin |
184 | 178 | message,'Setting ISRF component from file: '+isrf_file,/info |
... | ... | @@ -199,7 +193,6 @@ if keyword_set(wait) then begin |
199 | 193 | wait,wait |
200 | 194 | end |
201 | 195 | |
202 | - | |
203 | 196 | ;=== initializing IQU and associated errors to avoid problems when checking SED in dustem_set_data.pro |
204 | 197 | for i=4l,n_tags(sed)-1 do begin |
205 | 198 | sed.(i) = sed.sigmaii |
... | ... | @@ -215,7 +208,7 @@ sed.StokesI = dustem_compute_sed(true_vals,st=st) |
215 | 208 | sed.SigmaII = sed.StokesI*0.01 |
216 | 209 | |
217 | 210 | ;== SET THE OBSERVATIONAL STRUCTURE |
218 | -dustem_set_data, sed, sed | |
211 | +dustem_set_data, m_fit=sed, m_show=sed | |
219 | 212 | |
220 | 213 | |
221 | 214 | if keyword_set(wait) then begin |
... | ... | @@ -230,7 +223,7 @@ xr_m = [1.,5e5] |
230 | 223 | yr_m = [5e-8,1.00e6] |
231 | 224 | |
232 | 225 | |
233 | -tit='Spectral Energy Distribution' | |
226 | +tit='FIT WITH STELLAR POP ISRF EXAMPLE' | |
234 | 227 | ytit=textoidl('I_\nu (MJy/sr) for N_H=10^{20} H/cm^2') |
235 | 228 | xtit=textoidl('\lambda (\mum)') |
236 | 229 | ;Set show_plot to 0 to hide plot |
... | ... | @@ -251,33 +244,52 @@ if keyword_set(wait) then begin |
251 | 244 | end |
252 | 245 | |
253 | 246 | |
247 | +;=== MAKE THE FINAL PLOT | |
248 | +IF keyword_set(postscript) THEN BEGIN | |
249 | +; dir_ps='./' | |
250 | + mydevice=!d.name | |
251 | + set_plot,'PS' | |
252 | +; ps_file=dir_ps+postscript | |
253 | + ps_file=postscript | |
254 | + device,filename=ps_file,/color | |
255 | +ENDIF | |
256 | + | |
254 | 257 | IF !dustem_noobj THEN BEGIN |
255 | - dustemwrap_plot_noobj,*(*!dustem_fit).CURRENT_PARAM_VALUES,dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
258 | + dustemwrap_plot_noobj,*(*!dustem_fit).CURRENT_PARAM_VALUES,st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
256 | 259 | ENDIF ELSE BEGIN |
257 | - dustemwrap_plot,*(*!dustem_fit).CURRENT_PARAM_VALUES,dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
260 | + dustemwrap_plot,*(*!dustem_fit).CURRENT_PARAM_VALUES,st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
258 | 261 | ENDELSE |
259 | 262 | |
263 | + | |
264 | +IF keyword_set(postscript) THEN BEGIN | |
265 | + device,/close | |
266 | + set_plot,mydevice | |
267 | + message,'Wrote '+ps_file,/info | |
268 | +ENDIF | |
269 | + | |
270 | + | |
260 | 271 | if keyword_set(wait) then begin |
261 | 272 | message,'Made the plot of the final results',/info |
262 | 273 | wait,wait |
263 | 274 | end |
264 | 275 | |
265 | -IF keyword_set(fits_save_and_restore) THEN BEGIN | |
266 | - message,'Writing out results structure: '+fits_save_and_restore,/info | |
267 | - dustem_write_fits_table,filename=fits_save_and_restore,help=help | |
276 | +IF keyword_set(fits_save) THEN BEGIN | |
277 | + message,'Writing out results structure: '+fits_save,/info | |
278 | + dustem_write_fits_table,filename=fits_save,help=help | |
268 | 279 | ;=== At this point, you could erase all dustem system variables, or exit idl... all the |
269 | 280 | ;=== information needed to recover the results and remake the plots has been saved in the FITS table |
270 | - ;stop | |
271 | - dustem_read_fits_table,filename=fits_save_and_restore,dustem_st=dustem_spectra_st | |
272 | - ;==== plot result taken from the saved fits table | |
273 | - res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
274 | - IF !dustem_noobj THEN BEGIN | |
275 | - dustemwrap_plot_noobj,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
276 | - ENDIF ELSE BEGIN | |
277 | - dustemwrap_plot,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
278 | - ENDELSE | |
281 | + | |
282 | +;; moved the following to dustem_fitsio_example.pro | |
283 | + ;; dustem_read_fits_table,filename=fits_save,dustem_st=dustem_spectra_st | |
284 | + ;; ;==== plot result taken from the saved fits table | |
285 | + ;; res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
286 | + ;; IF !dustem_noobj THEN BEGIN | |
287 | + ;; dustemwrap_plot_noobj,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
288 | + ;; ENDIF ELSE BEGIN | |
289 | + ;; dustemwrap_plot,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
290 | + ;; ENDELSE | |
279 | 291 | IF keyword_set(wait) THEN BEGIN |
280 | - message,'Saved the results as FITS in the file: '+fits_save_and_restore+', and made a plot using the data in this file',/info | |
292 | + message,'Saved the results as FITS in the file: '+fits_save+', and made a plot using the data in this file',/info | |
281 | 293 | wait,wait |
282 | 294 | ENDIF |
283 | 295 | ENDIF | ... | ... |