Commit 68d2f391795c9cde8d3605bfb67d4bf5255be115
1 parent
98d63e54
Exists in
master
modified to cope with spinning dust
Showing
10 changed files
with
222 additions
and
95 deletions
Show diff stats
src/idl/dustem_fit_sed_readme.pro
... | ... | @@ -218,6 +218,11 @@ st=dustem_set_data(sed=spec) |
218 | 218 | |
219 | 219 | ;== SET THE FITTED PARAMETERS |
220 | 220 | dustem_init_parinfo,pd,iv,up_limited=ulimed,lo_limited=llimed,up_limits=ulims,lo_limits=llims |
221 | +;==== below is to reset the defaults keywords for PAH which in newer version of the fortran include spin and mix, ... | |
222 | +;(*!dustem_params).grains[0].TYPE_KEYWORDS='logn' | |
223 | +;(*!dustem_params).grains[1].TYPE_KEYWORDS='logn' | |
224 | +(*!dustem_params).grains[0].TYPE_KEYWORDS='logn' | |
225 | +(*!dustem_params).grains[1].TYPE_KEYWORDS='logn' | |
221 | 226 | ;stop |
222 | 227 | ;dustem_sort_params |
223 | 228 | ;hprint,*(*!dustem_fit).param_descs |
... | ... | @@ -276,15 +281,19 @@ dustem_sed_plot,(*(*!dustem_fit).current_param_values), $ |
276 | 281 | ;====================================== |
277 | 282 | ;====You can exit IDL here and re-enter |
278 | 283 | ;====================================== |
279 | -window,1 | |
284 | +window,2 | |
280 | 285 | |
281 | 286 | ;=== RESTORE FIT RESULTS |
282 | 287 | ;=== initialise dustem |
283 | -dustem_init,mode=mode | |
288 | +dustem_init,mode=use_mode | |
284 | 289 | ;file=getenv('DUSTEM_RES')+'DUSTEM_fit_example.sav' |
285 | 290 | file=!dustem_res+'DUSTEM_fit_example.sav' |
286 | 291 | dustem_restore_sed_fit,file |
287 | 292 | |
293 | +;==== below is to reset the defaults keywords for PAH which in newer version of the fortran include spin and mix, ... | |
294 | +(*!dustem_params).grains[0].TYPE_KEYWORDS='logn' | |
295 | +(*!dustem_params).grains[1].TYPE_KEYWORDS='logn' | |
296 | + | |
288 | 297 | ;=== recover best fit values |
289 | 298 | ;ind=where(*!dustem_fit_chi2 EQ min(*!dustem_fit_chi2)) |
290 | 299 | ;res=(*!dustem_fit_params); | ... | ... |
src/idl/dustem_fit_sed_spinning_readme.pro
... | ... | @@ -195,7 +195,12 @@ st=dustem_set_data(sed=spec) |
195 | 195 | dustem_init_parinfo,pd,iv,up_limited=ulimed,lo_limited=llimed,up_limits=ulims,lo_limits=llims |
196 | 196 | ;stop |
197 | 197 | ;help,(*!dustem_params).grains[0],/str |
198 | -;(*!dustem_params).grains[0].TYPE_KEYWORDS='mix-logn-spin' | |
198 | +(*!dustem_params).grains[0].TYPE_KEYWORDS='logn-spin' | |
199 | +(*!dustem_params).grains[1].TYPE_KEYWORDS='logn-spin' | |
200 | +;(*!dustem_params).grains[0].TYPE_KEYWORDS='logn-chrg' | |
201 | +;(*!dustem_params).grains[1].TYPE_KEYWORDS='logn-chrg' | |
202 | +;(*!dustem_params).grains[0].TYPE_KEYWORDS='logn-mix-spin' | |
203 | +;(*!dustem_params).grains[1].TYPE_KEYWORDS='logn-mix-spin' | |
199 | 204 | |
200 | 205 | ;dustem_sort_params |
201 | 206 | ;hprint,*(*!dustem_fit).param_descs |
... | ... | @@ -248,6 +253,13 @@ dustem_init,mode=mode |
248 | 253 | file=!dustem_res+'DUSTEM_fit_example.sav' |
249 | 254 | dustem_restore_sed_fit,file |
250 | 255 | |
256 | +;(*!dustem_params).grains[0].TYPE_KEYWORDS='logn-chrg' | |
257 | +;(*!dustem_params).grains[1].TYPE_KEYWORDS='logn-chrg' | |
258 | +;(*!dustem_params).grains[0].TYPE_KEYWORDS='logn-mix-spin' | |
259 | +;(*!dustem_params).grains[1].TYPE_KEYWORDS='logn-mix-spin' | |
260 | +(*!dustem_params).grains[0].TYPE_KEYWORDS='logn-spin' | |
261 | +(*!dustem_params).grains[1].TYPE_KEYWORDS='logn-spin' | |
262 | + | |
251 | 263 | ;=== recover best fit values |
252 | 264 | ;ind=where(*!dustem_fit_chi2 EQ min(*!dustem_fit_chi2)) |
253 | 265 | ;res=(*!dustem_fit_params); | ... | ... |
src/idl/dustem_read_all_web3p8.pro
1 | -FUNCTION dustem_read_all_web3p8,dir_in,silent=silent | |
1 | +FUNCTION dustem_read_all_web3p8,dir_in,silent=silent,help=help | |
2 | + | |
3 | +;+ | |
4 | +; NAME: | |
5 | +; dustem_read_all_web3p8 | |
6 | +; PURPOSE: | |
7 | +; Reads all Dustem input data, as of the web available dustem fortran version | |
8 | +; CATEGORY: | |
9 | +; Dustem | |
10 | +; CALLING SEQUENCE: | |
11 | +; st=dustem_read_all_web3p8(dir_in[,/silent]) | |
12 | +; INPUTS: | |
13 | +; dir_in: input directory | |
14 | +; OPTIONAL INPUT PARAMETERS: | |
15 | +; None | |
16 | +; OUTPUTS: | |
17 | +; None | |
18 | +; OPTIONAL OUTPUT PARAMETERS: | |
19 | +; None | |
20 | +; ACCEPTED KEY-WORDS: | |
21 | +; help = If set, print this help | |
22 | +; sielnt = If set, keep silent | |
23 | +; COMMON BLOCKS: | |
24 | +; None | |
25 | +; SIDE EFFECTS: | |
26 | +; None | |
27 | +; RESTRICTIONS: | |
28 | +; The dustem idl wrapper must be installed | |
29 | +; PROCEDURE: | |
30 | +; None | |
31 | +; EXAMPLES | |
32 | +; | |
33 | +; MODIFICATION HISTORY: | |
34 | +; Written by J.-Ph. Bernard | |
35 | +; see evolution details on the dustem cvs maintained at CESR | |
36 | +; Contact J.-Ph. Bernard (Jean-Philippe.Bernard@cesr.fr) in case of problems. | |
37 | +;- | |
38 | + | |
39 | +IF keyword_set(help) THEN BEGIN | |
40 | + doc_library,'dustem_read_all_web3p8' | |
41 | + st=0 | |
42 | + goto,the_end | |
43 | +ENDIF | |
2 | 44 | |
3 | 45 | dir_in_dat=dir_in+'/data/' |
4 | 46 | dir_in_qabs=dir_in+'/oprop/' |
... | ... | @@ -13,6 +55,9 @@ Ngrains=n_elements(st_grains) |
13 | 55 | file=dir_in_dat+'ISRF.DAT' |
14 | 56 | st_isrf=dustem_read_isrf(file,silent=silent,Nisrf=Nisrf) |
15 | 57 | |
58 | +file=dir_in_dat+'GAS.DAT' | |
59 | +st_gas=dustem_read_gas(file,silent=silent) | |
60 | + | |
16 | 61 | ;=== Read Qabs |
17 | 62 | |
18 | 63 | st_qabs=ptrarr(Ngrains) |
... | ... | @@ -46,6 +91,7 @@ FOR i=0L,Ngrains-1 DO BEGIN |
46 | 91 | ENDELSE |
47 | 92 | ENDFOR |
48 | 93 | |
94 | +;stop | |
49 | 95 | ;=== Read MIX files |
50 | 96 | st_mix = ptrarr(Ngrains) |
51 | 97 | FOR i=0L,Ngrains-1 DO BEGIN |
... | ... | @@ -58,6 +104,30 @@ FOR i=0L,Ngrains-1 DO BEGIN |
58 | 104 | ENDELSE |
59 | 105 | ENDFOR |
60 | 106 | |
107 | +;=== Read CHRG files | |
108 | +st_chrg = ptrarr(Ngrains) | |
109 | +FOR i=0L,Ngrains-1 DO BEGIN | |
110 | + IF stregex(st_grains(i).type_keywords, 'chrg', /bool) THEN BEGIN | |
111 | + chrg_file=dir_in_dat+'CHRG_'+st_grains(i).grain_type+'.DAT' | |
112 | + st=dustem_read_chrg(chrg_file,silent=silent) | |
113 | + st_chrg(i)=ptr_new(st) | |
114 | + ENDIF ELSE BEGIN | |
115 | + st_chrg(i)=ptr_new() | |
116 | + ENDELSE | |
117 | +ENDFOR | |
118 | + | |
119 | +;=== Read SPIN files | |
120 | +st_spin = ptrarr(Ngrains) | |
121 | +FOR i=0L,Ngrains-1 DO BEGIN | |
122 | + IF stregex(st_grains(i).type_keywords, 'spin', /bool) THEN BEGIN | |
123 | + chrg_file=dir_in_dat+'SPIN_'+st_grains[i].grain_type+'.DAT' | |
124 | + st=dustem_read_spin(chrg_file,silent=silent) | |
125 | + st_spin[i]=ptr_new(st) | |
126 | + ENDIF ELSE BEGIN | |
127 | + st_spin[i]=ptr_new() | |
128 | + ENDELSE | |
129 | +ENDFOR | |
130 | + | |
61 | 131 | ;stop |
62 | 132 | |
63 | 133 | ;=== Read POL and Qabs files |
... | ... | @@ -121,17 +191,11 @@ if !run_tls then begin |
121 | 191 | ENDFOR |
122 | 192 | ENDIF |
123 | 193 | |
124 | -;VG Add NH | |
125 | -;if !run_pol then begin | |
126 | -; st={grain:st_grains,isrf:st_isrf,qabs:st_qabs,calor:st_calor,lambda:st_lambda,size:st_size,mix:st_mix,align:st_align,qpol:st_qpol,qcirc:st_qcirc,qH:st_qH,tls:st_tls} | |
127 | -;endif else begin | |
128 | -; st={grain:st_grains,isrf:st_isrf,qabs:st_qabs,calor:st_calor,lambda:st_lambda,size:st_size,mix:st_mix,tls:st_tls} | |
129 | -;endelse | |
130 | - | |
131 | -;st={Ngrains:Ngrains,G0:G0,Keywords:key_str,grains:st_grains, $ | |
132 | -; isrf:st_isrf,qabs:st_qabs,calor:st_calor,lambda:st_lambda,size:st_size,mix:st_mix,pol:st_pol,qabspol:st_qabspol,tls:st_tls} | |
194 | +;=== This will become !dustem_params | |
133 | 195 | st={Ngrains:Ngrains,G0:G0,Keywords:key_str,grains:st_grains, $ |
134 | - isrf:st_isrf,qabs:st_qabs,calor:st_calor,lambda:st_lambda,size:st_size,mix:st_mix,pol:st_pol,tls:st_tls} | |
196 | + isrf:st_isrf,qabs:st_qabs,calor:st_calor,lambda:st_lambda,size:st_size,mix:st_mix,chrg:st_chrg,gas:st_gas,spin:st_spin,pol:st_pol,tls:st_tls} | |
197 | + | |
198 | +the_end: | |
135 | 199 | |
136 | 200 | RETURN,st |
137 | 201 | ... | ... |
src/idl/dustem_read_grain.pro
1 | -FUNCTION dustem_read_grain,file,silent=silent,key_str=key_str,G0=G0 | |
1 | +FUNCTION dustem_read_grain,file,silent=silent,key_str=key_str,G0=G0,help=help | |
2 | + | |
3 | +;+ | |
4 | +; NAME: | |
5 | +; dustem_read_grain | |
6 | +; PURPOSE: | |
7 | +; reads the file GRAIN.dat and returns the corresponding grain structure | |
8 | +; CATEGORY: | |
9 | +; Dustem | |
10 | +; CALLING SEQUENCE: | |
11 | +; st=dustem_read_grain(file,[/silent][,key_str=][,G0=][,/help]) | |
12 | +; INPUTS: | |
13 | +; file = file name to be read | |
14 | +; OPTIONAL INPUT PARAMETERS: | |
15 | +; None | |
16 | +; OUTPUTS: | |
17 | +; st: output structure | |
18 | +; OPTIONAL OUTPUT PARAMETERS: | |
19 | +; key_str : a string containing grain keywords | |
20 | +; G0 : The G0 value (scaling factor for radiation field) | |
21 | +; ACCEPTED KEY-WORDS: | |
22 | +; help = If set, print this help | |
23 | +; silent = If set, keeps quiet | |
24 | +; COMMON BLOCKS: | |
25 | +; None | |
26 | +; SIDE EFFECTS: | |
27 | +; None | |
28 | +; RESTRICTIONS: | |
29 | +; The dustem idl wrapper must be installed | |
30 | +; PROCEDURE: | |
31 | +; None | |
32 | +; EXAMPLES | |
33 | +; | |
34 | +; MODIFICATION HISTORY: | |
35 | +; Written by J.-Ph. Bernard, N. Flagey, D. Paradis Jan 2007 | |
36 | +; see evolution details on the dustem cvs maintained at CESR | |
37 | +; Contact J.-Ph. Bernard (Jean-Philippe.Bernard@cesr.fr) in case of problems. | |
38 | +;- | |
2 | 39 | |
3 | 40 | ;=== Format for DUSTEM_WHICH=VERSTRAETE |
4 | 41 | ;; # DUSTEM: definition of grain populations |
... | ... | @@ -34,16 +71,19 @@ FUNCTION dustem_read_grain,file,silent=silent,key_str=key_str,G0=G0 |
34 | 71 | ;; 1.000000 |
35 | 72 | ;; PAH0 10 mix-logn 7.8000E-04 2.2400E+00 3.5000E-08 1.2000E-07 6.4000E-08 1.0000E-01 |
36 | 73 | ;; PAH1 10 mix-logn 7.8000E-04 2.2400E+00 3.5000E-08 1.2000E-07 6.4000E-08 1.0000E-01 |
37 | -;; amCBEx 15 logn 1.6500E-04 1.8100E+00 6.0000E-08 2.0000E-06 2.0000E-07 3.5000E-01 | |
38 | -;; amCBEx 25 plaw-ed 1.4500E-03 1.8100E+00 4.0000E-07 2.0000E-04 -2.8000E+00 1.5000E-05 1.5000E-05 2.0000E+00 | |
39 | -;; aSil 25 plaw-ed 7.8000E-03 3.5000E+00 4.0000E-07 2.0000E-04 -3.4000E+00 2.0000E-05 2.0000E-05 2.0000E+00 | |
74 | +;; amCBEx 15 logn 1.6500E-04 1.8100E+00 6.0000E-08 2.0000E-06 2.0000E-07 3.5000E-01 | |
75 | +;; amCBEx 25 plaw-ed 1.4500E-03 1.8100E+00 4.0000E-07 2.0000E-04 -2.8000E+00 1.5000E-05 1.5000E-05 2.0000E+00 | |
76 | +;; aSil 25 plaw-ed 7.8000E-03 3.5000E+00 4.0000E-07 2.0000E-04 -3.4000E+00 2.0000E-05 2.0000E-05 2.0000E+00 | |
77 | + | |
78 | +IF keyword_set(help) THEN BEGIN | |
79 | + doc_library,'dustem_read_grain' | |
80 | + full_st=0. | |
81 | + goto,the_end | |
82 | +ENDIF | |
40 | 83 | |
41 | -;VG | |
42 | 84 | defsysv, '!run_pol', 0. ; Global flag to know if polarisation is being run |
43 | -;DP | |
44 | -defsysv,'!run_tls',0. | |
85 | +defsysv,'!run_tls',0. ; Global flag to know if TLS is being run | |
45 | 86 | |
46 | -;CASE getenv('DUSTEM_WHICH') OF | |
47 | 87 | CASE !dustem_which OF |
48 | 88 | 'WEB3p8': BEGIN |
49 | 89 | frmt='(A,D,D,D,D,D,I,A)' |
... | ... | @@ -56,7 +96,7 @@ CASE !dustem_which OF |
56 | 96 | Nlines=Nlines+1 |
57 | 97 | ENDWHILE |
58 | 98 | close,unit |
59 | -free_lun,unit | |
99 | + free_lun,unit | |
60 | 100 | ;== now read the file |
61 | 101 | openr,unit,file,/get_lun |
62 | 102 | ncurrent=0L |
... | ... | @@ -67,32 +107,21 @@ free_lun,unit |
67 | 107 | ENDREP UNTIL first_char NE '#' |
68 | 108 | key_str=str |
69 | 109 | readf,unit,G0 & ncurrent=ncurrent+1 |
70 | - ;=== | |
71 | -; readf,unit,nspecies | |
72 | 110 | nspecies=nlines-ncurrent |
73 | -; stop | |
74 | -;; # grain type, nsize, type keywords, Mdust/MH, rho, amin, amax, alpha/a0 [, at, ac, gamma (ED)] [, au, zeta, eta (CV)] | |
75 | 111 | one_st={grain_type:'',nsize:0L,type_keywords:'',Mdust_o_MH:0.D0,rho:0.D0,amin:0.D0,amax:0.D0,alpha_o_a0:0.D0, $ |
76 | 112 | at:0.D0,ac:0.D0,gamma:0.D0, $ |
77 | 113 | au:0.D0,zeta:0.D0,eta:0.D0} |
78 | 114 | st=replicate(one_st,nspecies) |
79 | 115 | FOR i=0L,nspecies-1 DO BEGIN |
80 | 116 | readf,unit,str |
81 | -;VG : remove leading blanks | |
82 | - ;strv=str_sep(strcompress(str),' ') | |
83 | 117 | strv=str_sep(strcompress(strtrim(str,2)),' ') |
84 | -;VG | |
85 | 118 | Nstrv=n_elements(strv) |
86 | 119 | ii=0L |
87 | 120 | st(i).grain_type=strv(ii) & ii=ii+1 |
88 | 121 | st(i).nsize=long(strv(ii)) & ii=ii+1 |
89 | 122 | st(i).type_keywords=strv(ii) & ii=ii+1 |
90 | -;VG | |
91 | 123 | IF stregex(st(i).type_keywords, 'pol', /bool) THEN !run_pol = 1 |
92 | -;VG | |
93 | -;DP | |
94 | 124 | IF stregex(st(i).type_keywords, 'dtls', /bool) THEN !run_tls = 1 |
95 | - | |
96 | 125 | st(i).Mdust_o_MH=double(strv(ii)) & ii=ii+1 |
97 | 126 | st(i).rho=double(strv(ii)) & ii=ii+1 |
98 | 127 | st(i).amin=double(strv(ii)) & ii=ii+1 |
... | ... | @@ -117,7 +146,6 @@ free_lun,unit |
117 | 146 | st(i).eta=double(strv(ii)) & ii=ii+1 |
118 | 147 | ENDIF |
119 | 148 | ENDFOR |
120 | -; full_st={keywords:key_str,G0:G0,Ngrains:fix(nspecies),grains:st} | |
121 | 149 | full_st=st |
122 | 150 | close,unit |
123 | 151 | free_lun,unit |
... | ... | @@ -147,7 +175,6 @@ free_lun,unit |
147 | 175 | st(i).ndiscr=fix(strv(6)) |
148 | 176 | st(i).flag=strv(7) |
149 | 177 | ENDFOR |
150 | -; full_st={keywords:key_str,G0:G0,Ngrains:fix(nspecies),grains:st} | |
151 | 178 | full_st=st |
152 | 179 | close,unit |
153 | 180 | free_lun,unit |
... | ... | @@ -169,8 +196,9 @@ free_lun,unit |
169 | 196 | END |
170 | 197 | ENDCASE |
171 | 198 | |
172 | -RETURN,full_st | |
199 | +the_end: | |
173 | 200 | |
201 | +RETURN,full_st | |
174 | 202 | |
175 | 203 | END |
176 | 204 | ... | ... |
src/idl/dustem_read_mix.pro
... | ... | @@ -6,10 +6,15 @@ FUNCTION dustem_read_mix,file,silent=silent |
6 | 6 | openr,unit,file,/get_lun |
7 | 7 | |
8 | 8 | ;==read comments |
9 | - str='' & first_char='#' | |
9 | + str='' | |
10 | + first_char='#' | |
11 | + comments=[''] | |
12 | + Ncomments=0L | |
10 | 13 | WHILE first_char EQ '#' DO BEGIN |
11 | 14 | readf,unit,str |
12 | 15 | first_char=strmid(str,0,1) |
16 | + comments=[comments,str] | |
17 | + IF first_char EQ '#' THEN Ncomments=Ncomments+1 | |
13 | 18 | ENDWHILE |
14 | 19 | |
15 | 20 | ;==read FMIX |
... | ... | @@ -22,7 +27,7 @@ FUNCTION dustem_read_mix,file,silent=silent |
22 | 27 | fmix = tmp |
23 | 28 | |
24 | 29 | ;==save and return structure |
25 | - full_st={file:file,fmix:fmix} | |
30 | + full_st={file:file,fmix:fmix,comments:comments} | |
26 | 31 | |
27 | 32 | close,unit |
28 | 33 | free_lun,unit | ... | ... |
src/idl/dustem_run.pro
src/idl/dustem_set_params.pro
1 | 1 | PRO dustem_set_params,params |
2 | 2 | |
3 | 3 | ;if empty description, do nothing |
4 | - ind=where(*(*!dustem_fit).param_descs EQ '',count) | |
5 | - | |
6 | -IF count EQ n_elements(*(*!dustem_fit).param_descs) THEN goto,the_end | |
4 | +ind=where(*(*!dustem_fit).param_descs EQ '',count) | |
5 | +IF count EQ n_elements(*(*!dustem_fit).param_descs) THEN BEGIN | |
6 | + message,'param_descs not set. Doing nothing',/continue | |
7 | + stop | |
8 | + goto,the_end | |
9 | +ENDIF | |
7 | 10 | |
8 | 11 | Nparams=n_elements(*(*!dustem_fit).param_descs) |
9 | 12 | |
... | ... | @@ -14,7 +17,7 @@ FOR i=0L,Nparams-1 DO BEGIN |
14 | 17 | IF (*(*!dustem_fit).param_func)(i) EQ 0 THEN BEGIN |
15 | 18 | str=(*(*!dustem_fit).param_descs)(i)+'=params(i)' |
16 | 19 | toto=execute(str) |
17 | - print,params(i) | |
20 | + ;print,params[i] | |
18 | 21 | IF !dustem_verbose NE 0 THEN message,str,/info |
19 | 22 | ENDIF ELSE BEGIN |
20 | 23 | length=strlen((*(*!dustem_fit).param_descs)(i)) |
... | ... | @@ -22,12 +25,9 @@ FOR i=0L,Nparams-1 DO BEGIN |
22 | 25 | ; stop |
23 | 26 | IF strr NE 'continuum' THEN BEGIN |
24 | 27 | IF strr eq 'isrf2' then strr = 'isrf' |
25 | -; IF getenv('DUSTEM_WHICH') EQ 'VERSTRAETE' THEN BEGIN | |
26 | 28 | IF !dustem_which EQ 'VERSTRAETE' THEN BEGIN |
27 | -; ddir=GETENV('DUSTEM_DAT')+'les_DAT/' | |
28 | 29 | ddir=!dustem_dat+'les_DAT/' |
29 | 30 | ENDIF ELSE BEGIN |
30 | -; ddir=GETENV('DUSTEM_DAT') | |
31 | 31 | ddir=!dustem_dat |
32 | 32 | ENDELSE |
33 | 33 | ; JPB: Caution this line reads ISRF.DAT through an execute statement |
... | ... | @@ -40,9 +40,7 @@ FOR i=0L,Nparams-1 DO BEGIN |
40 | 40 | ENDIF |
41 | 41 | ENDELSE |
42 | 42 | ENDFOR |
43 | -;print,'before dustem_write' | |
44 | -;stop | |
45 | -;dustem_write_all,*!dustem_params,getenv('DUSTEM_DAT') | |
43 | + | |
46 | 44 | dustem_write_all,*!dustem_params,!dustem_dat |
47 | 45 | |
48 | 46 | the_end: | ... | ... |
src/idl/dustem_write_all_web3p8.pro
... | ... | @@ -14,38 +14,39 @@ dustem_write_lambda,file_out,st.lambda |
14 | 14 | |
15 | 15 | ;== GRAIN |
16 | 16 | file_out=dir_out_dat+'GRAIN.DAT' |
17 | -;file_out=dir_out_dat+((*!dustem_inputs).grain) | |
18 | 17 | dustem_write_grain_web3p8,file_out,st.grains |
19 | 18 | |
19 | +;== GAS | |
20 | +file_out=dir_out_dat+'GAS.DAT' | |
21 | +dustem_write_gas,file_out,st.gas | |
22 | + | |
23 | +stop | |
24 | + | |
25 | +;== SPIN | |
26 | +dustem_write_spin,dir_out_dat,st.spin | |
27 | + | |
28 | +;== CHRG | |
29 | +dustem_write_chrg,dir_out_dat,st.chrg | |
30 | + | |
20 | 31 | ;== MIX |
21 | -file_out=dir_out_dat | |
22 | -dustem_write_mix,file_out,st.mix | |
32 | +dustem_write_mix,dir_out_dat,st.mix | |
23 | 33 | |
24 | 34 | ;== SIZE |
25 | -file_out=dir_out_dat | |
26 | -dustem_write_size_lv,file_out,st.size | |
35 | +dustem_write_size_lv,dir_out_dat,st.size | |
27 | 36 | |
28 | 37 | ;== QABS |
29 | -file_out=dir_out_qabs | |
30 | -dustem_write_qabs_lv,file_out,st.qabs | |
38 | +dustem_write_qabs_lv,dir_out_qabs,st.qabs | |
31 | 39 | |
32 | 40 | ;== CALOR |
33 | -file_out=dir_out_capa | |
34 | -dustem_write_calor_lv,file_out,st.calor | |
41 | +dustem_write_calor_lv,dir_out_capa,st.calor | |
35 | 42 | |
36 | -;VGb : add polarization | |
37 | 43 | ;== POL |
38 | -file_out=dir_out_dat | |
39 | -dustem_write_pol,file_out,st.pol | |
40 | -file_out=dir_out_qabs | |
41 | -for i_axis = 1, 3 do dustem_write_qabspol,file_out,st,i_axis | |
42 | -;VGe | |
44 | +dustem_write_pol,dir_out_dat,st.pol | |
45 | +FOR i_axis = 1, 3 DO dustem_write_qabspol,dir_out_qabs,st,i_axis | |
43 | 46 | |
44 | -;DP : add TLS | |
47 | +;== TLS | |
45 | 48 | file_out=dir_out_dat |
46 | -;stop | |
47 | -dustem_write_tls,file_out,st.tls | |
48 | -file_out=dir_out_qabs | |
49 | +dustem_write_tls,dir_out_dat,st.tls | |
49 | 50 | |
50 | 51 | sortie: |
51 | 52 | ... | ... |
src/idl/dustem_write_grain_web3p8.pro
src/idl/dustem_write_mix.pro
1 | 1 | PRO dustem_write_mix,dir,st |
2 | 2 | |
3 | -;Writes ALL the MIX_xxx.DAT files | |
3 | +IF ptr_valid(st[0]) THEN BEGIN | |
4 | + comments=(*st[0]).comments | |
5 | + Ncomments=n_elements(comments) | |
6 | +ENDIF ELSE BEGIN | |
7 | + Ncomments=0L | |
8 | +ENDELSE | |
4 | 9 | |
5 | - Ncomments=5 | |
6 | - c=strarr(Ncomments) | |
10 | +Nst=n_elements(st) | |
7 | 11 | |
8 | - c(0)='# DUSTEM: mixing coefficient' | |
9 | - c(1)='# fraction of neutral PAHs' | |
10 | - c(2)='#' | |
11 | - c(3)='# f_mix' | |
12 | - c(4)='#' | |
13 | - | |
14 | - Nst=n_elements(st) | |
15 | - | |
16 | -;stop | |
17 | - | |
18 | - frmt='(E14.6)' | |
12 | + | |
13 | +frmts=[ $ | |
14 | + '(A)', $ | |
15 | + '(A)', $ | |
16 | + '(A)', $ | |
17 | + '(A)', $ | |
18 | + '(A)'] | |
19 | 19 | |
20 | 20 | ;Start loop over type of grain |
21 | - FOR i=0L,Nst-1 DO BEGIN | |
22 | -;Test if the pointer is pointing to something | |
23 | - IF ptr_valid(st(i)) THEN BEGIN | |
24 | -;Get filename | |
21 | +FOR i=0L,Nst-1 DO BEGIN | |
22 | + ;Test if the pointer is pointing to something | |
23 | + IF ptr_valid(st(i)) THEN BEGIN | |
24 | + ;Get filename | |
25 | 25 | ffile=(*st(i)).file |
26 | 26 | fv=str_sep(ffile,'/') |
27 | 27 | file=dir+fv(n_elements(fv)-1) |
28 | -;Open file | |
28 | + ;Open file | |
29 | + message,'Will write MIX file '+file,/continue | |
29 | 30 | openw,unit,file,/get_lun |
30 | -;Print comments | |
31 | - FOR ii=0,Ncomments-1 DO BEGIN | |
32 | - printf,unit,c(ii) | |
33 | - ENDFOR | |
34 | -;Print FMIX | |
31 | + ;Print comments | |
32 | + IF Ncomments NE 0 THEN BEGIN | |
33 | + FOR ii=0,Ncomments-1 DO BEGIN | |
34 | + printf,unit,comments[ii] | |
35 | + ENDFOR | |
36 | + ENDIF | |
37 | + ;Print FMIX | |
35 | 38 | FOR k=0L,n_elements((*st(i)).fmix)-1 DO BEGIN |
36 | - printf,unit,((*st(i)).fmix)(k),format=frmt | |
39 | + printf,unit,((*st(i)).fmix)(k),format=frmts[k] | |
37 | 40 | ENDFOR |
38 | 41 | close,unit |
39 | 42 | free_lun,unit |
40 | - ENDIF | |
41 | - ENDFOR | |
43 | + ENDIF ELSE BEGIN | |
44 | + ;left blank intentionally | |
45 | + ENDELSE | |
46 | +ENDFOR | |
42 | 47 | |
43 | 48 | END |
44 | 49 | ... | ... |