Commit f882e6870baf52df3144cb3ea20cf595e71e72cc
1 parent
cba7ef49
Exists in
master
improved
Showing
8 changed files
with
43 additions
and
48 deletions
Show diff stats
src/idl/dustem_fit_sed_extsed_readme.pro
... | ... | @@ -93,22 +93,22 @@ st=dustem_set_data(ext=extsed,sed=spec,rchi2_weight=rchi2_weight,f_HI=f_HI) |
93 | 93 | ;=== Set which parameters you want to fit |
94 | 94 | pd = [ $ |
95 | 95 | 'dustem_create_continuum_2',$ |
96 | - 'dustem_create_powerlaw_1',$ | |
96 | + ;'dustem_create_powerlaw_1',$ | |
97 | 97 | '(*!dustem_params).gas.G0', $ ;G0 |
98 | 98 | '(*!dustem_params).grains(0).mdust_o_mh',$ ;PAH0 mass fraction |
99 | 99 | '(*!dustem_params).grains(1).mdust_o_mh',$ ;PAH1 mass fraction |
100 | 100 | '(*!dustem_params).grains(2).mdust_o_mh' $ ;amCBEx |
101 | 101 | ] |
102 | 102 | |
103 | -p_truth=[0.002,0.5,1.,7.8000E-04,7.8000E-04,1.6500E-04] | |
103 | +p_truth=[0.002,1.,7.8000E-04,7.8000E-04,1.6500E-04] | |
104 | 104 | |
105 | 105 | ;=== set initial value of parameters you want to fit |
106 | 106 | ;iv=p_truth ;exact solution |
107 | -iv=p_truth+[0.01,0.07,0.,3.e-5,1.e-5,-2.e-5] ;shifted from solution | |
107 | +iv=p_truth+[0.01,0.,3.e-5,1.e-5,-2.e-5] ;shifted from solution | |
108 | 108 | |
109 | -ulimed=[0, 0 ,0 , 0 ,0 ,0 ] | |
110 | -llimed=[1 ,1 ,1 , 1 ,1 ,1 ] | |
111 | -llims =[0. ,0., 0. ,0. ,0. ,0.] | |
109 | +ulimed=[0, 0 ,0 , 0 ,0 ] | |
110 | +llimed=[1 ,1 ,1 , 1 ,1 ] | |
111 | +llims =[0. ,0., 0. ,0. ,0. ] | |
112 | 112 | |
113 | 113 | |
114 | 114 | ; |
... | ... | @@ -124,9 +124,9 @@ dustem_init_parinfo,pd,iv,up_limited=ulimed,lo_limited=llimed,up_limits=ulims,lo |
124 | 124 | |
125 | 125 | |
126 | 126 | ;=== RUN fit |
127 | -tol=1.e-5 | |
128 | -xtol=1.e-5 | |
129 | -Nitermax=6 ;maximum number of iteration. This is the criterium which will stop the fit procedure | |
127 | +tol=1.e-12 | |
128 | +xtol=1.e-12 | |
129 | +Nitermax=3 ;maximum number of iteration. This is the criterium which will stop the fit procedure | |
130 | 130 | IF keyword_set(itermax) THEN Nitermax=itermax |
131 | 131 | |
132 | 132 | xrange=[1.,2.e4] | ... | ... |
src/idl/dustem_fit_sed_polsed_readme.pro
... | ... | @@ -67,14 +67,14 @@ sed=dustem_initialize_sed(Nfilt) |
67 | 67 | sed.filter=filters |
68 | 68 | sed.wave=dustem_filter2wav(filters) |
69 | 69 | sed.instru=dustem_filter2instru(filters) |
70 | -polsed=sed | |
71 | -;polext=sed | |
70 | +polsed=sed ; comment if polext is to be used | |
71 | +;polext=sed ;comment if polsed is to be used | |
72 | 72 | |
73 | -;stokes fake parameters | |
73 | +;stokes fake parameters - comment if stokes extinction parameters are to be used | |
74 | 74 | qsed=sed |
75 | 75 | used=sed |
76 | 76 | |
77 | -; ;stokes extinction fake parameters | |
77 | +; ;stokes extinction fake parameters - comment if stokes parameters are to be used | |
78 | 78 | ; qext=sed |
79 | 79 | ; uext=sed |
80 | 80 | |
... | ... | @@ -136,18 +136,19 @@ help,!run_pol |
136 | 136 | sed.spec=dustem_compute_sed(p_truth,sst,_extra=extra) ;sst is not set on purpose, for dustem_compute_sed to compute the sed using fortran code |
137 | 137 | sed.error=(sed.spec*0.1);>0.1 |
138 | 138 | |
139 | + | |
139 | 140 | polsed.spec=dustem_compute_polsed(p_truth,sstp,_extra=extra,dustem_qsed,dustem_used) ;sst is not set on purpose, for dustem_compute_sed to compute the sed using fortran code |
140 | 141 | polsed.error=(polsed.spec*0.1) |
141 | 142 | |
142 | 143 | |
143 | -;creating fake polext | |
144 | +; ;creating fake polext | |
145 | +; | |
146 | +; polext.spec=dustem_compute_polext(p_truth,ssttp,dustem_qext,dustem_uext) | |
147 | +; polext.error=(polext.spec*0.1) | |
144 | 148 | |
145 | -;polext.spec=dustem_compute_polext(p_truth,ssttp,dustem_qext,dustem_uext) | |
146 | -;polext.error=(polext.spec*0.1) | |
147 | -; | |
148 | 149 | |
149 | 150 | |
150 | -;SET qsed and used data | |
151 | +;SET qsed and used data - comment if extinction polarization data is to be used | |
151 | 152 | qsed.spec=dustem_qsed |
152 | 153 | qsed.error=qsed.spec*0.1 |
153 | 154 | |
... | ... | @@ -156,20 +157,20 @@ used.spec=dustem_used |
156 | 157 | used.error=used.spec*0.1 |
157 | 158 | |
158 | 159 | |
159 | -; ;SET qext and uext data | |
160 | +; ;SET qext and uext data - comment if polarizarion data is to be used | |
160 | 161 | ; qext.spec=dustem_qext |
161 | 162 | ; qext.error=qext.spec*0.1 |
162 | 163 | ; |
163 | 164 | ; |
164 | 165 | ; uext.spec=dustem_uext |
165 | 166 | ; uext.error=uext.spec*0.1 |
166 | -; | |
167 | +; ; | |
167 | 168 | |
168 | 169 | ;=== SET THE OBSERVATION STRUCTURE |
169 | 170 | |
170 | 171 | ind=where(sed.wave GE 0.1) |
171 | 172 | |
172 | -st=dustem_set_data(polsed=polsed[ind],sed=sed[ind],qsed=qsed[ind],used=used[ind]) | |
173 | +st=dustem_set_data(polsed=polsed[ind],sed=sed[ind],qsed=qsed[ind],used=used[ind]) ; comment if second line is to be used | |
173 | 174 | ;st=dustem_set_data(sed=sed[ind],polext=polext[ind],qext=qext[ind],uext=uext[ind]) |
174 | 175 | |
175 | 176 | ;=== RUN fit |
... | ... | @@ -202,7 +203,7 @@ message,'Saved '+file_out,/continue |
202 | 203 | stop |
203 | 204 | |
204 | 205 | ;====================================== |
205 | -;====You can exit IDL here and re-enter | |
206 | +;====You can exit IDL here and re-enter - THIS PART APPEARS TO BE FAULTY. NEEDS INVESTIGATION | |
206 | 207 | ;====================================== |
207 | 208 | file='/tmp/DUSTEM_polsed_fit_example.sav' |
208 | 209 | dustem_restore_system_variables,file |
... | ... | @@ -228,7 +229,7 @@ xtit=textoidl('\lambda (\mum)') |
228 | 229 | loadct,13 |
229 | 230 | IF keyword_set(postcript) THEN BEGIN |
230 | 231 | set_plot,'PS' |
231 | - ps_file=!dustem_wrap_soft_dir+'/Docs/Figures/'+'Last_dustem_spinning_fit.ps' | |
232 | + ps_file=!dustem_wrap_soft_dir+'/Docs/'+'Last_dustem_spinning_fit.ps';'/Docs/Figures/'+'Last_dustem_spinning_fit.ps' | |
232 | 233 | device,filename=ps_file,/color |
233 | 234 | ENDIF |
234 | 235 | ... | ... |
src/idl/dustem_fit_sed_readme.pro
... | ... | @@ -248,13 +248,13 @@ st=dustem_set_data(sed=spec) |
248 | 248 | ;== SET THE FITTED PARAMETERS |
249 | 249 | dustem_init_parinfo,pd,iv,up_limited=ulimed,lo_limited=llimed,up_limits=ulims,lo_limits=llims |
250 | 250 | |
251 | + | |
251 | 252 | dustem_init_fixed_params,fpd,fiv |
252 | 253 | |
253 | 254 | dustem_init_plugins, pd ;initializing the scopes of the plugins to be read later |
254 | 255 | |
255 | 256 | |
256 | 257 | |
257 | - | |
258 | 258 | ;=== RUN fit |
259 | 259 | tol=1.e-14 |
260 | 260 | use_Nitermax=2 ;maximum number of iteration. This is the criterium which will stop the fit procedure | ... | ... |
src/idl/dustem_init_plugins.pro
... | ... | @@ -17,7 +17,7 @@ if fi eq 'dustem' then begin |
17 | 17 | fii=strtrim(strmid(pd(i),14,4),2) |
18 | 18 | |
19 | 19 | j=0L |
20 | -if i eq 0 then j+=1 | |
20 | +if i eq 0 then j+=2 | |
21 | 21 | |
22 | 22 | trl=fii eq strtrim(strmid(pd(i+j-1),14,4),2) |
23 | 23 | |
... | ... | @@ -28,42 +28,38 @@ case fii of ;TESTING ON THE 4 FIRST LETTERS OF THE PLUGIN'S NAME |
28 | 28 | 'cont': begin |
29 | 29 | |
30 | 30 | plugin_name='CONTINUUM' ; THIS STRING SHOULD MATCH THE NAME OF THE PLUGIN IN THE SCOPE LINE OF THE PLUGIN FUNCTION |
31 | -if test && (~trl) then varvar=create_struct(plugin_name,'ADD_SED') else begin | |
32 | -if (~trl) then varvar=create_struct(varvar,plugin_name,'ADD_SED') | |
33 | -endelse | |
31 | +if test && (~trl) then varvar=create_struct(plugin_name,'ADD_SED') | |
32 | +if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,'ADD_SED') | |
33 | +print, varvar | |
34 | 34 | end |
35 | 35 | |
36 | 36 | 'sync': begin |
37 | 37 | |
38 | 38 | plugin_name='SYNCHROTRON' |
39 | -if test && (~trl) then varvar=create_struct(plugin_name,'ADD_SED+ADD_POLSED') else begin | |
40 | -if (~trl) then varvar=create_struct(varvar,plugin_name,'ADD_SED+ADD_POLSED') | |
41 | -endelse | |
39 | +if test && (~trl) then varvar=create_struct(plugin_name,'ADD_SED+ADD_POLSED') | |
40 | +if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,'ADD_SED+ADD_POLSED') | |
42 | 41 | end |
43 | 42 | |
44 | 43 | 'free': begin |
45 | 44 | |
46 | 45 | plugin_name='FREE_FREE' |
47 | -if test && (~trl) then varvar=create_struct(plugin_name,'ADD_SED') else begin | |
48 | -if (~trl) then varvar=create_struct(varvar,plugin_name,'ADD_SED') | |
49 | -endelse | |
46 | +if test && (~trl) then varvar=create_struct(plugin_name,'ADD_SED') | |
47 | +if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,'ADD_SED') | |
50 | 48 | end |
51 | 49 | |
52 | 50 | 'stok': begin |
53 | 51 | |
54 | 52 | plugin_name='STOKES' |
55 | -if test && (~trl) then varvar=create_struct(plugin_name,'MODIFY') else begin ; plugin that allows the computation of Q and U and fitting of PSI_dust and PSI_synch | |
56 | -if (~trl) then varvar=create_struct(varvar,plugin_name,'MODIFY') | |
57 | -endelse | |
53 | +if test && (~trl) then varvar=create_struct(plugin_name,'MODIFY'); plugin that allows the computation of Q_sed and U_sed and fitting of PSI_dust and PSI_synch | |
54 | +if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,'MODIFY') | |
58 | 55 | end |
59 | 56 | |
60 | 57 | 'stex':begin |
61 | 58 | |
62 | 59 | print,'found' |
63 | 60 | plugin_name='STEXT' ;'stokes'+extinction |
64 | -if test && (~trl) then varvar=create_struct(plugin_name,'MODIFY') else begin ; plugin that allows the computation of Q_ext = sigext_q and U_ext=sigext_u and fitting of PSI_ext | |
65 | -if (~trl) then varvar=create_struct(varvar,plugin_name,'MODIFY') | |
66 | -endelse | |
61 | +if test && (~trl) then varvar=create_struct(plugin_name,'MODIFY') ; plugin that allows the computation of Q_ext = sigext_q and U_ext=sigext_u and fitting of PSI_ext | |
62 | +if (~test) && (~trl) then varvar=create_struct(varvar,plugin_name,'MODIFY') | |
67 | 63 | print, varvar |
68 | 64 | end |
69 | 65 | ... | ... |
src/idl/dustem_plot_ext.pro
... | ... | @@ -179,9 +179,9 @@ ENDIF ELSE BEGIN |
179 | 179 | cgoplot,xrange,(st.ext.ext_tot)/norm,psym=psym |
180 | 180 | |
181 | 181 | |
182 | - ; LINES OF CODE TO PLOT THE NEW ADDED PLUGINS TO THE EXTINCTION WILL HAVE TO BE ADDED HERE | |
183 | - | |
184 | - cgoplot,xrange,(*(*!dustem_plugin).powerlaw)/norm,psym=psym,color='cadetblue' | |
182 | +; ; LINES OF CODE TO PLOT THE NEW ADDED PLUGINS TO THE EXTINCTION WILL HAVE TO BE ADDED HERE | |
183 | +; | |
184 | +; cgoplot,xrange,(*(*!dustem_plugin).powerlaw)/norm,psym=psym,color='cadetblue' | |
185 | 185 | |
186 | 186 | |
187 | 187 | |
... | ... | @@ -214,7 +214,7 @@ ENDIF ELSE BEGIN |
214 | 214 | IF keyword_set(ps) AND NOT keyword_set(donotclose) THEN BEGIN |
215 | 215 | device,/close |
216 | 216 | set_plot,previous_device |
217 | - ;set_plot,'X' | |
217 | + set_plot,'X' | |
218 | 218 | ENDIF |
219 | 219 | |
220 | 220 | ENDELSE | ... | ... |
src/idl/dustem_set_params.pro
src/idl/dustem_write_all.pro
... | ... | @@ -52,7 +52,7 @@ IF !dustem_which EQ 'VERSTRAETE' THEN BEGIN |
52 | 52 | ENDIF |
53 | 53 | |
54 | 54 | ;IF getenv('DUSTEM_WHICH') EQ 'WEB3p8' THEN BEGIN |
55 | -IF !dustem_which EQ 'WEB3p8' THEN BEGIN ; changed this as well | |
55 | +IF !dustem_which EQ 'WEB3p8' THEN BEGIN | |
56 | 56 | dustem_write_all_web3p8,st,dir_out |
57 | 57 | goto,sortie |
58 | 58 | ENDIF | ... | ... |
src/idl/dustem_write_all_web3p8.pro