Commit dc72d0b6328c283f033eef348d9588949cfe3912
1 parent
b7f936fc
Exists in
master
initial procedures to plot polsed and polext seperately
Showing
5 changed files
with
100 additions
and
49 deletions
Show diff stats
src/idl/dustem_compute_polext.pro
... | ... | @@ -6,8 +6,8 @@ FUNCTION dustem_compute_polext ,p_dim,sti,_extra=extra,out_st=out_st,dustem_qext |
6 | 6 | ;written to homogonize DustEM |
7 | 7 | |
8 | 8 | IF not keyword_set(sti) THEN BEGIN |
9 | + dustem_activate_plugins,p_dim/(*(*!dustem_fit).param_init_values) | |
9 | 10 | sti=dustem_run(p_dim) |
10 | - dustem_activate_plugins,p_dim/(*(*!dustem_fit).param_init_values),res=res,sti | |
11 | 11 | ENDIF |
12 | 12 | |
13 | 13 | |
... | ... | @@ -20,31 +20,39 @@ If ptr_valid(*!dustem_plugin) THEN BEGIN |
20 | 20 | ;endif |
21 | 21 | ;------------------------------------------ |
22 | 22 | |
23 | - ;MODIFYING SPECTRUM VIA PLUGIN-------------- THIS BLOCK NEEDS TO BE UNDER THE DUSTEM_POLSED LINE | |
24 | - | |
25 | - for i=0L,n_tags(*!dustem_scope)-1 do begin | |
26 | - | |
27 | - if total(strsplit((*(*!dustem_scope).(i)),'+',/extract) eq 'MODIFY_POLEXT') then begin | |
28 | - | |
29 | - ;making sure it's the stokes plugin that gets used here | |
30 | - | |
31 | - iidx=where(tag_names(*!dustem_scope) eq 'STEXT') | |
23 | + | |
24 | +; ;=============================THIS BLOCK IS WRONG YOU HAVE TO CHANGE IT============================= | |
25 | +; | |
26 | +; | |
27 | +; ;MODIFYING SPECTRUM VIA PLUGIN-------------- THIS BLOCK NEEDS TO BE UNDER THE DUSTEM_POLSED LINE | |
28 | +; | |
29 | +; for i=0L,n_tags(*!dustem_scope)-1 do begin | |
30 | +; | |
31 | +; if total(strsplit((*(*!dustem_scope).(i)),'+',/extract) eq 'MODIFY_POLEXT') then begin | |
32 | +; | |
33 | +; ;making sure it's the stokes plugin that gets used here | |
34 | +; | |
35 | +; iidx=where(tag_names(*!dustem_scope) eq 'STEXT') | |
36 | +; | |
37 | +; | |
38 | +; IF iidx eq i THEN BEGIN ;not sure about this condition but you get the spirit | |
39 | +; | |
40 | +; Q_ext=(*(*!dustem_plugin).(i))(0:n_elements((*(*!dustem_plugin).(i)))/2-1) | |
41 | +; U_ext=(*(*!dustem_plugin).(i))(n_elements((*(*!dustem_plugin).(i)))/2:*) | |
42 | +; dustem_qext=interpol(Q_ext,sti.polext.wav,(*!dustem_data.polext).wav) | |
43 | +; dustem_uext=interpol(U_ext,sti.polext.wav,(*!dustem_data.polext).wav) | |
44 | +; | |
45 | +; endif | |
46 | +; endif | |
47 | +; endfor | |
48 | +; ;endif | |
49 | +; ;------------------------------------------- | |
50 | +; ;======================================================================================================= | |
32 | 51 | |
52 | +ENDIF | |
33 | 53 | |
34 | - IF iidx eq i THEN BEGIN ;not sure about this condition but you get the spirit | |
35 | 54 | |
36 | - Q_ext=(*(*!dustem_plugin).(i))(0:n_elements((*(*!dustem_plugin).(i)))/2-1) | |
37 | - U_ext=(*(*!dustem_plugin).(i))(n_elements((*(*!dustem_plugin).(i)))/2:*) | |
38 | - dustem_qext=interpol(Q_ext,sti.polext.wav,(*!dustem_data.polext).wav) | |
39 | - dustem_uext=interpol(U_ext,sti.polext.wav,(*!dustem_data.polext).wav) | |
40 | - | |
41 | - endif | |
42 | - endif | |
43 | - endfor | |
44 | - ;endif | |
45 | - ;------------------------------------------- | |
46 | 55 | |
47 | -ENDIF | |
48 | 56 | dustem_polext = interpol(sti.polext.ext_tot,sti.polext.wav,(*!dustem_data.polext).wav) |
49 | 57 | |
50 | 58 | ... | ... |
src/idl/dustem_plot_fit_sed.pro
... | ... | @@ -167,13 +167,13 @@ IF count_filt NE 0 THEN BEGIN |
167 | 167 | plotsym,8 |
168 | 168 | xx=((*!dustem_data.sed).wav)[ind_filt] |
169 | 169 | yy=sed[ind_filt]/norm[ind_filt] |
170 | - cgoplot,xx,yy,color=use_col_sed_filt,psym=8,syms=2 | |
170 | + cgoplot,xx,yy,color=use_col_sed_filt,psym=6,syms=2 | |
171 | 171 | ENDIF |
172 | 172 | IF count_spec NE 0 THEN BEGIN |
173 | 173 | plotsym,0 |
174 | 174 | xx=((*!dustem_data.sed).wav)[ind_spec] |
175 | 175 | yy=sed[ind_spec]/norm[ind_spec] |
176 | - cgoplot,xx,yy,color=use_col_sed_spec,psym=8,syms=0.5 | |
176 | + cgoplot,xx,yy,color=use_col_sed_filt,psym=6,syms=2 | |
177 | 177 | ENDIF |
178 | 178 | |
179 | 179 | |
... | ... | @@ -247,11 +247,15 @@ IF keyword_set(res) THEN BEGIN |
247 | 247 | str=str+textoidl(' \pm ')+string(errors(i),format=frmt1) |
248 | 248 | ENDIF |
249 | 249 | |
250 | - IF STRUPCASE(strmid(strtrim(parameter_description,2),0,6)) eq 'DUSTEM' THEN BEGIN | |
251 | - | |
252 | 250 | xxpos=use_legend_xpos*0.07 |
253 | 251 | yypos=use_legend_ypos*0.03 |
254 | 252 | xyouts,xxpos,yypos,'Model: '+!dustem_model,color=0,/normal,charsize=legend_charsize |
253 | + | |
254 | + IF STRUPCASE(strmid(strtrim(parameter_description,2),0,6)) eq 'DUSTEM' THEN BEGIN | |
255 | + | |
256 | +; xxpos=use_legend_xpos*0.07 | |
257 | +; yypos=use_legend_ypos*0.03 | |
258 | +; xyouts,xxpos,yypos,'Model: '+!dustem_model,color=0,/normal,charsize=legend_charsize | |
255 | 259 | |
256 | 260 | xxpos=use_legend_xpos*0.75 |
257 | 261 | yypos=use_legend_ypos*1.03 | ... | ... |
src/idl/dustem_plot_polext.pro
1 | -PRO dustem_plot_polext, st, p_dim, aligned=aligned | |
1 | +PRO dustem_plot_polext,st,p_dim,dustem_polext,aligned=aligned,win=win | |
2 | 2 | |
3 | 3 | IF keyword_set(ps) THEN BEGIN |
4 | 4 | set_plot, 'PS' |
... | ... | @@ -9,15 +9,35 @@ ENDIF ELSE BEGIN |
9 | 9 | ENDELSE |
10 | 10 | |
11 | 11 | |
12 | -fact = (3.e10/(1.e-4*(st.polsed.wav)))/1.d40 | |
13 | -fact1 = (3.e10/(1.e-4*((*!dustem_data.qsed).wav)))/1.d40 | |
12 | +titstq='Polarization Cross-section in extinction' | |
13 | +ytitstq=textoidl('\sigma_{pol} (cm^2/H) for N_H=10^{20} H/cm^2') | |
14 | +xtit=textoidl('\lambda^{-1} (\mum^{-1})') | |
15 | +xr=[1e-4,5.0] | |
16 | +yr=[1e-5,2.] | |
17 | +Ngrains=(*!dustem_params).Ngrains | |
18 | +Nwaves=(size(st.polext.ext_tot))[1] | |
14 | 19 | |
20 | +fact=1E+01 | |
21 | +Pext=st.polext.ext_tot*fact | |
22 | +normpol1=dustem_polext*fact | |
15 | 23 | |
16 | -for i = 0, Ngrains-1 do begin | |
17 | - if aligned(i) then cgoplot,st.polsed.wav,st.polsed.(i+1)*fact/normpol,color=colors(i+1),psym=psym,line=ls(i+1) ;investigate this line of the plotting of the different components in polarization | |
18 | -endfor | |
19 | - | |
24 | +if not keyword_set(st) then begin | |
25 | + ;activate the plugins here | |
26 | + st=dustem_run(p_dim) | |
27 | + dustem_polext = dustem_compute_polext(p_dim,st,dustem_qext,dustem_uext,Q_ext,U_ext) | |
28 | +ENDIF | |
20 | 29 | |
30 | +ylog=1. | |
31 | +cgplot,1/st.polext.wav,Pext,xtit='',ytit=ytitstq,tit=titstq,ylog=ylog,/xlog,xr=xr,yr=yr,/ys,/xs,position=[0.17,0.35,0.93,0.93],xtickformat='(A1)',charsize=1.3 | |
32 | +cgoplot,1/st.polext.wav,Pext,color='black' | |
33 | +cgoplot,1/(*!dustem_data.polext).wav,(*!dustem_data.polext).values*fact,color='Tomato',psym=16,symsize=1,thick=2 | |
34 | +err_bar,1/(*!dustem_data.polext).wav,(*!dustem_data.polext).values*fact,yrms=3.*((*!dustem_data.polext).sigma)/2.*fact,color=cgColor('Tomato') | |
35 | +cgoplot,1/(*!dustem_data.polext).wav,dustem_polext*fact,psym=6,color='red',symsize=0;2 | |
36 | + | |
37 | +cgplot,1/st.polext.wav,Pext/Pext,xtit=xtit,ytit='Normalized',tit='',/xlog,xr=xr,/ys,/xs,yr=[0,2],ylog=0,position=[0.17,0.14,0.93,0.35],/noerase,yticks=2,ymino=5,xticklen=0.1,ytickformat='(F6.2)',charsize=1.3 | |
38 | +cgoplot,1/st.polext.wav,Pext/Pext,color='black' | |
39 | +cgoplot,1/(*!dustem_data.polext).wav,(*!dustem_data.polext).values*fact/normpol1,color='Tomato',psym=16,symsize=1,thick=2 | |
40 | +err_bar,1/(*!dustem_data.polext).wav,(*!dustem_data.polext).values*fact/normpol1,yrms=3.*((*!dustem_data.polext).sigma)/2./normpol1*fact,color=cgColor('Tomato') | |
21 | 41 | |
22 | 42 | |
23 | 43 | IF keyword_set(ps) THEN BEGIN | ... | ... |
src/idl/dustem_plot_polsed.pro
... | ... | @@ -14,12 +14,19 @@ ENDELSE |
14 | 14 | ;This is because the default procedures for dustem |
15 | 15 | |
16 | 16 | titstq='Polarization Intensity' |
17 | -ytitstq=textoidl('P_\nu (W/m^2/sr) for N_H=10^20 H/cm^2') | |
17 | +ytitstq=textoidl('P_\nu (W/m^2/sr) for N_H=10^{20} H/cm^2') | |
18 | 18 | xtit=textoidl('\lambda (\mum)') |
19 | 19 | xr=[10,2e4] |
20 | 20 | yr=[1e-30,1e-19] |
21 | 21 | Ngrains=(*!dustem_params).Ngrains |
22 | 22 | Nwaves=(size(st.polsed.em_tot))[1] |
23 | + | |
24 | + | |
25 | +if not keyword_set(st) then begin | |
26 | + ;activate the plugins here | |
27 | + st=dustem_run(p_dim) | |
28 | + dustem_polsed = dustem_compute_polsed(p_dim,st) | |
29 | +ENDIF | |
23 | 30 | |
24 | 31 | |
25 | 32 | fact=1/(4.*!pi)/(3.e8/1.e-6/(st.polsed).wav)*1.00e17 |
... | ... | @@ -74,6 +81,7 @@ ENDIF |
74 | 81 | |
75 | 82 | normpol1=dustem_polsed*fact1 |
76 | 83 | normpol=P |
84 | +;normpol=P*0.+1. ;and then use this to plot the normalized data | |
77 | 85 | |
78 | 86 | ; for i = 0, Ngrains-1 do begin |
79 | 87 | ; if aligned(i) then cgoplot,st.polsed.wav,st.polsed.(i+1)*fact/normpol,color=colors(i+1),psym=psym,line=ls(i+1) ;investigate this line of the plotting of the different components in polarization |
... | ... | @@ -83,14 +91,14 @@ normpol=P |
83 | 91 | ylog=1. |
84 | 92 | cgplot,st.polsed.wav,P,xtit='',ytit=ytitstq,tit=titstq,ylog=ylog,/xlog,xr=xr,yr=yr,/ys,/xs,position=[0.17,0.35,0.93,0.93],xtickformat='(A1)',charsize=1.3 |
85 | 93 | cgoplot,st.polsed.wav,P,color='black' |
86 | -cgoplot,(*!dustem_data.polsed).wav,(*!dustem_data.polsed).values*1E-20,color='Tomato',psym=16,symsize=1,thick=2 | |
87 | -err_bar,(*!dustem_data.polsed).wav,(*!dustem_data.polsed).values*1E-20,yrms=3.*((*!dustem_data.polsed).sigma)/2.*1E-20,color=cgColor('Tomato') | |
94 | +cgoplot,(*!dustem_data.polsed).wav,(*!dustem_data.polsed).values*fact1,color='Tomato',psym=16,symsize=1,thick=2 | |
95 | +err_bar,(*!dustem_data.polsed).wav,(*!dustem_data.polsed).values*fact1,yrms=3.*((*!dustem_data.polsed).sigma)/2.*fact1,color=cgColor('Tomato') | |
88 | 96 | cgoplot,(*!dustem_data.polsed).wav,dustem_polsed*fact1,psym=6,color='red',symsize=2 |
89 | 97 | |
90 | 98 | cgplot,st.polsed.wav,P/P,xtit=xtit,ytit='Normalized',tit='',/xlog,xr=xr,/ys,/xs,yr=[0,2],ylog=0,position=[0.17,0.14,0.93,0.35],/noerase,yticks=2,ymino=5,xticklen=0.1,ytickformat='(F6.2)',charsize=1.3 |
91 | 99 | cgoplot,st.polsed.wav,P/P,color='black' |
92 | -cgoplot,(*!dustem_data.polsed).wav,(*!dustem_data.polsed).values*1E-20/normpol1,color='Tomato',psym=16,symsize=1,thick=2 | |
93 | -err_bar,(*!dustem_data.polsed).wav,(*!dustem_data.polsed).values*1E-20/normpol1,yrms=3.*((*!dustem_data.polsed).sigma)/2./normpol1*1E-20,color=cgColor('Tomato') | |
100 | +cgoplot,(*!dustem_data.polsed).wav,(*!dustem_data.polsed).values*fact1/normpol1,color='Tomato',psym=16,symsize=1,thick=2 | |
101 | +err_bar,(*!dustem_data.polsed).wav,(*!dustem_data.polsed).values*fact1/normpol1,yrms=3.*((*!dustem_data.polsed).sigma)/2./normpol1*1E-20,color=cgColor('Tomato') | |
94 | 102 | |
95 | 103 | ;stop |
96 | 104 | ... | ... |
src/idl/dustem_sed_plot.pro
1 | 1 | PRO dustem_sed_plot,p_min,_extra=_extra,function_name=function_name,pol=pol,legend_xpos=legend_xpos,legend_ypos=legend_ypos,ps=ps,png=png |
2 | 2 | |
3 | 3 | IF not keyword_set(function_name) THEN BEGIN |
4 | - ;Run dustem with as an interface to mpfitfun | |
4 | + ;Run dustem with as an interface to mpfitfun; what does this mean? This whole procedure will have to be changed | |
5 | 5 | ;stop |
6 | 6 | ;== JPB: st used to come out from here |
7 | 7 | ;even when not set. Had to replavce by out_st ... |
8 | - | |
9 | - ;dustem_sed=dustem_compute_sed(p_min,st=st,cont=cont,freefree=freefree,synchrotron=synchrotron,out_st=out_st) | |
10 | - dustem_sed=dustem_compute_sed(p_min,st=st,out_st=out_st) | |
11 | - | |
8 | + | |
9 | +; act_wins=0 | |
10 | +; FOR i=0L,n_tags(!dustem_data)-1 DO BEGIN | |
11 | +; IF isa(!dustem_data.(i)) THEN act_wins+=1 | |
12 | +; ENDFOR | |
13 | + | |
14 | + dustem_sed=dustem_compute_sed(p_min,st=st,out_st=out_st) | |
12 | 15 | st=out_st |
13 | 16 | ;dustem_plot_fit_sed,st,dustem_sed,cont,freefree,synchrotron,_extra=_extra,legend_xpos=legend_xpos,legend_ypos=legend_ypos |
14 | - | |
15 | - IF keyword_set(ps) THEN dustem_plot_fit_sed,st,dustem_sed,_extra=_extra,legend_xpos=legend_xpos,legend_ypos=legend_ypos,ps=ps,png=png,use_model=use_model ELSE dustem_plot_fit_sed,st,dustem_sed,_extra=_extra,legend_xpos=legend_xpos,legend_ypos=legend_ypos,use_model=use_model | |
17 | + win=1;win-act_wins+1 | |
18 | + IF keyword_set(ps) THEN dustem_plot_fit_sed,st,dustem_sed,win=win,_extra=_extra,legend_xpos=legend_xpos,legend_ypos=legend_ypos,ps=ps,png=png,use_model=use_model ELSE dustem_plot_fit_sed,st,dustem_sed,_extra=_extra,win=win,legend_xpos=legend_xpos,legend_ypos=legend_ypos,use_model=use_model | |
16 | 19 | |
17 | 20 | ;I do not understand the reason begind the stop below - either way polarization is handled by other procedures |
18 | 21 | IF keyword_set(pol) THEN BEGIN |
19 | 22 | ;stop |
20 | - ;dustem_polsed=dustem_compute_polsed(p_min,st=pst,cont=cont,freefree=freefree,synchrotron=synchrotron,out_st=out_st) | |
21 | - ;dustem_plot_polsed,st, | |
22 | - dustem_plot_polsed, st, p_dim, dustem_polsed, aligned=aligned, win=win;,_Extra=extra | |
23 | - ;dustem_plot_polar,st,ps=ps,_Extra=extra,help=help,UV=UV,SED=SED,Pfrac=Pfrac,print_ratio=print_ratio,win=win,cont=cont,donotclose=donotclose,aligned=aligned,noerrbars=noerrbars,multi=multi,almabands=almabands,nsmooth=nsmooth | |
23 | + IF isa(*!dustem_data.polsed) THEN BEGIN | |
24 | + win+=1 | |
25 | + dustem_polsed=dustem_compute_polsed(p_min,st=st) | |
26 | + dustem_plot_polsed, st, p_dim, dustem_polsed, aligned=aligned, win=win,_Extra=extra | |
27 | + ENDIF | |
28 | + IF isa(*!dustem_data.polext) THEN BEGIN | |
29 | + win+=1 | |
30 | + dustem_polext=dustem_compute_polext(p_min,st=st) | |
31 | + dustem_plot_polext, st, p_dim, dustem_polext, aligned=aligned, win=win,_Extra=extra | |
32 | + ENDIF | |
33 | + | |
34 | + ;dustem_plot_polar,st,ps=ps,_Extra=extra,help=help,UV=UV,SED=SED,Pfrac=Pfrac,print_ratio=print_ratio,win=win,cont=cont,donotclose=donotclose,aligned=aligned,noerrbars=noerrbars,multi=multi,almabands=almabands,nsmooth=nsmooth | |
24 | 35 | ENDIF |
25 | 36 | ENDIF ELSE BEGIN |
26 | 37 | CASE function_name OF | ... | ... |