Commit 6735604d4ea1d2dbd2cdb05370a4003f47a51eb9
1 parent
1f71e137
Exists in
master
making FITS read and write work for SED and EXT simultaneous fits
Showing
12 changed files
with
278 additions
and
373 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_and_restore=fits_save_and_restore $ | |
4 | + ,fits_save=fits_save $ | |
5 | 5 | ,wait=wait $ |
6 | 6 | ,noobj=noobj $ |
7 | 7 | ,help=help $ |
... | ... | @@ -21,7 +21,7 @@ PRO dustem_fit_ext_example,model=model $ |
21 | 21 | ; DustEMWrap, Distributed, High-Level, User Example |
22 | 22 | ; |
23 | 23 | ; CALLING SEQUENCE: |
24 | -; dustem_fit_ext_example[,model=][ext_file=][,Nitermax=][,fits_save_and_restore=][,/help,/wait,/verbose,/noobj] | |
24 | +; dustem_fit_ext_example[,model=][ext_file=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
25 | 25 | ; |
26 | 26 | ; INPUTS: |
27 | 27 | ; None |
... | ... | @@ -36,24 +36,14 @@ PRO dustem_fit_ext_example,model=model $ |
36 | 36 | ; Plots, results structure in binary FITS table format |
37 | 37 | ; |
38 | 38 | ; ACCEPTED KEY-WORDS: |
39 | -; model = specifies the interstellar dust mixture used by DustEM | |
40 | -; 'MC10' model from Compiegne et al 2010 | |
41 | -; 'DBP90' model from Desert et al 1990 | |
42 | -; 'DL01' model from Draine & Li 2001 | |
43 | -; 'WD01_RV5P5B' model from Weingartner & Draine 2002 with Rv=5.5 | |
44 | -; 'DL07' model from Draine & Li 2007 | |
45 | -; 'J13' model from Jones et al 2013, as updated in | |
46 | -; Koehler et al 2014 | |
47 | -; 'G17_ModelA' model A from Guillet et al (2018). Includes | |
48 | -; polarisation. See Tables 2 and 3 of that paper for details. | |
49 | -; 'G17_ModelB' model B from Guillet et al (2018) | |
50 | -; 'G17_ModelC' model C from Guillet et al (2018) | |
51 | -; 'G17_ModelD' model A from Guillet et al (2018) | |
39 | +; model = specifies the interstellar dust mixture used by | |
40 | +; DustEM. See userguide or dustem_test_model_exists.pro | |
41 | +; for more details about available models in current release. | |
52 | 42 | ; ext_file = string naming the path to text file in .xcat format that |
53 | 43 | ; describes the observational extinction SED. If not set, the file |
54 | 44 | ; 'Data/EXAMPLE_OBSDATA/Mathis90Fitz99_DISM_NH20.xcat' is used. |
55 | 45 | ; Nitermax = maximum number of fit iterations. Default is 5. |
56 | -; fits_save_and_restore = if set, save the fit results in a binary | |
46 | +; fits_save = if set, save the fit results in a binary | |
57 | 47 | ; FITS file. The code then restore this file and plots |
58 | 48 | ; the results using the saved results information. |
59 | 49 | ; help = if set, print this help |
... | ... | @@ -77,7 +67,7 @@ PRO dustem_fit_ext_example,model=model $ |
77 | 67 | ; |
78 | 68 | ; EXAMPLES |
79 | 69 | ; dustem_fit_ext_example |
80 | -; dustem_fit_ext_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile.fits' | |
70 | +; dustem_fit_ext_example,Nitermax=1,fits_save='/tmp/mysavefile.fits' | |
81 | 71 | ; dustem_fit_ext_example,model='DBP90' |
82 | 72 | ; |
83 | 73 | ; MODIFICATION HISTORY: |
... | ... | @@ -98,13 +88,9 @@ ENDIF ELSE BEGIN |
98 | 88 | use_model='J13' |
99 | 89 | ENDELSE |
100 | 90 | |
101 | -known_mdls=['MC10','DBP90','DL01','WD01_RV5P5B','DL07','J13','G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
102 | -test_model = where(known_mdls eq use_model,ct) | |
103 | -if ct eq 0 then begin | |
104 | - message,'ISM dust model '+use_model+' unknown',/continue | |
105 | - message,'Known models are MC10,DBP90,DL01,WD01_RV5P5B,DL07,J13,G17_MODELA,G17_MODELB,G17_MODELC,G17_MODELD',/continue | |
106 | - stop | |
107 | -end | |
91 | +exists=dustem_test_model_exists(use_model) | |
92 | +if exists ne 1 then $ | |
93 | + message,'Unknown dust model' | |
108 | 94 | |
109 | 95 | use_polarization=0. ;default is no polarization in models |
110 | 96 | use_window=2 ; default graphics window number to use for plotting the results |
... | ... | @@ -207,28 +193,29 @@ if keyword_set(wait) then begin |
207 | 193 | wait,wait |
208 | 194 | end |
209 | 195 | |
210 | -IF keyword_set(fits_save_and_restore) THEN BEGIN | |
211 | - message,'Writing out results structure: '+fits_save_and_restore,/info | |
212 | - dustem_write_fits_table,filename=fits_save_and_restore,help=help | |
196 | +IF keyword_set(fits_save) THEN BEGIN | |
197 | + message,'Writing out results structure: '+fits_save,/info | |
198 | + dustem_write_fits_table,filename=fits_save,help=help | |
213 | 199 | ;=== At this point, you could erase all dustem system variables, or exit idl... all the |
214 | 200 | ;=== information needed to recover the results and remake the plots has been saved in the FITS table |
215 | - ;stop | |
216 | - dustem_read_fits_table,filename=fits_save_and_restore,dustem_st=dustem_st | |
217 | - ;==== plot result taken from the saved fits table | |
218 | - res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
219 | - IF !dustem_noobj THEN BEGIN | |
220 | - dustemwrap_plot_noobj,res,st=dustem_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
221 | - ENDIF ELSE BEGIN | |
222 | - dustemwrap_plot,res,st=dustem_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
223 | - ENDELSE | |
201 | + | |
202 | + ;; Moved the following to dustem_fitsio_example | |
203 | + ;; dustem_read_fits_table,filename=fits_save,dustem_st=dustem_st | |
204 | + ;; ;==== plot result taken from the saved fits table | |
205 | + ;; res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
206 | + ;; IF !dustem_noobj THEN BEGIN | |
207 | + ;; dustemwrap_plot_noobj,res,st=dustem_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
208 | + ;; ENDIF ELSE BEGIN | |
209 | + ;; dustemwrap_plot,res,st=dustem_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
210 | + ;; ENDELSE | |
224 | 211 | IF keyword_set(wait) THEN BEGIN |
225 | - message,'Saved the results as FITS in the file: '+fits_save_and_restore+', and made a plot using the data in this file',/info | |
212 | + message,'Saved the results as FITS in the file: '+fits_save,/info | |
226 | 213 | wait,wait |
227 | 214 | ENDIF |
228 | 215 | ENDIF |
229 | 216 | |
230 | -message,'Finished dustem_fit_ext_example',/info | |
231 | 217 | |
232 | 218 | the_end: |
219 | +message,'Finished dustem_fit_ext_example',/info | |
233 | 220 | |
234 | 221 | END | ... | ... |
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_and_restore=fits_save_and_restore $ | |
4 | + ,fits_save=fits_save $ | |
5 | 5 | ,wait=wait $ |
6 | 6 | ,noobj=noobj $ |
7 | 7 | ,help=help $ |
... | ... | @@ -21,7 +21,7 @@ PRO dustem_fit_ext_pol_example,model=model $ |
21 | 21 | ; DustEMWrap, Distributed, High-Level, User Example |
22 | 22 | ; |
23 | 23 | ; CALLING SEQUENCE: |
24 | -; dustem_fit_ext_pol_example[,model=][ext_file=][,Nitermax=][,fits_save_and_restore=][,/help,/wait,/verbose,/noobj] | |
24 | +; dustem_fit_ext_pol_example[,model=][ext_file=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
25 | 25 | ; |
26 | 26 | ; INPUTS: |
27 | 27 | ; None |
... | ... | @@ -46,7 +46,7 @@ PRO dustem_fit_ext_pol_example,model=model $ |
46 | 46 | ; used to define the observational structure, and a synthetic |
47 | 47 | ; observation is generated using the dust model. |
48 | 48 | ; Nitermax = maximum number of fit iterations. Default is 5. |
49 | -; fits_save_and_restore = if set, save the fit results in a binary | |
49 | +; fits_save = if set, save the fit results in a binary | |
50 | 50 | ; FITS file. The code then restore this file and plots |
51 | 51 | ; the results using the saved results information. |
52 | 52 | ; help = if set, print this help |
... | ... | @@ -70,7 +70,7 @@ PRO dustem_fit_ext_pol_example,model=model $ |
70 | 70 | ; |
71 | 71 | ; EXAMPLES |
72 | 72 | ; dustem_fit_ext_pol_example |
73 | -; dustem_fit_ext_pol_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile.fits' | |
73 | +; dustem_fit_ext_pol_example,Nitermax=1,fits_save='/tmp/mysavefile.fits' | |
74 | 74 | ; dustem_fit_ext_pol_example,model='G17_MODELD' |
75 | 75 | ; |
76 | 76 | ; MODIFICATION HISTORY: |
... | ... | @@ -93,7 +93,7 @@ ENDELSE |
93 | 93 | |
94 | 94 | exists=dustem_test_model_exists(use_model,/pol) |
95 | 95 | if exists ne 1 then $ |
96 | - message,'Unknown dust or unpolarized model' | |
96 | + message,'Unknown/unpolarised dust model: '+use_model | |
97 | 97 | |
98 | 98 | use_polarization=0. ;default is no polarization in models |
99 | 99 | use_window=2 ; default graphics window number to use for plotting the results |
... | ... | @@ -239,25 +239,25 @@ if keyword_set(wait) then begin |
239 | 239 | message,'Time taken [sec]: '+sigfig(t2-t1,2,/sci),/info |
240 | 240 | wait,wait |
241 | 241 | end |
242 | -stop | |
243 | 242 | |
244 | -IF keyword_set(fits_save_and_restore) THEN BEGIN | |
245 | - message,'Writing out results structure: '+fits_save_and_restore,/info | |
246 | - dustem_write_fits_table,filename=fits_save_and_restore,help=help | |
243 | +IF keyword_set(fits_save) THEN BEGIN | |
244 | + message,'Writing out results structure: '+fits_save,/info | |
245 | + dustem_write_fits_table,filename=fits_save,help=help | |
247 | 246 | ;=== At this point, you could erase all dustem system variables, or exit idl... all the |
248 | 247 | ;=== information needed to recover the results and remake the plots has been saved in the FITS table |
249 | - ;stop | |
250 | - dustem_read_fits_table,filename=fits_save_and_restore,dustem_st=dustem_st | |
251 | - ;==== plot result taken from the saved fits table | |
252 | - res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
253 | - !dustem_end=-1; subsequent calls to the fit. 0 is intialization an 1 is for the last iteration. It's initialized to 0 after the creation of the fits file. | |
254 | - IF !dustem_noobj THEN BEGIN | |
255 | - dustemwrap_plot_noobj,res,st=dustem_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
256 | - ENDIF ELSE BEGIN | |
257 | - dustemwrap_plot,res,st=dustem_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
258 | - ENDELSE | |
248 | + | |
249 | +;; Moved the following to dustem_fitsio_example.pro | |
250 | +;; dustem_read_fits_table,filename=fits_save,dustem_st=dustem_st | |
251 | + ;; ;==== plot result taken from the saved fits table | |
252 | + ;; res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
253 | + ;; !dustem_end=-1; subsequent calls to the fit. 0 is intialization an 1 is for the last iteration. It's initialized to 0 after the creation of the fits file. | |
254 | + ;; IF !dustem_noobj THEN BEGIN | |
255 | + ;; dustemwrap_plot_noobj,res,st=dustem_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
256 | + ;; ENDIF ELSE BEGIN | |
257 | + ;; dustemwrap_plot,res,st=dustem_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
258 | + ;; ENDELSE | |
259 | 259 | IF keyword_set(wait) THEN BEGIN |
260 | - message,'Saved the results as FITS in the file: '+fits_save_and_restore+', and made a plot using the data in this file',/info | |
260 | + message,'Saved the results as FITS in the file: '+fits_save+', and made a plot using the data in this file',/info | |
261 | 261 | wait,wait |
262 | 262 | ENDIF |
263 | 263 | ENDIF | ... | ... |
src/idl/dustem_fit_intensity_example.pro
... | ... | @@ -2,7 +2,7 @@ PRO dustem_fit_intensity_example,model=model $ |
2 | 2 | ,sed_file=sed_file $ |
3 | 3 | ,Nitermax=Nitermax $ |
4 | 4 | ,postscript=postscript $ |
5 | - ,fits_save_and_restore=fits_save_and_restore $ | |
5 | + ,fits_save=fits_save $ | |
6 | 6 | ,help=help $ |
7 | 7 | ,wait=wait $ |
8 | 8 | ,noobj=noobj $ |
... | ... | @@ -31,7 +31,7 @@ PRO dustem_fit_intensity_example,model=model $ |
31 | 31 | ; DustEMWrap, Distributed, High-Level, User Example |
32 | 32 | ; |
33 | 33 | ; CALLING SEQUENCE: |
34 | -; dustem_fit_intensity_example[,model=][sed_file=][,postscript=][,Nitermax=][,fits_save_and_restore=][,/help,/wait,/verbose] | |
34 | +; dustem_fit_intensity_example[,model=][sed_file=][,postscript=][,Nitermax=][,fits_save=][,/help,/wait,/verbose] | |
35 | 35 | ; |
36 | 36 | ; INPUTS: |
37 | 37 | ; None |
... | ... | @@ -46,28 +46,17 @@ PRO dustem_fit_intensity_example,model=model $ |
46 | 46 | ; Plots, results structure in binary FITS table format |
47 | 47 | ; |
48 | 48 | ; ACCEPTED KEY-WORDS: |
49 | -; model = specifies the interstellar dust mixture used by DustEM | |
50 | -; 'MC10' model from Compiegne et al 2010 | |
51 | -; 'DBP90' model from Desert et al 1990 | |
52 | -; 'DL01' model from Draine & Li 2001 | |
53 | -; 'WD01_RV5p5B' model from Weingartner & Draine 2002 with Rv=5.5 | |
54 | -; 'DL07' model from Draine & Li 2007 | |
55 | -; 'J13' model from Jones et al 2013, as updated in | |
56 | -; Koehler et al 2014 | |
57 | -; 'G17_ModelA' model A from Guillet et al (2018). Includes | |
58 | -; polarisation. See Tables 2 and 3 of that paper for details. | |
59 | -; 'G17_ModelB' model B from Guillet et al (2018) | |
60 | -; 'G17_ModelC' model C from Guillet et al (2018) | |
61 | -; 'G17_ModelD' model A from Guillet et al (2018) | |
49 | +; model = specifies the interstellar dust mixture used by | |
50 | +; DustEM. See userguide or dustem_test_model_exists.pro | |
51 | +; for more details about available models in current release. | |
62 | 52 | ; sed_file = string naming the path to text file in .xcat format that |
63 | 53 | ; describes the observational SED. If not set, the file |
64 | 54 | ; 'Data/EXAMPLE_OBSDATA/example_SED_1.xcat' is used. |
65 | 55 | ; postscript = if set, final plot is saved as postscript in the |
66 | 56 | ; current working directory |
67 | 57 | ; Nitermax = maximum number of fit iterations. Default is 5. |
68 | -; fits_save_and_restore = if set, save the fit results in a binary | |
69 | -; FITS file. The code then restore this file and plots | |
70 | -; the results using the saved results information. | |
58 | +; fits_save = if set, save the fit results in a binary | |
59 | +; FITS file. | |
71 | 60 | ; help = if set, print this help |
72 | 61 | ; wait = if set, wait this many seconds between each step of |
73 | 62 | ; the code (for illustration purposes) |
... | ... | @@ -88,9 +77,9 @@ PRO dustem_fit_intensity_example,model=model $ |
88 | 77 | ; |
89 | 78 | ; EXAMPLES |
90 | 79 | ; dustem_fit_intensity_example |
91 | -; dustem_fit_intensity_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile.fits' | |
80 | +; dustem_fit_intensity_example,Nitermax=1,fits_save='/tmp/mysavefile.fits' | |
92 | 81 | ; dustem_fit_intensity_example,model='DBP90' |
93 | -; NE MARCHE PAS: dustem_fit_intensity_example,fits_save_and_restore='/tmp/bidon.fits',Nitermax=1 | |
82 | +; | |
94 | 83 | ; MODIFICATION HISTORY: |
95 | 84 | ; Written by JPB Apr-2011 |
96 | 85 | ; Evolution details on the DustEMWrap gitlab. |
... | ... | @@ -108,13 +97,9 @@ ENDIF ELSE BEGIN |
108 | 97 | use_model='DBP90' ;Example with default keywords uses the DBP90 model |
109 | 98 | ENDELSE |
110 | 99 | |
111 | -known_mdls=['MC10','DBP90','DL01','WD01_RV5P5B','DL07','J13','G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
112 | -test_model = where(known_mdls eq use_model,ct) | |
113 | -if ct eq 0 then begin | |
114 | - message,'ISM dust model '+use_model+' unknown',/continue | |
115 | - message,'Known models are MC10,DBP90,DL01,WD01_RV5P5B,DL07,J13,G17_MODELA,G17_MODELB,G17_MODELC,G17_MODELD',/continue | |
116 | - stop | |
117 | -end | |
100 | +exists=dustem_test_model_exists(use_model) | |
101 | +if exists ne 1 then $ | |
102 | + message,'Unknown dust model' | |
118 | 103 | |
119 | 104 | use_polarization=0 ; initialize Dustemwrap in no polarization mode |
120 | 105 | use_window=2 ; default graphics window number to use for plotting the results |
... | ... | @@ -236,7 +221,7 @@ fpd=[] & fiv=[] |
236 | 221 | |
237 | 222 | |
238 | 223 | ;; ;=== AN EXAMPLE FOR J13 |
239 | -;; ;=== Here we fit the dust abundances of the MC10 model, the | |
224 | +;; ;=== Here we fit the dust abundances of the J13 model, the | |
240 | 225 | ;; ;=== intensity of the dust-heating radiation field as well as two plug-ins: |
241 | 226 | ;; ;=== (i) free-free emission |
242 | 227 | ;; ;=== (ii)continuum due to a blackbody |
... | ... | @@ -253,10 +238,11 @@ fpd=[] & fiv=[] |
253 | 238 | ;; ,'dustem_plugin_freefree_2' $ ;free-free amplitude |
254 | 239 | ;; ,'dustem_plugin_continuum_2'] ;Intensity at peak of the BB continuum |
255 | 240 | ;; iv = [1.2,1.7e-3, 6.3e-4, 2.55e-3, 2.55e-3, 7500., 0.4, 0.001] |
241 | +;; Npar=n_elements(pd) | |
256 | 242 | ;; ulimed=replicate(0,Npar) |
257 | 243 | ;; llimed=replicate(1,Npar) |
258 | 244 | ;; llims=replicate(1.e-15,Npar) |
259 | -;; fpd=[ 'dustem_plugin_continuum_2'] ; Temperature of the BB | |
245 | +;; fpd=[ 'dustem_plugin_continuum_1'] ; Temperature of the BB | |
260 | 246 | ;; fiv=[1000.] |
261 | 247 | |
262 | 248 | |
... | ... | @@ -361,34 +347,36 @@ if keyword_set(wait) then begin |
361 | 347 | wait,wait |
362 | 348 | end |
363 | 349 | |
364 | -IF keyword_set(fits_save_and_restore) THEN BEGIN | |
365 | - message,'Writing out results structure: '+fits_save_and_restore,/info | |
366 | - dustem_write_fits_table,filename=fits_save_and_restore,help=help | |
350 | +IF keyword_set(fits_save) THEN BEGIN | |
351 | + message,'Writing out results structure: '+fits_save,/info | |
352 | + dustem_write_fits_table,filename=fits_save,help=help | |
367 | 353 | ;=== At this point, you could erase all dustem system variables, or exit idl... all the |
368 | 354 | ;=== information needed to recover the results and remake the plots has been saved in the FITS table |
369 | - ;stop | |
370 | - dustem_read_fits_table,filename=fits_save_and_restore,dustem_st=dustem_spectra_st | |
371 | - ;stop | |
372 | - ;!dustem_show=ptr_new(*!dustem_data) ;test | |
373 | - !dustem_noobj=1 | |
374 | - ;==== plot result taken from the saved fits table | |
375 | - res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
376 | - IF !dustem_noobj THEN BEGIN | |
377 | - ;dustemwrap_plot_noobj,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
378 | - dustemwrap_plot_noobj,res,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
379 | - ENDIF ELSE BEGIN | |
380 | - ;dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
381 | - dustemwrap_plot,res,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
382 | - ENDELSE | |
383 | - ;stop | |
355 | + | |
356 | +;=== Moved the following to dustem_fits_io_example | |
357 | + ;; dustem_read_fits_table,filename=fits_save,dustem_st=dustem_spectra_st | |
358 | + ;; ;stop | |
359 | + ;; ;!dustem_show=ptr_new(*!dustem_data) ;test | |
360 | + ;; !dustem_noobj=1 | |
361 | + ;; ;==== plot result taken from the saved fits table | |
362 | + ;; res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
363 | + ;; IF !dustem_noobj THEN BEGIN | |
364 | + ;; ;dustemwrap_plot_noobj,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
365 | + ;; dustemwrap_plot_noobj,res,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
366 | + ;; ENDIF ELSE BEGIN | |
367 | + ;; ;dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
368 | + ;; dustemwrap_plot,res,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
369 | + ;; ENDELSE | |
370 | + ;; ;stop | |
371 | + | |
384 | 372 | IF keyword_set(wait) THEN BEGIN |
385 | - message,'Saved the results as FITS in the file: '+fits_save_and_restore+', and made a plot using the data in this file',/info | |
373 | + message,'Saved the results as FITS in the file: '+fits_save,/info | |
386 | 374 | wait,wait |
387 | 375 | ENDIF |
388 | 376 | ENDIF |
389 | 377 | |
390 | -message,'Finished dustem_fit_intensity_example',/info | |
391 | 378 | |
392 | 379 | the_end: |
380 | +message,'Finished dustem_fit_intensity_example',/info | |
393 | 381 | |
394 | 382 | END | ... | ... |
src/idl/dustem_fit_intensity_mbb_example.pro
... | ... | @@ -2,7 +2,7 @@ PRO dustem_fit_intensity_mbb_example,model=model $ |
2 | 2 | ,sed_file=sed_file $ |
3 | 3 | ,Nitermax=Nitermax $ |
4 | 4 | ,postscript=postscript $ |
5 | - ,fits_save_and_restore=fits_save_and_restore $ | |
5 | + ,fits_save=fits_save $ | |
6 | 6 | ,help=help $ |
7 | 7 | ,wait=wait $ |
8 | 8 | ,verbose=verbose |
... | ... | @@ -32,7 +32,7 @@ PRO dustem_fit_intensity_mbb_example,model=model $ |
32 | 32 | ; DustEMWrap, Distributed, High-Level, User Example |
33 | 33 | ; |
34 | 34 | ; CALLING SEQUENCE: |
35 | -; dustem_fit_intensity_mbb_example[,model=][sed_file=][,postscript=][,Nitermax=][,fits_save_and_restore=][,/help,/wait,/verbose] | |
35 | +; dustem_fit_intensity_mbb_example[,model=][sed_file=][,postscript=][,Nitermax=][,fits_save=][,/help,/wait,/verbose] | |
36 | 36 | ; |
37 | 37 | ; INPUTS: |
38 | 38 | ; None |
... | ... | @@ -47,28 +47,17 @@ PRO dustem_fit_intensity_mbb_example,model=model $ |
47 | 47 | ; Plots, results structure in binary FITS table format |
48 | 48 | ; |
49 | 49 | ; ACCEPTED KEY-WORDS: |
50 | -; model = specifies the interstellar dust mixture used by DustEM | |
51 | -; 'MC10' model from Compiegne et al 2010 (default) | |
52 | -; 'DBP90' model from Desert et al 1990 | |
53 | -; 'DL01' model from Draine & Li 2001 | |
54 | -; 'WD01_RV5p5B' model from Weingartner & Draine 2002 with Rv=5.5 | |
55 | -; 'DL07' model from Draine & Li 2007 | |
56 | -; 'J13' model from Jones et al 2013, as updated in | |
57 | -; Koehler et al 2014 | |
58 | -; 'G17_ModelA' model A from Guillet et al (2018). Includes | |
59 | -; polarisation. See Tables 2 and 3 of that paper for details. | |
60 | -; 'G17_ModelB' model B from Guillet et al (2018) | |
61 | -; 'G17_ModelC' model C from Guillet et al (2018) | |
62 | -; 'G17_ModelD' model A from Guillet et al (2018) | |
50 | +; model = specifies the interstellar dust mixture used by | |
51 | +; DustEM. See userguide or dustem_test_model_exists.pro | |
52 | +; for more details about available models in current release. | |
63 | 53 | ; sed_file = string naming the path to text file in .xcat format that |
64 | 54 | ; describes the observational SED. If not set, the file |
65 | 55 | ; 'Data/EXAMPLE_OBSDATA/example_SED_1.xcat' is used. |
66 | 56 | ; postscript = if set, final plot is saved as postscript in the |
67 | 57 | ; current working directory |
68 | 58 | ; Nitermax = maximum number of fit iterations. Default is 5. |
69 | -; fits_save_and_restore = if set, save the fit results in a binary | |
70 | -; FITS file. The code then restore this file and plots | |
71 | -; the results using the saved results information. | |
59 | +; fits_save = if set, save the fit results in a binary | |
60 | +; FITS file. | |
72 | 61 | ; help = if set, print this help |
73 | 62 | ; wait = if set, wait this many seconds between each step of |
74 | 63 | ; the code (for illustration purposes) |
... | ... | @@ -89,7 +78,7 @@ PRO dustem_fit_intensity_mbb_example,model=model $ |
89 | 78 | ; |
90 | 79 | ; EXAMPLES |
91 | 80 | ; dustem_fit_intensity_mbb_example |
92 | -; dustem_fit_intensity_mbb_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile.fits' | |
81 | +; dustem_fit_intensity_mbb_example,Nitermax=1,fits_save='/tmp/mysavefile.fits' | |
93 | 82 | ; dustem_fit_intensity_mbb_example,model='DBP90' |
94 | 83 | ; |
95 | 84 | ; MODIFICATION HISTORY: |
... | ... | @@ -108,7 +97,9 @@ IF keyword_set(model) THEN BEGIN |
108 | 97 | ENDIF ELSE BEGIN |
109 | 98 | use_model='MC10' ;Default is the MC10 model |
110 | 99 | ENDELSE |
111 | - | |
100 | +exists=dustem_test_model_exists(use_model) | |
101 | +if exists ne 1 then $ | |
102 | + message,'Unknown dust model' | |
112 | 103 | |
113 | 104 | use_polarization=0 ; initialize Dustemwrap in no polarization mode |
114 | 105 | use_window=2 ; default graphics window number to use for plotting the results |
... | ... | @@ -255,29 +246,28 @@ IF keyword_set(wait) THEN BEGIN |
255 | 246 | wait,wait |
256 | 247 | ENDIF |
257 | 248 | |
258 | -stop | |
259 | - | |
260 | -IF keyword_set(fits_save_and_restore) THEN BEGIN | |
261 | - message,'Writing out results structure: '+fits_save_and_restore,/info | |
262 | - dustem_write_fits_table,filename=fits_save_and_restore,help=help | |
249 | +IF keyword_set(fits_save) THEN BEGIN | |
250 | + message,'Writing out results structure: '+fits_save,/info | |
251 | + dustem_write_fits_table,filename=fits_save,help=help | |
263 | 252 | ;=== At this point, you could erase all dustem system variables, or exit idl... all the |
264 | 253 | ;=== information needed to recover the results and remake the plots has been saved in the FITS table |
265 | - dustem_read_fits_table,filename=fits_save_and_restore,dustem_st=dustem_spectra_st | |
266 | - ;==== plot result taken from the saved fits table | |
267 | - res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
268 | - IF !dustem_noobj THEN BEGIN | |
269 | - dustemwrap_plot_noobj,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
270 | - ENDIF ELSE BEGIN | |
271 | - dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
272 | - ENDELSE | |
254 | + | |
255 | +;;=== Moved following to the dustem_fitsio_example | |
256 | + ;; dustem_read_fits_table,filename=fits_save,dustem_st=dustem_spectra_st | |
257 | + ;; ;==== plot result taken from the saved fits table | |
258 | + ;; res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
259 | + ;; IF !dustem_noobj THEN BEGIN | |
260 | + ;; dustemwrap_plot_noobj,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
261 | + ;; ENDIF ELSE BEGIN | |
262 | + ;; dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
263 | + ;; ENDELSE | |
273 | 264 | IF keyword_set(wait) THEN BEGIN |
274 | - message,'Saved the results as FITS in the file: '+fits_save_and_restore+', and made a plot using the data in this file',/info | |
265 | + message,'Saved the results as FITS in the file: '+fits_save,/info | |
275 | 266 | wait,wait |
276 | 267 | ENDIF |
277 | 268 | ENDIF |
278 | 269 | |
279 | -message,'Finished dustem_fit_intensity_mbb_example',/info | |
280 | - | |
281 | 270 | the_end: |
271 | +message,'Finished dustem_fit_intensity_mbb_example',/info | |
282 | 272 | |
283 | 273 | END | ... | ... |
src/idl/dustem_fit_polarization_example.pro
... | ... | @@ -2,7 +2,7 @@ PRO dustem_fit_polarization_example,model=model $ |
2 | 2 | ,sed_file=sed_file $ |
3 | 3 | ,Nitermax=Nitermax $ |
4 | 4 | ,postscript=postscript $ |
5 | - ,fits_save_and_restore=fits_save_and_restore $ | |
5 | + ,fits_save=fits_save $ | |
6 | 6 | ,help=help $ |
7 | 7 | ,wait=wait $ |
8 | 8 | ,verbose=verbose |
... | ... | @@ -20,7 +20,7 @@ PRO dustem_fit_polarization_example,model=model $ |
20 | 20 | ; DustEMWrap, Distributed, High-Level, User Example |
21 | 21 | ; |
22 | 22 | ; CALLING SEQUENCE: |
23 | -; dustem_fit_polarization_example[,model=][sed_file=][,postscript=][,Nitermax=][,fits_save_and_restore=][,/help,/wait,/verbose] | |
23 | +; dustem_fit_polarization_example[,model=][sed_file=][,postscript=][,Nitermax=][,fits_save=][,/help,/wait,/verbose] | |
24 | 24 | ; |
25 | 25 | ; INPUTS: |
26 | 26 | ; None |
... | ... | @@ -35,19 +35,16 @@ PRO dustem_fit_polarization_example,model=model $ |
35 | 35 | ; Plots, Results save structure in binary FITS table format |
36 | 36 | ; |
37 | 37 | ; ACCEPTED KEY-WORDS: |
38 | -; model = specifies the interstellar dust mixture used by DustEM | |
39 | -; 'G17_ModelA' model A from Guillet et al (2018). See Tables 2 and 3 of that paper for details. | |
40 | -; 'G17_ModelB' model B from Guillet et al (2018) | |
41 | -; 'G17_ModelC' model C from Guillet et al (2018) | |
42 | -; 'G17_ModelD' model A from Guillet et al (2018). Default. | |
38 | +; model = specifies the interstellar dust mixture used by | |
39 | +; DustEM. See userguide or dustem_test_model_exists.pro | |
40 | +; for more details about available models in current release. | |
43 | 41 | ; sed_file = string naming the path to text file in .xcat format that |
44 | 42 | ; describes the observational SED. If not set, the file |
45 | 43 | ; 'Data/EXAMPLE_OBSDATA/example_SED_3.xcat' is used. |
46 | 44 | ; postscript = if set, final plot is saved as postscript in the |
47 | 45 | ; current working directory |
48 | 46 | ; Nitermax = maximum number of fit iterations. Default is 5. |
49 | -; fits_save_and_restore = if set, saves results in a fits file, | |
50 | - ; restore the file and plot restored results | |
47 | +; fits_save = if set, saves results in a fits file, | |
51 | 48 | ; help = if set, print this help |
52 | 49 | ; wait = if set, wait this many seconds between each step of |
53 | 50 | ; the code (for illustration purposes) |
... | ... | @@ -67,7 +64,7 @@ PRO dustem_fit_polarization_example,model=model $ |
67 | 64 | ; |
68 | 65 | ; EXAMPLES |
69 | 66 | ; dustem_fit_polarization_example |
70 | -; dustem_fit_polarization_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile.fits' | |
67 | +; dustem_fit_polarization_example,Nitermax=1,fits_save='/tmp/mysavefile.fits' | |
71 | 68 | ; dustem_fit_polarization_example,model='DBP90' |
72 | 69 | ; |
73 | 70 | ; MODIFICATION HISTORY: |
... | ... | @@ -87,19 +84,9 @@ ENDIF ELSE BEGIN |
87 | 84 | use_model='G17_MODELD' ;Default is one of the Guillet et al (2017) models since they treat dust polarization properties |
88 | 85 | ENDELSE |
89 | 86 | |
90 | -known_mdls=['MC10','DBP90','DL01','WD01_RV5P5B','DL07','J13','G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
91 | -pol_mdls=['G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
92 | -test_model = where(known_mdls eq use_model,ct) | |
93 | -if ct eq 0 then begin | |
94 | - message,'ISM dust model '+use_model+' unknown',/continue | |
95 | - message,'Known models are MC10,DBP90,DL01,WD01_RV5P5B,DL07,J13,G17_MODELA,G17_MODELB,G17_MODELC,G17_MODELD',/continue | |
96 | - stop | |
97 | -end | |
98 | -test_model = where(pol_mdls eq use_model,polct) | |
99 | -if polct eq 0 then begin | |
100 | - message,'The only models with polarization are G17_MODELA,G17_MODELB,G17_MODELC,G17_MODELD',/continue | |
101 | - stop | |
102 | -end | |
87 | +exists=dustem_test_model_exists(use_model,/pol) | |
88 | +if exists ne 1 then $ | |
89 | + message,'Unknown/non-polarized dust model: '+use_model | |
103 | 90 | |
104 | 91 | use_window=2 ; default graphics window number to use for plotting the results |
105 | 92 | use_verbose=0 |
... | ... | @@ -225,24 +212,27 @@ if keyword_set(wait) then begin |
225 | 212 | wait,wait |
226 | 213 | end |
227 | 214 | |
228 | -IF keyword_set(fits_save_and_restore) THEN BEGIN | |
229 | - message,'Writing out results structure: '+fits_save_and_restore,/info | |
230 | - dustem_write_fits_table,filename=fits_save_and_restore,help=help | |
215 | +IF keyword_set(fits_save) THEN BEGIN | |
216 | + message,'Writing out results structure: '+fits_save,/info | |
217 | + dustem_write_fits_table,filename=fits_save,help=help | |
231 | 218 | ;=== At this point, you could erase all dustem system variables, or exit idl... all the |
232 | 219 | ;=== information needed to recover the results and remake the plots has been saved in the FITS table |
233 | - dustem_read_fits_table,filename=fits_save_and_restore,dustem_st=dustem_spectra_st | |
234 | - ;==== plot result taken from the saved fits table | |
235 | - res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
220 | + | |
221 | + | |
222 | + ;; dustem_read_fits_table,filename=fits_save,dustem_st=dustem_spectra_st | |
223 | + ;; ;==== plot result taken from the saved fits table | |
224 | + ;; res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
236 | 225 | |
237 | - ;If the user prefers non-OOP plotting then they will have to set !dustem_noobj=1 since dustem_init is called in reads_fits_table. | |
226 | + ;; ;If the user prefers non-OOP plotting then reset !dustem_noobj=1 here since dustem_init is called in reads_fits_table. | |
238 | 227 | |
239 | - IF !dustem_noobj THEN BEGIN | |
240 | - dustemwrap_plot_noobj,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=title+' (From saved FITS file)' | |
241 | - ENDIF ELSE BEGIN | |
242 | - dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=title+' (From saved FITS file)' | |
243 | - ENDELSE | |
244 | - if keyword_set(wait) then begin | |
245 | - message,'Saved the results as FITS in the file: '+fits_save_and_restore+', and made a plot using the data in this file',/info | |
228 | + ;; IF !dustem_noobj THEN BEGIN | |
229 | + ;; dustemwrap_plot_noobj,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=title+' (From saved FITS file)' | |
230 | + ;; ENDIF ELSE BEGIN | |
231 | + ;; dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=title+' (From saved FITS file)' | |
232 | + ;; ENDELSE | |
233 | + | |
234 | + if keyword_set(wait) then begin | |
235 | + message,'Saved the results as FITS in the file: '+fits_save,/info | |
246 | 236 | wait,wait |
247 | 237 | end |
248 | 238 | ENDIF | ... | ... |
src/idl/dustem_fit_sed_ext_pol_example.pro
... | ... | @@ -2,7 +2,7 @@ PRO dustem_fit_sed_ext_pol_example,model=model $ |
2 | 2 | ,sed_file=sed_file $ |
3 | 3 | ,ext_file=ext_file $ |
4 | 4 | ,Nitermax=Nitermax $ |
5 | - ,fits_save_and_restore=fits_save_and_restore $ | |
5 | + ,fits_save=fits_save $ | |
6 | 6 | ,wait=wait $ |
7 | 7 | ,noobj=noobj $ |
8 | 8 | ,help=help $ |
... | ... | @@ -22,7 +22,7 @@ PRO dustem_fit_sed_ext_pol_example,model=model $ |
22 | 22 | ; DustEMWrap, Distributed, High-Level, User Example |
23 | 23 | ; |
24 | 24 | ; CALLING SEQUENCE: |
25 | -; dustem_fit_sed_ext_pol_example[,model=][sed_file=][ext_file=][,Nitermax=][,fits_save_and_restore=][,/help,/wait,/verbose,/noobj] | |
25 | +; dustem_fit_sed_ext_pol_example[,model=][sed_file=][ext_file=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
26 | 26 | ; |
27 | 27 | ; INPUTS: |
28 | 28 | ; None |
... | ... | @@ -37,19 +37,9 @@ PRO dustem_fit_sed_ext_pol_example,model=model $ |
37 | 37 | ; Plots, results structure in binary FITS table format |
38 | 38 | ; |
39 | 39 | ; ACCEPTED KEY-WORDS: |
40 | -; model = specifies the interstellar dust mixture used by DustEM | |
41 | -; 'MC10' model from Compiegne et al 2010 | |
42 | -; 'DBP90' model from Desert et al 1990 | |
43 | -; 'DL01' model from Draine & Li 2001 | |
44 | -; 'WD01_RV5P5B' model from Weingartner & Draine 2002 with Rv=5.5 | |
45 | -; 'DL07' model from Draine & Li 2007 | |
46 | -; 'J13' model from Jones et al 2013, as updated in | |
47 | -; Koehler et al 2014 | |
48 | -; 'G17_ModelA' model A from Guillet et al (2018). Includes | |
49 | -; polarisation. See Tables 2 and 3 of that paper for details. | |
50 | -; 'G17_ModelB' model B from Guillet et al (2018) | |
51 | -; 'G17_ModelC' model C from Guillet et al (2018) | |
52 | -; 'G17_ModelD' model A from Guillet et al (2018) | |
40 | +; model = specifies the interstellar dust mixture used by | |
41 | +; DustEM. See userguide or dustem_test_model_exists.pro | |
42 | +; for more details about available models in current release. | |
53 | 43 | ; sed_file = string naming the path to text file in .xcat format that |
54 | 44 | ; describes the observational SED. If not set, the file |
55 | 45 | ; 'Data/EXAMPLE_OBSDATA/example_SED_2.xcat' is used. |
... | ... | @@ -57,7 +47,7 @@ PRO dustem_fit_sed_ext_pol_example,model=model $ |
57 | 47 | ; describes the observational extinction SED. If not set, the file |
58 | 48 | ; 'Data/EXAMPLE_OBSDATA/Mathis90Fitz99_DISM_NH20.xcat' is used. |
59 | 49 | ; Nitermax = maximum number of fit iterations. Default is 5. |
60 | -; fits_save_and_restore = if set, save the fit results in a binary | |
50 | +; fits_save = if set, save the fit results in a binary | |
61 | 51 | ; FITS file. The code then restore this file and plots |
62 | 52 | ; the results using the saved results information. |
63 | 53 | ; help = if set, print this help |
... | ... | @@ -80,8 +70,8 @@ PRO dustem_fit_sed_ext_pol_example,model=model $ |
80 | 70 | ; |
81 | 71 | ; EXAMPLES |
82 | 72 | ; dustem_fit_sed_ext_pol_example |
83 | -; dustem_fit_sed_ext_pol_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile.fits' | |
84 | -; dustem_fit_sed_ext_pol_example,model='DBP90' | |
73 | +; dustem_fit_sed_ext_pol_example,Nitermax=1,fits_save='/tmp/mysavefile.fits' | |
74 | +; dustem_fit_sed_ext_pol_example,model='G17_MODELC' | |
85 | 75 | ; |
86 | 76 | ; MODIFICATION HISTORY: |
87 | 77 | ; Written by JPB Apr-2011 |
... | ... | @@ -100,15 +90,10 @@ ENDIF ELSE BEGIN |
100 | 90 | use_model='G17_MODELD' |
101 | 91 | ENDELSE |
102 | 92 | |
103 | -known_mdls=['MC10','DBP90','DL01','WD01_RV5P5B','DL07','J13','G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
104 | -test_model = where(known_mdls eq use_model,ct) | |
105 | -if ct eq 0 then begin | |
106 | - message,'ISM dust model '+use_model+' unknown',/continue | |
107 | - message,'Known models are MC10,DBP90,DL01,WD01_RV5P5B,DL07,J13,G17_MODELA,G17_MODELB,G17_MODELC,G17_MODELD',/continue | |
108 | - stop | |
109 | -end | |
93 | +exists=dustem_test_model_exists(use_model,/pol) | |
94 | +if exists ne 1 then $ | |
95 | + message,'Unknown/unpolarized dust model: '+use_model | |
110 | 96 | |
111 | -use_polarization=0. ;default is no polarization in models | |
112 | 97 | use_window=2 ; default graphics window number to use for plotting the results |
113 | 98 | use_verbose=0 |
114 | 99 | if keyword_set(verbose) then use_verbose=1 |
... | ... | @@ -247,7 +232,7 @@ end |
247 | 232 | ;=== RESET THE OBSERVATIONAL STRUCTURE IF WE HAVE GENERATED DATA USING |
248 | 233 | ;=== A MODEL |
249 | 234 | if not keyword_set(ext_file) or not keyword_set(sed_file) THEN BEGIN |
250 | - dustem_set_data, sed,sed,ext,ext | |
235 | + dustem_set_data, m_fit=sed,m_show=sed,x_fit=ext,x_show=ext | |
251 | 236 | if keyword_set(wait) then begin |
252 | 237 | message,'Finished generating data from the model '+use_model,/info |
253 | 238 | wait,wait |
... | ... | @@ -282,26 +267,55 @@ if keyword_set(wait) then begin |
282 | 267 | end |
283 | 268 | |
284 | 269 | |
270 | +;=== MAKE THE FINAL PLOT | |
271 | +IF keyword_set(postscript) THEN BEGIN | |
272 | + dir_ps='./' | |
273 | + set_plot,'PS' | |
274 | + ps_file=dir_ps+postscript | |
275 | + device,filename=ps_file,/color | |
276 | +ENDIF | |
277 | + | |
278 | +IF !dustem_noobj THEN BEGIN | |
279 | + dustemwrap_plot_noobj,(*(*!dustem_fit).CURRENT_PARAM_VALUES),st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,tit_m=tit_m+' (Final fit)',tit_x=tit_x+' (Final fit)' | |
280 | +ENDIF ELSE BEGIN | |
281 | + dustemwrap_plot,(*(*!dustem_fit).CURRENT_PARAM_VALUES),st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,tit_m=tit_m+' (Final fit)',tit_x=tit_x+' (Final fit)' | |
282 | +ENDELSE | |
283 | + | |
284 | +IF keyword_set(postscript) THEN BEGIN | |
285 | + set_plot,'X' | |
286 | + device,/close | |
287 | + message,'Wrote '+ps_file,/info | |
288 | +ENDIF | |
289 | + | |
290 | +if keyword_set(wait) then begin | |
291 | + message,'Made the plot of the final results',/info | |
292 | + wait,wait | |
293 | +end | |
294 | + | |
295 | + | |
296 | +IF keyword_set(fits_save) THEN BEGIN | |
297 | + message,'Writing out results structure: '+fits_save,/info | |
298 | + dustem_write_fits_table,filename=fits_save,help=help | |
299 | +;=== At this point, you could erase all dustem system variables, or exit idl... all the | |
300 | +;=== information needed to recover the results and remake the plots has been saved in the FITS table | |
301 | + | |
302 | +;; dustem_read_fits_table,filename=fits_save,dustem_st=dustem_spectra_st | |
303 | +;; ;==== plot result taken from the saved fits table | |
304 | +;; res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
305 | +;; ;If the user prefers non-OOP plotting then reset !dustem_noobj=1 here since dustem_init is called in reads_fits_table. | |
306 | +;; IF !dustem_noobj THEN BEGIN | |
307 | +;; dustemwrap_plot_noobj,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,tit_m=tit_m+' (From Saved FITS file)',tit_x=tit_x+' (From Saved FITS file)' | |
308 | +;; ENDIF ELSE BEGIN | |
309 | +;; dustemwrap_plot,res,st=dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,tit_m=tit_m+' (From Saved FITS file)',tit_x=tit_x+' (From Saved FITS file)' | |
310 | +;; ENDELSE | |
285 | 311 | |
286 | -IF keyword_set(fits_save_and_restore) THEN BEGIN | |
287 | - message,'Writing out results structure: '+fits_save_and_restore,/info | |
288 | - dustem_write_fits_table,filename=fits_save_and_restore,help=help | |
289 | - dustem_read_fits_table,filename=fits_save_and_restore,dustem_st=dustem_spectra_st | |
290 | - ;==== plot result taken from the saved fits table | |
291 | - res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
292 | - IF !dustem_noobj THEN BEGIN | |
293 | - dustemwrap_plot_noobj,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,tit_m=tit_m+' (From Saved FITS file)',tit_x=tit_x+' (From Saved FITS file)' | |
294 | - ENDIF ELSE BEGIN | |
295 | - dustemwrap_plot,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,tit_m=tit_m+' (From Saved FITS file)',tit_x=tit_x+' (From Saved FITS file)' | |
296 | - ENDELSE | |
297 | 312 | IF keyword_set(wait) THEN BEGIN |
298 | - message,'Saved the results as FITS in the file: '+fits_save_and_restore+', and made a plot using the data in this file',/info | |
313 | + message,'Saved the results as FITS in the file: '+fits_save,/info | |
299 | 314 | wait,wait |
300 | 315 | ENDIF |
301 | 316 | ENDIF |
302 | 317 | |
303 | -message,'Finished dustem_fit_sed_ext_pol_example',/info | |
304 | - | |
305 | 318 | the_end: |
319 | +message,'Finished dustem_fit_sed_ext_pol_example',/info | |
306 | 320 | |
307 | 321 | END | ... | ... |
src/idl/dustem_fit_spectro_example.pro
1 | 1 | PRO dustem_fit_spectro_example,model=model $ |
2 | 2 | ,sed_file=sed_file $ |
3 | 3 | ,Nitermax=Nitermax $ |
4 | - ,fits_save_and_restore=fits_save_and_restore $ | |
4 | + ,fits_save=fits_save $ | |
5 | 5 | ,ucfactor=ucfactor $ |
6 | 6 | ,wait=wait $ |
7 | 7 | ,noobj=noobj $ |
... | ... | @@ -12,7 +12,8 @@ PRO dustem_fit_spectro_example,model=model $ |
12 | 12 | ; NAME: |
13 | 13 | ; dustem_fit_spectro_example |
14 | 14 | ; |
15 | -; PURPOSE: This routine is an example of how to fit an observational | |
15 | +; PURPOSE: | |
16 | +; This routine is an example of how to fit an observational | |
16 | 17 | ; spectrometer data in emission (StokesI) with DustEM and |
17 | 18 | ; DustEMWrap. |
18 | 19 | ; |
... | ... | @@ -22,7 +23,7 @@ PRO dustem_fit_spectro_example,model=model $ |
22 | 23 | ; DustEMWrap, Distributed, High-Level, User Example |
23 | 24 | ; |
24 | 25 | ; CALLING SEQUENCE: |
25 | -; dustem_fit_spectro_example[,model=][sed_file=][ext_file=][,Nitermax=][,fits_save_and_restore=][,/help,/wait,/verbose,/noobj] | |
26 | +; dustem_fit_spectro_example[,model=][sed_file=][ext_file=][,Nitermax=][,fits_save=][,/help,/wait,/verbose,/noobj] | |
26 | 27 | ; |
27 | 28 | ; INPUTS: |
28 | 29 | ; None |
... | ... | @@ -37,28 +38,17 @@ PRO dustem_fit_spectro_example,model=model $ |
37 | 38 | ; Plots, results structure in binary FITS table format |
38 | 39 | ; |
39 | 40 | ; ACCEPTED KEY-WORDS: |
40 | -; model = specifies the interstellar dust mixture used by DustEM | |
41 | -; 'MC10' model from Compiegne et al 2010 | |
42 | -; 'DBP90' model from Desert et al 1990 | |
43 | -; 'DL01' model from Draine & Li 2001 | |
44 | -; 'WD01_RV5P5B' model from Weingartner & Draine 2002 with Rv=5.5 | |
45 | -; 'DL07' model from Draine & Li 2007 | |
46 | -; 'J13' model from Jones et al 2013, as updated in | |
47 | -; Koehler et al 2014 | |
48 | -; 'G17_ModelA' model A from Guillet et al (2018). Includes | |
49 | -; polarisation. See Tables 2 and 3 of that paper for details. | |
50 | -; 'G17_ModelB' model B from Guillet et al (2018) | |
51 | -; 'G17_ModelC' model C from Guillet et al (2018) | |
52 | -; 'G17_ModelD' model A from Guillet et al (2018) | |
41 | +; model = specifies the interstellar dust mixture used by | |
42 | +; DustEM. See userguide or dustem_test_model_exists.pro | |
43 | +; for more details about available models in current release. | |
53 | 44 | ; sed_file = string naming the path to text file in .xcat format that |
54 | 45 | ; describes the observational SED. If not set, the file |
55 | 46 | ; 'Data/EXAMPLE_OBSDATA/example_SED_2.xcat' is used. |
56 | 47 | ; Nitermax = maximum number of fit iterations. Default is 5. |
57 | 48 | ; ucfactor = Multiplicative factor for uncertainties on |
58 | 49 | ; spectrometer data. Default is 1. |
59 | -; fits_save_and_restore = if set, save the fit results in a binary | |
60 | -; FITS file. The code then restore this file and plots | |
61 | -; the results using the saved results information. | |
50 | +; fits_save = if set, save the fit results in a binary | |
51 | +; FITS file. | |
62 | 52 | ; help = if set, print this help |
63 | 53 | ; wait = if set, wait this many seconds between each step of |
64 | 54 | ; the code (for illustration purposes) |
... | ... | @@ -79,7 +69,7 @@ PRO dustem_fit_spectro_example,model=model $ |
79 | 69 | ; |
80 | 70 | ; EXAMPLES |
81 | 71 | ; dustem_fit_spectro_example |
82 | -; dustem_fit_spectro_example,Nitermax=10,fits_save_and_restore='/tmp/mysavefile.fits' | |
72 | +; dustem_fit_spectro_example,Nitermax=10,fits_save='/tmp/mysavefile.fits' | |
83 | 73 | ; dustem_fit_spectro_example,model='DBP90' |
84 | 74 | ; |
85 | 75 | ; MODIFICATION HISTORY: |
... | ... | @@ -98,14 +88,9 @@ IF keyword_set(model) THEN BEGIN |
98 | 88 | ENDIF ELSE BEGIN |
99 | 89 | use_model='WD01_RV5P5B' |
100 | 90 | ENDELSE |
101 | - | |
102 | -known_mdls=['MC10','DBP90','DL01','WD01_RV5P5B','DL07','J13','G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
103 | -test_model = where(known_mdls eq use_model,ct) | |
104 | -if ct eq 0 then begin | |
105 | - message,'ISM dust model '+use_model+' unknown',/continue | |
106 | - message,'Known models are MC10,DBP90,DL01,WD01_RV5P5B,DL07,J13,G17_MODELA,G17_MODELB,G17_MODELC,G17_MODELD',/continue | |
107 | - stop | |
108 | -end | |
91 | +exists=dustem_test_model_exists(use_model) | |
92 | +if exists eq 0 then $ | |
93 | + message,'Unknown dust model' | |
109 | 94 | |
110 | 95 | use_polarization=0. ;default is no polarization in models |
111 | 96 | use_window=2 ; default graphics window number to use for plotting the results |
... | ... | @@ -180,7 +165,7 @@ fidx=where(sed.filter eq 'SPECTRUM',fct) |
180 | 165 | if fct gt 0 then sed[fidx].sigmaii = use_ucfactor*sed[fidx].sigmaii |
181 | 166 | |
182 | 167 | ;== SET THE OBSERVATIONAL STRUCTURE |
183 | -dustem_set_data, sed,sed | |
168 | +dustem_set_data,m_fit=sed,m_show=sed | |
184 | 169 | |
185 | 170 | ;== SET INITIAL VALUES AND LIMITS OF THE PARAMETERS FOR THE FIT |
186 | 171 | ;== AND ACTIVATE ANY PLUGINS |
... | ... | @@ -199,7 +184,7 @@ tol=1.e-10 ;fit tolerance |
199 | 184 | ;=== _x/_extinction means extinction plots, _m/_emissions means emission plots |
200 | 185 | xr_m = [1.,5e5] |
201 | 186 | yr_m = [5e-8,1.00e6] |
202 | -tit_m='Spectral Energy Distribution' | |
187 | +tit_m='FIT SPECTRO EXAMPLE' ; plot title | |
203 | 188 | |
204 | 189 | ;=== RUN THE FIT |
205 | 190 | t1=systime(0,/sec) |
... | ... | @@ -217,25 +202,25 @@ end |
217 | 202 | |
218 | 203 | |
219 | 204 | |
220 | -IF keyword_set(fits_save_and_restore) THEN BEGIN | |
221 | - message,'Writing out results structure: '+fits_save_and_restore,/info | |
222 | - dustem_write_fits_table,filename=fits_save_and_restore,help=help | |
223 | - dustem_read_fits_table,filename=fits_save_and_restore,dustem_st=dustem_spectra_st | |
224 | - ;==== plot result taken from the saved fits table | |
225 | - res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
226 | - IF !dustem_noobj THEN BEGIN | |
227 | - dustemwrap_plot_noobj,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,tit_m=tit_m+' (From Saved FITS file)' | |
228 | - ENDIF ELSE BEGIN | |
229 | - dustemwrap_plot,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,tit_m=tit_m+' (From Saved FITS file)' | |
230 | - ENDELSE | |
205 | +IF keyword_set(fits_save) THEN BEGIN | |
206 | + message,'Writing out results structure: '+fits_save,/info | |
207 | + dustem_write_fits_table,filename=fits_save,help=help | |
208 | + | |
209 | +;; Moved following to dustem_fitsio_example.pro | |
210 | + ;; dustem_read_fits_table,filename=fits_save,dustem_st=dustem_spectra_st | |
211 | + ;; res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
212 | + ;; IF !dustem_noobj THEN BEGIN | |
213 | + ;; dustemwrap_plot_noobj,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,tit_m=tit_m+' (From Saved FITS file)' | |
214 | + ;; ENDIF ELSE BEGIN | |
215 | + ;; dustemwrap_plot,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,tit_m=tit_m+' (From Saved FITS file)' | |
216 | + ;; ENDELSE | |
231 | 217 | IF keyword_set(wait) THEN BEGIN |
232 | - message,'Saved the results as FITS in the file: '+fits_save_and_restore+', and made a plot using the data in this file',/info | |
218 | + message,'Saved the results as FITS in the file: '+fits_save,/info | |
233 | 219 | wait,wait |
234 | 220 | ENDIF |
235 | 221 | ENDIF |
236 | 222 | |
237 | -message,'Finished dustem_fit_spectro_example',/info | |
238 | - | |
239 | 223 | the_end: |
224 | +message,'Finished dustem_fit_spectro_example',/info | |
240 | 225 | |
241 | 226 | END | ... | ... |
src/idl/dustem_make_polarization_ext_example.pro
... | ... | @@ -39,7 +39,9 @@ PRO dustem_make_polarization_ext_example,model=model $ |
39 | 39 | ; outfile = path+filename for .xcat output of the EXT |
40 | 40 | ; |
41 | 41 | ; ACCEPTED KEY-WORDS: |
42 | -; model = if set, name of the DustEM dust model to use (default='G17_MODELD') | |
42 | +; model = specifies the interstellar dust mixture used by | |
43 | +; DustEM. See userguide or dustem_test_model_exists.pro | |
44 | +; for more details about available models in current release. | |
43 | 45 | ; help = If set print this help |
44 | 46 | ; verbose = If set, subroutines will be more chatty |
45 | 47 | ; |
... | ... | @@ -85,19 +87,10 @@ ENDIF ELSE BEGIN |
85 | 87 | use_outfile='./polarization_ext.xcat' |
86 | 88 | ENDELSE |
87 | 89 | |
88 | -known_mdls=['MC10','DBP90','DL01','WD01_RV5P5B','DL07','J13','G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
89 | -pol_mdls=['G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
90 | -test_model = where(known_mdls eq use_model,ct) | |
91 | -if ct eq 0 then begin | |
92 | - message,'ISM dust model '+use_model+' unknown',/continue | |
93 | - message,'Known models are MC10,DBP90,DL01,WD01_RV5P5B,DL07,J13,G17_MODELA,G17_MODELB,G17_MODELC,G17_MODELD',/continue | |
94 | - stop | |
95 | -end | |
96 | -test_model = where(pol_mdls eq use_model,ct) | |
97 | -if ct eq 0 then begin | |
98 | - message,'The only models with polarisation are G17_MODELA,G17_MODELB,G17_MODELC,G17_MODELD',/continue | |
99 | - stop | |
100 | -end | |
90 | +exists=dustem_test_model_exists(use_model,/pol) | |
91 | +if exists ne 1 then $ | |
92 | + message,'Unknown/unpolarised dust model: '+use_model | |
93 | + | |
101 | 94 | |
102 | 95 | use_verbose=0 |
103 | 96 | use_polarization=1 |
... | ... | @@ -150,7 +143,7 @@ dustem_init_params,use_model,pd,true_vals,pol=use_polarization;,fpd=fpd,fiv=fiv, |
150 | 143 | ;=== initialize the !dustem_data structure that will be used internally |
151 | 144 | ;== note that m_fit and m_show do not exist -- this is deliberate |
152 | 145 | ;== since we are not treating emission data |
153 | -dustem_set_data,m_fit,m_show,ext,ext | |
146 | +dustem_set_data,m_fit=m_fit,m_show=m_show,x_fit=ext,x_show=ext | |
154 | 147 | |
155 | 148 | ;=== compute the extinction curve (I then QU) using the model and specified |
156 | 149 | ;=== true_vals of parameters | ... | ... |
src/idl/dustem_make_polarization_sed_example.pro
... | ... | @@ -85,20 +85,9 @@ ENDIF ELSE BEGIN |
85 | 85 | use_outfile='./polarization_sed.xcat' |
86 | 86 | ENDELSE |
87 | 87 | |
88 | -known_mdls=['MC10','DBP90','DL01','WD01_RV5P5B','DL07','J13','G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
89 | -pol_mdls=['G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
90 | -test_model = where(known_mdls eq use_model,ct) | |
91 | -if ct eq 0 then begin | |
92 | - message,'ISM dust model '+use_model+' unknown',/continue | |
93 | - message,'Known models are MC10,DBP90,DL01,WD01_RV5P5B,DL07,J13,G17_MODELA,G17_MODELB,G17_MODELC,G17_MODELD',/continue | |
94 | - stop | |
95 | -end | |
96 | -test_model = where(pol_mdls eq use_model,ct) | |
97 | -if ct eq 0 then begin | |
98 | - message,'The only models with polarisation are G17_MODELA,G17_MODELB,G17_MODELC,G17_MODELD',/continue | |
99 | - stop | |
100 | -end | |
101 | - | |
88 | +exists=dustem_test_model_exists(use_model,/pol) | |
89 | +if exists eq 0 then $ | |
90 | + message,'Unknown or unpolarized dust model' | |
102 | 91 | |
103 | 92 | use_verbose=0 |
104 | 93 | use_polarization=1 |
... | ... | @@ -127,7 +116,7 @@ sed.SigmaIU=sed.StokesI/100. |
127 | 116 | sed.SigmaQU=sed.StokesI/100. |
128 | 117 | |
129 | 118 | ;=== initialize the !dustem_data structure that will be used internally |
130 | -dustem_set_data,sed,sed | |
119 | +dustem_set_data,m_fit=sed,m_show=sed | |
131 | 120 | |
132 | 121 | ;=== Set which model parameters to use for the SED |
133 | 122 | pd = [ $ |
... | ... | @@ -145,8 +134,10 @@ pd_true=[1.,7.8000E-04,7.8000E-04,7.8000E-04, 48.,3., 1.e-2, 0.3, 45.] |
145 | 134 | |
146 | 135 | ;== SET INITIAL VALUES AND LIMITS |
147 | 136 | ;== AND ACTIVATE ANY PLUGINS |
137 | + | |
148 | 138 | dustem_init_params,use_model,pd,pd_true,pol=use_polarization |
149 | 139 | |
140 | + | |
150 | 141 | ;=== compute the SED (I then QU) using the model and specified |
151 | 142 | ;=== true_vals of parameters |
152 | 143 | dustem_Ised=dustem_compute_sed(pd_true,st=ssti) ;sst is not set on purpose, for dustem_compute_sed to compute the sed using fortran code | ... | ... |
src/idl/dustem_myisrf_example.pro
... | ... | @@ -3,7 +3,7 @@ PRO dustem_myisrf_example,model=model $ |
3 | 3 | ,isrf_file=isrf_file $ |
4 | 4 | ,Nitermax=Nitermax $ |
5 | 5 | ,postscript=postscript $ |
6 | - ,fits_save_and_restore=fits_save_and_restore $ | |
6 | + ,fits_save=fits_save $ | |
7 | 7 | ,wait=wait $ |
8 | 8 | ,noobj=noobj $ |
9 | 9 | ,verbose=verbose $ |
... | ... | @@ -28,7 +28,7 @@ PRO dustem_myisrf_example,model=model $ |
28 | 28 | ; DustEMWrap, Distributed, High-Level, User Example |
29 | 29 | ; |
30 | 30 | ; CALLING SEQUENCE: |
31 | -; dustem_myisrf_example[,model=][,sed_file=][,isrf_file=][,postscript=][,Nitermax=][,fits_save_and_restore=][,/help,/wait,/verbose] | |
31 | +; dustem_myisrf_example[,model=][,sed_file=][,isrf_file=][,postscript=][,Nitermax=][,fits_save=][,/help,/wait,/verbose] | |
32 | 32 | ; |
33 | 33 | ; INPUTS: |
34 | 34 | ; |
... | ... | @@ -42,19 +42,9 @@ PRO dustem_myisrf_example,model=model $ |
42 | 42 | ; Plots, results structure in binary FITS table format |
43 | 43 | ; |
44 | 44 | ; ACCEPTED KEY-WORDS: |
45 | -; model = specifies the interstellar dust mixture used by DustEM | |
46 | -; 'MC10' model from Compiegne et al 2010 | |
47 | -; 'DBP90' model from Desert et al 1990 | |
48 | -; 'DL01' model from Draine & Li 2001 | |
49 | -; 'WD01_RV5p5B' model from Weingartner & Draine 2002 with Rv=5.5 | |
50 | -; 'DL07' model from Draine & Li 2007 | |
51 | -; 'J13' model from Jones et al 2013, as updated in | |
52 | -; Koehler et al 2014 | |
53 | -; 'G17_ModelA' model A from Guillet et al (2018). Includes | |
54 | -; polarisation. See Tables 2 and 3 of that paper for details. | |
55 | -; 'G17_ModelB' model B from Guillet et al (2018) | |
56 | -; 'G17_ModelC' model C from Guillet et al (2018) | |
57 | -; 'G17_ModelD' model A from Guillet et al (2018) | |
45 | +; model = specifies the interstellar dust mixture used by | |
46 | +; DustEM. See userguide or dustem_test_model_exists.pro | |
47 | +; for more details about available models in current release. | |
58 | 48 | ; sed_file = string naming the path to text file in .xcat format that |
59 | 49 | ; describes the observational SED. If not set, the file |
60 | 50 | ; 'Data/EXAMPLE_OBSDATA/example_SED_1.xcat' is used. |
... | ... | @@ -62,7 +52,7 @@ PRO dustem_myisrf_example,model=model $ |
62 | 52 | ; postscript = if set, final plot is saved as postscript in the |
63 | 53 | ; current working directory |
64 | 54 | ; Nitermax = maximum number of fit iterations. Default is 5. |
65 | -; fits_save_and_restore = if set, save the fit results in a binary | |
55 | +; fits_save = if set, save the fit results in a binary | |
66 | 56 | ; FITS file. The code then restore this file and plots |
67 | 57 | ; the results using the saved results information. |
68 | 58 | ; help = if set, print this help |
... | ... | @@ -85,7 +75,7 @@ PRO dustem_myisrf_example,model=model $ |
85 | 75 | ; |
86 | 76 | ; |
87 | 77 | ; EXAMPLES |
88 | -; dustem_myisrf_example,isrf_file='my_isrf.xcat',nitermax=10,fits_save_and_restore='/tmp/mysavefile.fits' | |
78 | +; dustem_myisrf_example,isrf_file='my_isrf.xcat',nitermax=10,fits_save='/tmp/mysavefile.fits' | |
89 | 79 | ; |
90 | 80 | ; MODIFICATION HISTORY: |
91 | 81 | ; Evolution details on the DustEMWrap gitlab. |
... | ... | @@ -104,6 +94,9 @@ ENDIF ELSE BEGIN |
104 | 94 | use_model='DBP90' ;default dust model for this example |
105 | 95 | ENDELSE |
106 | 96 | |
97 | +exists=dustem_test_model_exists(use_model) | |
98 | +if exists ne 1 then $ | |
99 | + message,'Unknown dust model' | |
107 | 100 | |
108 | 101 | use_verbose=0 |
109 | 102 | use_polarization=0 ; initialize Dustemwrap in no polarization mode |
... | ... | @@ -158,7 +151,7 @@ llims=replicate(1.e-15,Npar) |
158 | 151 | ;; llimed=replicate(1,Npar) |
159 | 152 | ;; llims=replicate(1.e-15,Npar) |
160 | 153 | ;; ; To suppress the Mathis field altogether |
161 | -;; ;fpd=['(*!dustem_params).gas.G0'] | |
154 | +;; ;fpd=['(*!dustem_params).G0'] | |
162 | 155 | ;; ;fiv=[1.e-12] |
163 | 156 | |
164 | 157 | |
... | ... | @@ -183,6 +176,7 @@ if not keyword_set(isrf_file) then begin |
183 | 176 | mywaves=[] |
184 | 177 | my_isrf_file='./myisrf_3bb_8000K.dat' |
185 | 178 | myisrf=dustem_create_rfield([8000,8000,8000],wdil=[1.d-11,1.d-11,1.d-11],isrf=0,fname=my_isrf_file,x=mywaves) |
179 | +; myisrf=dustem_create_rfield([8000],wdil=[1.d-12],isrf=0,fname=my_isrf_file,x=mywaves) | |
186 | 180 | ;myisrf=dustem_create_rfield([3500,4000,5500,6500,8000],wdil=[1.d-13,1.d-13,1.d-13,1.d-13,1.d-13],isrf=1,fname='./myisrf_mathis_5bb.dat',x=mywaves) |
187 | 181 | ;myisrf=dustem_create_rfield([3500,4000,5500,6500,8000],wdil=[1.d-13,1.d-13,1.d-13,1.d-13,1.d-13],isrf=2,fname='./myisrf_habing_5bb.dat',x=mywaves) |
188 | 182 | ;myisrf=dustem_create_rfield([3500,4000,5500,6500,8000],wdil=[1.d-13,1.d-13,1.d-13,1.d-13,1.d-13],isrf=0,fname='./myisrf_5bb.dat',x=mywaves) |
... | ... | @@ -276,9 +270,9 @@ IF keyword_set(postscript) THEN BEGIN |
276 | 270 | ENDIF |
277 | 271 | |
278 | 272 | IF !dustem_noobj THEN BEGIN |
279 | - dustemwrap_plot_noobj,*(*!dustem_fit).CURRENT_PARAM_VALUES,dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
273 | + dustemwrap_plot_noobj,*(*!dustem_fit).CURRENT_PARAM_VALUES,st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
280 | 274 | ENDIF ELSE BEGIN |
281 | - dustemwrap_plot,*(*!dustem_fit).CURRENT_PARAM_VALUES,dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
275 | + dustemwrap_plot,*(*!dustem_fit).CURRENT_PARAM_VALUES,st=dummy,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (Final fit)' | |
282 | 276 | ENDELSE |
283 | 277 | |
284 | 278 | IF keyword_set(postscript) THEN BEGIN |
... | ... | @@ -292,22 +286,24 @@ if keyword_set(wait) then begin |
292 | 286 | wait,wait |
293 | 287 | end |
294 | 288 | |
295 | -IF keyword_set(fits_save_and_restore) THEN BEGIN | |
296 | - message,'Writing out results structure: '+fits_save_and_restore,/info | |
297 | - dustem_write_fits_table,filename=fits_save_and_restore,help=help | |
289 | +IF keyword_set(fits_save) THEN BEGIN | |
290 | + message,'Writing out results structure: '+fits_save,/info | |
291 | + dustem_write_fits_table,filename=fits_save,help=help | |
298 | 292 | ;=== At this point, you could erase all dustem system variables, or exit idl... all the |
299 | 293 | ;=== information needed to recover the results and remake the plots has been saved in the FITS table |
300 | - ;stop | |
301 | - dustem_read_fits_table,filename=fits_save_and_restore,dustem_st=dustem_spectra_st | |
302 | - ;==== plot result taken from the saved fits table | |
303 | - res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
304 | - IF !dustem_noobj THEN BEGIN | |
305 | - dustemwrap_plot_noobj,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
306 | - ENDIF ELSE BEGIN | |
307 | - dustemwrap_plot,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
308 | - ENDELSE | |
309 | - IF keyword_set(wait) THEN BEGIN | |
310 | - message,'Saved the results as FITS in the file: '+fits_save_and_restore+', and made a plot using the data in this file',/info | |
294 | + | |
295 | +; Moved following to dustem_fitsio_example | |
296 | + ;; dustem_read_fits_table,filename=fits_save,dustem_st=dustem_spectra_st | |
297 | + ;; ;==== plot result taken from the saved fits table | |
298 | + ;; res=*(*!dustem_fit).CURRENT_PARAM_VALUES | |
299 | + ;; IF !dustem_noobj THEN BEGIN | |
300 | + ;; dustemwrap_plot_noobj,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
301 | + ;; ENDIF ELSE BEGIN | |
302 | + ;; dustemwrap_plot,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
303 | + ;; ENDELSE | |
304 | + | |
305 | + IF keyword_set(wait) THEN BEGIN | |
306 | + message,'Saved the results as FITS in the file: '+fits_save,/info | |
311 | 307 | wait,wait |
312 | 308 | ENDIF |
313 | 309 | ENDIF | ... | ... |
src/idl/dustem_run_example.pro
... | ... | @@ -17,19 +17,9 @@ PRO dustem_run_example, model $ |
17 | 17 | ; dustem_run_example,model,show=show,postscript=postscript,help=help |
18 | 18 | ; |
19 | 19 | ; INPUTS: |
20 | -; model = specifies the interstellar dust mixture used by DustEM | |
21 | -; 'MC10' model from Compiegne et al 2010 (default) | |
22 | -; 'DBP90' model from Desert et al 1990 | |
23 | -; 'DL01' model from Draine & Li 2001 | |
24 | -; 'WD01_RV5p5B' model from Weingartner & Draine 2002 with Rv=5.5 | |
25 | -; 'DL07' model from Draine & Li 2007 | |
26 | -; 'J13' model from Jones et al 2013, as updated in | |
27 | -; Koehler et al 2014 | |
28 | -; 'G17_ModelA' model A from Guillet et al (2018). Includes | |
29 | -; polarisation. See Tables 2 and 3 of that paper for details. | |
30 | -; 'G17_ModelB' model B from Guillet et al (2018) | |
31 | -; 'G17_ModelC' model C from Guillet et al (2018) | |
32 | -; 'G17_ModelD' model D from Guillet et al (2018) | |
20 | +; model = specifies the interstellar dust mixture used by | |
21 | +; DustEM. See userguide or dustem_test_model_exists.pro | |
22 | +; for more details about available models in current release. | |
33 | 23 | ; |
34 | 24 | ; OPTIONAL INPUT PARAMETERS: |
35 | 25 | ; show = vector specifying the type of plot(s) to show. Possible |
... | ... | @@ -92,15 +82,10 @@ ENDIF ELSE BEGIN |
92 | 82 | use_show=['all'] ;Default is to show everything |
93 | 83 | ENDELSE |
94 | 84 | |
95 | -known_mdls=['MC10','DBP90','DL01','WD01_RV5P5B','DL07','J13','G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
96 | -pol_mdls=['G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
97 | -test_model = where(known_mdls eq strupcase(model),ct) | |
98 | -if ct eq 0 then begin | |
99 | - message,'ISM dust model '+model+' unknown',/continue | |
100 | - message,'Known models are MC10,DBP90,DL01,WD01_RV5P5B,DL07,J13,G17_MODELA,G17_MODELB,G17_MODELC,G17_MODELD',/continue | |
101 | - stop | |
102 | -end | |
103 | -test_pol_model = where(pol_mdls eq model,polct) | |
85 | +exists=dustem_test_model_exists(model) | |
86 | +if exists ne 1 then $ | |
87 | + message,'Unknown dust model' | |
88 | +polct=dustem_test_model_exists(model,/pol,/silent) | |
104 | 89 | |
105 | 90 | ;== INITIALISE DUSTEM |
106 | 91 | dustem_init,model=model |
... | ... | @@ -151,11 +136,11 @@ match,rfield_plot,use_show,a,b |
151 | 136 | if total(a,/nan) ne -1 then begin |
152 | 137 | xtit=textoidl('\lambda (\mum)') |
153 | 138 | ytit=textoidl('log ISRF [4 \pi I_\nu (erg/cm^2/s/Hz)]') |
154 | - tit='DustEM_run_example ISRF' | |
139 | + tit='DustEM_run_example : ISRF' | |
155 | 140 | yr=[min(st_model.isrf.isrf),5.*max(st_model.isrf.isrf)] |
156 | 141 | xr=[min(st_model.isrf.lambisrf),max(st_model.isrf.lambisrf)] |
157 | 142 | IF not keyword_set(postscript) THEN BEGIN |
158 | - window,use_win,xs=600,ys=400,tit='DUSTEM_SHOW_FORTRAN: ISRF '+strtrim(use_win,2) & use_win=use_win+2 | |
143 | + window,use_win,xs=600,ys=400,tit='DustEM-run_example: ISRF '+strtrim(use_win,2) & use_win=use_win+2 | |
159 | 144 | cgplot,st_model.isrf.lambisrf,st_model.isrf.isrf $ |
160 | 145 | ,yr=yr,/ysty,xr=xr,/xsty,/xlog,/ylog $ |
161 | 146 | ,title=tit,xtit=xtit,ytit=ytit,color=cgcolor('black'),/nodata | ... | ... |
src/idl/dustem_stellarpopisrf_example.pro
... | ... | @@ -45,19 +45,9 @@ PRO dustem_stellarpopisrf_example,model=model $ |
45 | 45 | ; Plots, results structure in binary FITS table format |
46 | 46 | ; |
47 | 47 | ; ACCEPTED KEY-WORDS: |
48 | -; model = specifies the interstellar dust mixture used by DustEM | |
49 | -; 'MC10' model from Compiegne et al 2010 | |
50 | -; 'DBP90' model from Desert et al 1990 | |
51 | -; 'DL01' model from Draine & Li 2001 | |
52 | -; 'WD01_RV5p5B' model from Weingartner & Draine 2002 with Rv=5.5 | |
53 | -; 'DL07' model from Draine & Li 2007 | |
54 | -; 'J13' model from Jones et al 2013, as updated in | |
55 | -; Koehler et al 2014 | |
56 | -; 'G17_ModelA' model A from Guillet et al (2018). Includes | |
57 | -; polarisation. See Tables 2 and 3 of that paper for details. | |
58 | -; 'G17_ModelB' model B from Guillet et al (2018) | |
59 | -; 'G17_ModelC' model C from Guillet et al (2018) | |
60 | -; 'G17_ModelD' model A from Guillet et al (2018) | |
48 | +; model = specifies the interstellar dust mixture used by | |
49 | +; DustEM. See userguide or dustem_test_model_exists.pro | |
50 | +; for more details about available models in current release. | |
61 | 51 | ; sed_file = string naming the path to text file in .xcat format that |
62 | 52 | ; describes the observational SED. If not set, the file |
63 | 53 | ; 'Data/EXAMPLE_OBSDATA/example_SED_2.xcat' is used. |
... | ... | @@ -109,13 +99,9 @@ ENDIF ELSE BEGIN |
109 | 99 | use_model='DBP90' ;Default is last dustem model |
110 | 100 | ENDELSE |
111 | 101 | |
112 | -known_mdls=['MC10','DBP90','DL01','WD01_RV5P5B','DL07','J13','G17_MODELA','G17_MODELB','G17_MODELC','G17_MODELD'] | |
113 | -test_model = where(known_mdls eq use_model,ct) | |
114 | -if ct eq 0 then begin | |
115 | - message,'ISM dust model '+use_model+' unknown',/continue | |
116 | - message,'Known models are MC10,DBP90,DL01,WD01_RV5P5B,DL07,J13,G17_MODELA,G17_MODELB,G17_MODELC,G17_MODELD',/continue | |
117 | - stop | |
118 | -end | |
102 | +exists=dustem_test_model_exists(use_model) | |
103 | +if exists eq 0 then $ | |
104 | + message,'Unknown dust model' | |
119 | 105 | |
120 | 106 | use_polarization=0 ; initialize Dustemwrap in no polarization mode |
121 | 107 | use_verbose=0 | ... | ... |