Commit 3d0f6b674607769b0cbaf3703a82f722877e253d
1 parent
9388fd62
Exists in
master
rest of plotting changes
Showing
4 changed files
with
95 additions
and
141 deletions
Show diff stats
src/idl/dustem_fit_sed_ext_pol_example.pro
... | ... | @@ -322,6 +322,7 @@ dustem_init,model=use_model,/pol;,kwords=['logn','plaw','plaw'];,polarization=us |
322 | 322 | !dustem_nocatch=1 |
323 | 323 | !dustem_verbose=use_verbose |
324 | 324 | ;!dustem_show_plot=1 |
325 | +;!dustem_noobj=1 | |
325 | 326 | !EXCEPT=2 ;so I can locate the plotting error... |
326 | 327 | |
327 | 328 | |
... | ... | @@ -441,16 +442,23 @@ yr_x = [5.00E-8,10] |
441 | 442 | xr_m = [1.,5e5] |
442 | 443 | yr_m = [5e-8,1.00e6] |
443 | 444 | |
445 | +;Because we're in emission+extinction | |
446 | +;two seperate titles have to be provided | |
447 | +;if only one is present, the default titles are kept. | |
448 | +tit_m='Spectral Energy Distribution' ; combinations that work: anthing that starts with 'tit' and ends with '_m' or '_emission' | |
449 | +tit_x='Dust Optical Depth' ;same for emission but ends with '_x' or '_extinction'. Not case sensitive. | |
444 | 450 | |
445 | -tit='Spectral Energy Distribution' | |
451 | + | |
452 | +;These two are not needed anymore for any of the plottings.... | |
446 | 453 | ytit=textoidl('I_\nu (MJy/sr) for N_H=10^{20} H/cm^2') |
447 | 454 | xtit=textoidl('\lambda (\mum)') |
455 | + | |
448 | 456 | ;Set show_plot to 0 to hide plot |
449 | 457 | ;Commented or set to 1 is the same since !dustem_show_plot (existing sysvar) is initialized to 1 in dustem_init |
450 | 458 | ;show_plot = 0 |
451 | 459 | t1=systime(0,/sec) |
452 | 460 | res=dustem_mpfit_data(tol=tol,Nitermax=use_Nitermax,gtol=gtol $ |
453 | - ,/xlog,/ylog,xr=xr,yr=yr,xr_m=xr_m,yr_m=yr_m,xr_x=xr_x,yr_x=yr_x,xtit=xtit,ytit=ytit,title=tit $ | |
461 | + ,/xlog,/ylog,xr_m=xr_m,yr_m=yr_m,xr_x=xr_x,yr_x=yr_x,xtit=xtit,ytit=ytit,tit_m=tit_m,tit_x=tit_x $ | |
454 | 462 | ,legend_xpos=legend_xpos,legend_ypos=legend_ypos $ |
455 | 463 | ,errors=errors,chi2=chi2,rchi2=rchi2,show_plot=show_plot) |
456 | 464 | t2=systime(0,/sec) |
... | ... | @@ -465,9 +473,9 @@ IF keyword_set(fits_save_and_restore) THEN BEGIN |
465 | 473 | ;==== plot result taken from the saved fits table |
466 | 474 | res=*(*!dustem_fit).CURRENT_PARAM_VALUES |
467 | 475 | IF !dustem_noobj THEN BEGIN |
468 | - dustemwrap_plot_noobj,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
476 | + 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)' | |
469 | 477 | ENDIF ELSE BEGIN |
470 | - dustemwrap_plot,res,dustem_spectra_st,xr=xr,/xstyle,yr=yr,/ysty,/ylog,/xlog,title=tit+' (From Saved FITS file)' | |
478 | + 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)' | |
471 | 479 | ENDELSE |
472 | 480 | IF keyword_set(wait) THEN BEGIN |
473 | 481 | message,'Saved the results as FITS in the file: '+fits_save_and_restore+', and made a plot using the data in this file',/info | ... | ... |
src/idl/dustem_plugin_stellar_population.pro
... | ... | @@ -3590,32 +3590,36 @@ FOR i=0L,n_elements(comp_pop.popid)-1 DO BEGIN ; Looping over all the stellar po |
3590 | 3590 | |
3591 | 3591 | Inu = planck(wave_angstrom,(comp_pop.temperature)[i])*(wave_angstrom)^2/c2a ; ergs/cm2/s/Hz/sr |
3592 | 3592 | |
3593 | - ;THIS PART IS ONLY FOR ORION. | |
3594 | - ;IT SHOULD NOT BE PROVIDED IN THE RELEASE | |
3595 | - if isa(!dustem_current) then begin | |
3593 | +; ;THIS PART IS ONLY FOR ORION. | |
3594 | +; ;IT SHOULD NOT BE PROVIDED IN THE RELEASE | |
3595 | +; if isa(!dustem_current) then begin | |
3596 | +; | |
3597 | +; idff = where(tag_names(*!dustem_plugin) EQ 'FREEFREE',ct_ff) | |
3598 | +; | |
3599 | +; if ct_ff ne 0 then begin | |
3600 | +; | |
3601 | +; ;look for freefree temperature in the pd vector (sysvar) | |
3602 | +; ;we need an index | |
3603 | +; | |
3604 | +; id_fftmp = where(strupcase(strmid((*(*!dustem_fit).param_descs),14)) EQ 'FREEFREE_1',ct_fftmp) | |
3605 | +; if ct_fftmp ne 0 then Te = ((*(*!dustem_fit).current_param_values)[id_fftmp])[0]*(((*(*!dustem_fit).param_init_values))[id_fftmp])[0] | |
3606 | +; ; test if Te is correct | |
3607 | +; | |
3608 | +; Beta2 = 2.e-10*(Te)^(-3/4) ;cm^3/s-1 | |
3609 | +; Rs_p3 = 1.1355d+57 ;Rs^3 for orion nebula | |
3610 | +; nH_stromgren = sqrt(Rs_p3*4*!pi*Beta2/(3*(!const.sigma)*1.0d-04*((comp_pop.temperature)[i])^4*!pi)) | |
3611 | +; | |
3612 | +; | |
3613 | +; Inu *= exp(((*!dustem_current).ext.ext_tot)*(-nh_stromgren)*4/3*Rs_p3^(1/3)/1.0d21) | |
3614 | +; | |
3615 | +; | |
3616 | +; endif | |
3617 | +; | |
3618 | +; ENDIF | |
3619 | + | |
3620 | + | |
3621 | + If !dustem_dim and isa(!dustem_current) then Inu *= exp(((*!dustem_current).ext.ext_tot)*(-(*!dustem_HCD))/1.0d21) | |
3596 | 3622 | |
3597 | - idff = where(tag_names(*!dustem_plugin) EQ 'FREEFREE',ct_ff) | |
3598 | - | |
3599 | - if ct_ff ne 0 then begin | |
3600 | - | |
3601 | - ;look for freefree temperature in the pd vector (sysvar) | |
3602 | - ;we need an index | |
3603 | - | |
3604 | - id_fftmp = where(strupcase(strmid((*(*!dustem_fit).param_descs),14)) EQ 'FREEFREE_1',ct_fftmp) | |
3605 | - if ct_fftmp ne 0 then Te = ((*(*!dustem_fit).current_param_values)[id_fftmp])[0]*(((*(*!dustem_fit).param_init_values))[id_fftmp])[0] | |
3606 | - ; test if Te is correct | |
3607 | - | |
3608 | - Beta2 = 2.e-10*(Te)^(-3/4) ;cm^3/s-1 | |
3609 | - Rs_p3 = 1.1355d+57 ;Rs^3 for orion nebula | |
3610 | - nH_stromgren = sqrt(Rs_p3*4*!pi*Beta2/(3*(!const.sigma)*1.0d-04*((comp_pop.temperature)[i])^4*!pi)) | |
3611 | - | |
3612 | - | |
3613 | - Inu *= exp(((*!dustem_current).ext.ext_tot)*(-nh_stromgren)*4/3*Rs_p3^(1/3)/1.0d21) | |
3614 | - | |
3615 | - | |
3616 | - endif | |
3617 | - | |
3618 | - ENDIF | |
3619 | 3623 | |
3620 | 3624 | stellar_component=stellar_component+(comp_pop.nstars)[i]*omega*Inu ;no *4 because of Lambert's cosine law. |
3621 | 3625 | ... | ... |
src/idl/dustem_write_isrf_lv.pro
... | ... | @@ -104,6 +104,7 @@ IF ctpop NE 0 or ctusrisrf NE 0 THEN BEGIN |
104 | 104 | ;Let's hope they keep releasing it otherwise we'll have to include it ourselves |
105 | 105 | ma_isrf_dir=!dustem_soft_dir+'data/ISRF_MATHIS.DAT' |
106 | 106 | ma_isrf=dustem_read_isrf(ma_isrf_dir) |
107 | + stop | |
107 | 108 | final_isrf=final_isrf/G0_mathis[0]+ma_isrf.isrf |
108 | 109 | Ncomments+=1 |
109 | 110 | c=strarr(Ncomments) | ... | ... |
src/idl/dustemwrap_plot_noobj.pro
... | ... | @@ -91,71 +91,40 @@ END |
91 | 91 | |
92 | 92 | ;This is also necessary for the plotting of the results of the fit (Last iteration) |
93 | 93 | IF not keyword_set(st) THEN BEGIN |
94 | - ;Activation of the plugins is needed because of the plotting of the total emission model that includes them. | |
94 | +;Activation of the plugins is needed because of the plotting of the total emission model that includes them. | |
95 | 95 | dustem_activate_plugins,p_dim/(*(*!dustem_fit).param_init_values),st=st ; 0/0 division case? |
96 | + | |
97 | +ENDIF | |
96 | 98 | |
97 | - ;# Emission | |
98 | - ;if isa(!dustem_data.sed) then begin ;using !dustem_data instead of !dustem_show because in this release the user is compelled to fit IQU whether in M or X | |
99 | - if not keyword_set(dustem_sed) and isa((*!dustem_data).sed) then begin ;better test? | |
99 | +;# Emission | |
100 | + | |
101 | +if not keyword_set(dustem_sed) and isa((*!dustem_data).sed) then begin ;better test? | |
100 | 102 | |
101 | - dustem_sed = dustem_compute_sed(p_dim,st=st,SED_spec=SED_spec) | |
102 | - | |
103 | - if !run_pol && !run_lin then begin | |
104 | - dustem_polsed = dustem_compute_polsed(p_dim,st=st,P_spec=P_spec,SP_spec=SP_spec,dustem_polfrac=dustem_polfrac) | |
105 | -; the following call need to change to include out instead of dustem_qsed/dustem_used? | |
106 | - toto = dustem_compute_stokes(p_dim,st=st,dustem_qsed,dustem_used,Q_spec=Q_spec,U_spec=U_spec,PSI_spec=PSI_spec,dustem_psi_em=dustem_psi_em) | |
107 | - | |
108 | - endif | |
109 | - endif | |
103 | + dustem_sed = dustem_compute_sed(p_dim,st=st,SED_spec=SED_spec) | |
110 | 104 | |
111 | - ;# Extinction | |
112 | -; if isa(!dustem_data.ext) then begin | |
113 | - if not keyword_set(dustem_ext) and isa((*!dustem_data).ext) then begin | |
114 | - dustem_ext = dustem_compute_ext(p_dim,st=st,EXT_spec=EXT_spec) | |
115 | - | |
116 | - if !run_pol && !run_lin then begin | |
117 | - | |
118 | -; the following call need to change to include out instead of dustem_fpolext? | |
119 | - dustem_polext = dustem_compute_polext(p_dim,st=st,polext_spec=POLEXT_spec,spext_spec=SPEXT_spec,dustem_fpolext) | |
120 | -; the following call need to change to include out instead of QEXT/UEXT-spec? | |
121 | - toto = dustem_compute_stokext(p_dim,st=st,dustem_qext,dustem_uext,QEXT_spec=QEXT_spec,UEXT_spec=UEXT_spec,PSIEXT_spe=PSIEXT_spec,dustem_psi_ext=dustem_psi_ext) | |
122 | - | |
123 | - endif | |
124 | - endif | |
105 | + if !run_pol && !run_lin then begin | |
106 | + dustem_polsed = dustem_compute_polsed(p_dim,st=st,P_spec=P_spec,SP_spec=SP_spec,dustem_polfrac=dustem_polfrac) | |
107 | + toto = dustem_compute_stokes(p_dim,st=st,Q_spec=Q_spec,U_spec=U_spec,PSI_spec=PSI_spec,dustem_psi_em=dustem_psi_em) | |
108 | + dustem_qsed = toto[0] | |
109 | + dustem_used = toto[1] | |
110 | + endif | |
111 | +endif | |
112 | + | |
113 | +;# Extinction | |
114 | + | |
115 | +if not keyword_set(dustem_ext) and isa((*!dustem_data).ext) then begin | |
116 | + dustem_ext = dustem_compute_ext(p_dim,st=st,EXT_spec=EXT_spec) | |
117 | + | |
118 | + if !run_pol && !run_lin then begin | |
125 | 119 | |
126 | -ENDIF ELSE BEGIN ;st is provided | |
127 | - ;stop | |
120 | + dustem_polext = dustem_compute_polext(p_dim,st=st,polext_spec=POLEXT_spec,spext_spec=SPEXT_spec,dustem_fpolext=dustem_fpolext) | |
128 | 121 | |
129 | - ;# Emission | |
130 | - ;if isa(!dustem_data.sed) then begin | |
131 | - if not keyword_set(dustem_sed) and isa((*!dustem_data).sed) then begin | |
132 | - dustem_sed = dustem_compute_sed(p_dim,st=st,SED_spec=SED_spec) | |
133 | - | |
134 | - if !run_pol && !run_lin then begin | |
135 | - | |
136 | - dustem_polsed = dustem_compute_polsed(p_dim,st=st,P_spec=P_spec,SP_spec=SP_spec,dustem_polfrac=dustem_polfrac) | |
137 | -; the following call need to change to include out instead of dustem_q/used? | |
138 | - toto = dustem_compute_stokes(p_dim,st=st,dustem_qsed,dustem_used,Q_spec=Q_spec,U_spec=U_spec,PSI_spec=PSI_spec,dustem_psi_em=dustem_psi_em) | |
139 | - ;stop | |
140 | - endif | |
122 | + toto = dustem_compute_stokext(p_dim,st=st,QEXT_spec=QEXT_spec,UEXT_spec=UEXT_spec,PSIEXT_spe=PSIEXT_spec,dustem_psi_ext=dustem_psi_ext) | |
123 | + dustem_qext = toto[0] | |
124 | + dustem_uext = toto[1] | |
141 | 125 | endif |
142 | - | |
143 | - ;# Extinction | |
144 | - ;if isa(!dustem_data.ext) then begin | |
145 | - | |
146 | - if not keyword_set(dustem_ext) and isa((*!dustem_data).ext) then begin | |
147 | - | |
148 | - dustem_ext = dustem_compute_ext(p_dim,st=st,EXT_spec=EXT_spec) | |
149 | - | |
150 | - if !run_pol && !run_lin then begin | |
151 | - | |
152 | - dustem_polext = dustem_compute_polext(p_dim,st=st,POLEXT_spec=POLEXT_spec,SPEXT_spec=SPEXT_spec,dustem_fpolext) | |
153 | - toto = dustem_compute_stokext(p_dim,st=st,dustem_qext,dustem_uext,QEXT_spec=QEXT_spec,UEXT_spec=UEXT_spec,PSIEXT_spec=PSIEXT_spec,dustem_psi_ext=dustem_psi_ext) | |
154 | - | |
155 | - endif | |
156 | - endif | |
157 | - | |
158 | -ENDELSE | |
126 | +endif | |
127 | + | |
159 | 128 | |
160 | 129 | ;IC: Will come back for this to include all datasets and their associated data. |
161 | 130 | ;ADDING THIS BLOCK FOR COMPLETENESS |
... | ... | @@ -231,35 +200,8 @@ frmt2='(10F10.2)' |
231 | 200 | ;Instead of setting the extra tags for plotting in dustemcgwin, we'll place them in this (parent) procedure. |
232 | 201 | tgnms_extra = tag_names(_extra) |
233 | 202 | |
203 | +dustem_set_plot_range,test_sed, test_ext,_extra= _extra | |
234 | 204 | |
235 | - | |
236 | -;I have decided to keep track of the command index manually as I did not find any command online that does this. | |
237 | -cmdind_m = 0 ;for emission | |
238 | -cmdind_x = 0 ;for extinction | |
239 | -;trying to do the same thing for parameters and plugins | |
240 | -cmdind_prms = 0 ;for parameters | |
241 | -cmdind_plgns = 0 ;for plugins | |
242 | - | |
243 | -;ADDING PLUGIN(S) TO SPECTRUM---------------- | |
244 | - | |
245 | -;these following indices will be used to change the keep the same information in the _extra structure | |
246 | -;this is an initial solution until I finish coding the _extra-filtering procedure. | |
247 | - | |
248 | -iswinsed = !dustemcgwin_id.sed EQ la_undef() | |
249 | -iswinext = !dustemcgwin_id.ext EQ la_undef() | |
250 | - | |
251 | -;trying to do the same thing for parameters and plugins | |
252 | -;But we need to know if the extinction or the emission mode is on. | |
253 | -;so the use of ths pointer will be different than the others | |
254 | -iswinprms = !dustemcgwin_id.prms EQ la_undef() | |
255 | -iswinplgns = !dustemcgwin_id.plgns EQ la_undef() | |
256 | - | |
257 | - | |
258 | -;plotstrct = !p | |
259 | - | |
260 | -;I think I will test over the presence of the errors because they are not computed at that point. | |
261 | - | |
262 | -;errors = ((*!dustem_fit).current_param_errors) | |
263 | 205 | if isa((*!dustem_fit).current_param_errors) then begin |
264 | 206 | errors = (*(*!dustem_fit).current_param_errors) |
265 | 207 | endif else begin |
... | ... | @@ -408,18 +350,21 @@ if test_m then begin |
408 | 350 | |
409 | 351 | ;NB issue here because the user can't modify the title after the dustem_mpfit_data call at the main procedure level (user proc) |
410 | 352 | ;Getting the width of the title |
411 | - tit=!dustem_plot_range.title_m; | |
412 | - | |
413 | - cgtext, 0.3, 0.95,tit+' (RUNNING)',color=0,/normal,charsize=-1,width=thiswidth | |
414 | - widthtot = thiswidth | |
415 | - xxpos = (1 - thiswidth)/2 | |
416 | - yypos = 0.96 | |
417 | 353 | |
418 | - cgtext, 0.3, 0.95,tit,color=0,/normal,charsize=-1,width=thiswidth | |
354 | + tit=!dustem_plot_range.title_m | |
355 | + | |
356 | + xxpos = 0.5 | |
357 | + yypos =0.96 | |
358 | + | |
359 | + ;the runs inbetween | |
360 | + if !dustem_end EQ 0 then cgtext, xxpos , yypos,tit+' (RUNNING)',color=0,/normal,charsize = 1.6,alignment=0.5 | |
361 | + | |
362 | + ;subsequent iterations to the end of the fit | |
363 | + if !dustem_end EQ -1 then cgtext, xxpos , yypos,tit,color=0,/normal,charsize = 1.6,alignment=0.5 | |
364 | + | |
365 | + ;last iteration of the fit | |
366 | + if !dustem_end EQ 1 then cgtext, xxpos , yypos,tit+' (FINAL RUN)',color=0,/normal,charsize = 1.6,alignment=0.5 | |
419 | 367 | |
420 | - cgtext, xxpos, yypos,tit,color=0,/normal,charsize = 1.6 & cmdind_m+=1 | |
421 | - xxpos+=thiswidth*1.6 | |
422 | - cgtext, xxpos, yypos,' (RUNNING)',color=0,/normal,charsize = 1.6 | |
423 | 368 | |
424 | 369 | if !run_pol then begin |
425 | 370 | ;,wback='grey' |
... | ... | @@ -670,28 +615,22 @@ if test_x then begin |
670 | 615 | cgtext, xxpos + widthtext , yypos,strtrim(string(rchi2,format=frmt2),2),color=0,/normal,charsize = 1.0 |
671 | 616 | ;saving the command id to replace it |
672 | 617 | |
618 | + ;plotting of title | |
619 | + tit=!dustem_plot_range.title_x | |
673 | 620 | |
674 | - ;Plotting of the title of the dashboard (plot(s)) | |
675 | - | |
676 | - ;NB: JP is right, the user should be able to set the entirety of the title. | |
677 | - ;Make this block aware of the saving of the data (from the fits table) | |
621 | + xxpos = 0.5 | |
622 | + yypos =0.96 | |
678 | 623 | |
624 | + ;the runs inbetween | |
625 | + if !dustem_end EQ 0 then cgtext, xxpos , yypos,tit+' (RUNNING)',color=0,/normal,charsize = 1.6,alignment=0.5 | |
679 | 626 | |
680 | - ;Getting the width of the title | |
681 | - tit=!dustem_plot_range.title_x; | |
627 | + ;subsequent iterations to the end of the fit | |
628 | + if !dustem_end EQ -1 then cgtext, xxpos , yypos,tit,color=0,/normal,charsize = 1.6,alignment=0.5 | |
682 | 629 | |
683 | - cgtext, 0.3, 0.95,tit+' (RUNNING)',color=0,/normal,charsize=-1,width=thiswidth | |
684 | - widthtot = thiswidth | |
685 | - xxpos = (1 - thiswidth)/2 | |
686 | - yypos = 0.96 | |
630 | + ;last iteration of the fit | |
631 | + if !dustem_end EQ 1 then cgtext, xxpos , yypos,tit+' (FINAL RUN)',color=0,/normal,charsize = 1.6,alignment=0.5 | |
687 | 632 | |
688 | - cgtext, 0.3, 0.95,tit,color=0,/normal,charsize=-1,width=thiswidth | |
689 | - | |
690 | - cgtext, xxpos, yypos,tit,color=0,/normal,charsize = 1.6 | |
691 | - xxpos+=thiswidth*1.6 | |
692 | - cgtext, xxpos, yypos,' (RUNNING)',color=0,/normal,charsize = 1.6 | |
693 | 633 | |
694 | - | |
695 | 634 | if !run_pol then begin |
696 | 635 | |
697 | 636 | ;position arrays for plot and normalized graph |
... | ... | @@ -853,6 +792,8 @@ if test_x then begin |
853 | 792 | ENDIF |
854 | 793 | |
855 | 794 | |
795 | +if !dustem_end then !dustem_end = -1 ;so that the last iteration is only plotted once. | |
796 | + | |
856 | 797 | ;PLOTTING OF THE PARAMETERS |
857 | 798 | window,2,xpos=param_wxpos,ypos=param_wypos,xsize=param_wxsize,ysize=param_wysize,title='DUSTEMWRAP '+!dustem_version.version+' (PARAMETERS)' ; keeping the same y dimension of the emission/extinction plot? |
858 | 799 | dustem_plot_dataset, st, p_dim, errors,dataset='PARAMETERS',_extra=_extra ;& cmdind_prms+=1 | ... | ... |