Commit bc224f3ed4d658b202efdada316a7e3a704cc6f3

Authored by Ilyes Choubani
1 parent b5314324
Exists in master

Update of plotting routines - unfinished

src/idl/dstmwrp_exp.pro
... ... @@ -21,12 +21,16 @@ FUNCTION dstmwrp_exp, axis, index, number
21 21 sign = ''
22 22 thisExponent = '0'
23 23 ENDIF
24   -
  24 +
  25 +
  26 + frmt = '10!U'
  27 + IF !dustem_mlog then frmt='-'+frmt
25 28 ; Make the exponent a superscript.
26 29 IF sign EQ '-' THEN BEGIN
27   - IF first EQ 1 then RETURN, '10!U' + sign + thisExponent + '!N' ELSE RETURN, first + 'x10!U' + sign + thisExponent + '!N'
  30 + IF first EQ 1 then RETURN, frmt + sign + thisExponent + '!N' ELSE RETURN, first + 'x' + frmt + sign + thisExponent + '!N'
28 31 ENDIF ELSE BEGIN
29   - IF first EQ 1 then RETURN, '10!U' + thisExponent + '!N' ELSE RETURN, first + 'x10!U' + thisExponent + '!N'
  32 + IF first EQ 1 then RETURN, frmt + thisExponent + '!N' ELSE RETURN, first + 'x' + frmt + thisExponent + '!N'
30 33 ENDELSE
  34 +
31 35  
32 36 END
33 37 \ No newline at end of file
... ...
src/idl/dustemcgwin_dataset.pro
... ... @@ -129,7 +129,6 @@ if keyword_set(dataset) then begin
129 129  
130 130 if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
131 131  
132   -
133 132 ;Plotting of the spectra of the dust species
134 133 FOR i=0L,Ngrains-1 DO BEGIN
135 134 cgoplot,st.sed.wav,st.sed.(i+1)*fact,color=use_cols[i],pos=position,noerase=1
... ... @@ -248,7 +247,157 @@ if keyword_set(dataset) then begin
248 247  
249 248 end
250 249  
251   - 'QSED': begin
  250 + 'QSED': begin ; THE ONE I WILL BE WORKING ON
  251 + idx_filt=where((*!dustem_data.qsed).filt_names NE 'SPECTRUM',ct_filt)
  252 + idx_spec=where((*!dustem_data.qsed).filt_names EQ 'SPECTRUM',ct_spec)
  253 +
  254 + ;#1) get the plotting keywords (pertaining to each data set) @here when the _extra structure is ready
  255 +
  256 + if keyword_set(nodata) then begin ;when the data is not present
  257 +
  258 + if keyword_set(norm) then begin ;normalized plot
  259 +
  260 + xtit=textoidl('\lambda (\mum)')
  261 + if !run_pol then xtit = ''
  262 + cgplot,wavs,wavs/wavs,/xlog,/ys,xs=1,pos=position,noerase=1,xtickformat='(A1)',color='Black',xr=xr,xtit=xtit,yr=[0.0,2.0],yticks=2,ymino=2,xticklen=0.1,ytickformat='(F6.2)',charsize=1.0
  263 + xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1
  264 +
  265 + endif else begin ;normal plot
  266 +
  267 + cgplot,wavs,wavs,/nodata,/ylog,/xlog,/ys,xs=9,pos=position,noerase=1,charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,xtit='',yr=yr,psym=8,syms=0.8
  268 + cgaxis, xaxis=1 ,xlog=1 ,xrange=((!const.c*1E6/xr)*1E-9),charsize=1.15,title=textoidl('\nu (GHz)'),xticklen=0.05,xminor=10
  269 + xyouts,pospltxt[0],pospltxt[1],textoidl('Q_{\nu} (MJy/sr)'),color=0,/normal,charsize=1.1
  270 +
  271 + endelse
  272 +
  273 +
  274 + endif else begin ;when the data is present
  275 +
  276 + if keyword_set(norm) then begin
  277 +
  278 + if keyword_set(refresh) then begin ;The data points in the plot that are being refreshed
  279 +
  280 + IF ct_filt NE 0 THEN BEGIN
  281 + xx=((*!dustem_data.qsed).wav)[idx_filt]
  282 + yy=prediction[idx_filt]
  283 + rms=3.*((*!dustem_data.qsed).sigma)(idx_filt)/2.
  284 + cgoplot,xx,((*!dustem_data.qsed).values)[idx_filt]/yy,psym=16,color='Dodger Blue',syms=0.8,noerase=1,pos=position
  285 + cgerrplot,((*!dustem_data.qsed).wav)(idx_filt),(((*!dustem_data.qsed).values)[idx_filt]-rms)/yy,(((*!dustem_data.qsed).values)[idx_filt]+rms)/yy,color='Dodger Blue'
  286 + ENDIF
  287 +
  288 + IF ct_spec NE 0 THEN BEGIN
  289 + xx=((*!dustem_data.qsed).wav)[idx_spec]
  290 + yy=prediction[idx_spec]
  291 + rms=3.*((*!dustem_data.qsed).sigma)(idx_spec)/2.
  292 + cgoplot,xx,((*!dustem_data.qsed).values)[idx_spec]/yy,color='Powder Blue',psym=16,syms=0.8,noerase=1,pos=position
  293 + cgerrplot,((*!dustem_data.qsed).wav)(idx_spec),(((*!dustem_data.qsed).values)[idx_spec]-rms)/yy,(((*!dustem_data.qsed).values)[idx_spec]+rms)/yy,color='Powder Blue'
  294 + ENDIF
  295 +
  296 + endif else begin ;The data points in the plot that remain unchanged
  297 +
  298 + xtit=textoidl('\lambda (\mum)')
  299 + if !run_pol then xtit = ''
  300 + cgplot,wavs,wavs/wavs,/xlog,/ys,xs=1,pos=position,noerase=1,xtickformat='(A1)',color='Black',xr=xr,xtit=xtit,yr=[0.0,2.0],yticks=2,ymino=2,xticklen=0.1,ytickformat='(F6.2)',charsize=1.0
  301 + xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1
  302 +
  303 + endelse
  304 +
  305 +
  306 + endif else begin ; normal plot - STOPPED HERE FOR QSED
  307 +
  308 + if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
  309 +
  310 + ;Plotting of the spectra of the dust species
  311 + FOR i=0L,Ngrains-1 DO BEGIN
  312 + cgoplot,st.sed.wav,st.sed.(i+1)*fact,color=use_cols[i],pos=position,noerase=1
  313 + ENDFOR
  314 +
  315 + ;Plotting of the plugins.
  316 + for i=0L,n_plgns-1 do begin
  317 + cgoplot,st.sed.wav,(*(*!dustem_plugin).(i)),clrs_plgns=[i],pos=position,noerase=1,linestyle=2
  318 + endfor
  319 +
  320 + ;PLotting of the interpolates corresponding to spectrum and filter points
  321 + IF ct_filt NE 0 THEN BEGIN
  322 + xx=((*!dustem_data.sed).wav)[idx_filt]
  323 + yy=prediction[idx_filt]
  324 + cgoplot,xx,yy,color='red',pos=position,psym=6,syms=2,noerase=1
  325 + ENDIF
  326 +
  327 + IF ct_spec NE 0 THEN BEGIN
  328 +
  329 + xx=((*!dustem_data.sed).wav)[idx_spec]
  330 + yy=prediction[idx_spec]
  331 + cgoplot,xx,yy,color='red',pos=position,psym=7,syms=2,noerase=1
  332 + ENDIF
  333 +
  334 + ;Plotting of the total dust emission spectrum
  335 + cgoplot,st.sed.wav,spec,pos=position,noerase=1,/xlog,/ys,/xs,/ylog
  336 +
  337 +
  338 + endif else begin ;The data points in the plot that remain unchanged.
  339 +
  340 + ;Spectrum points are treated before for plotting reasons.
  341 + if ct_spec ne 0 then begin
  342 +
  343 + ;Plotting of spectrum data points (to be fitted)
  344 + cgplot,((*!dustem_data.sed).wav)(idx_spec),((*!dustem_data.sed).values)(idx_spec),/ylog,/xlog,/ys,xs=9,pos=position,noerase=1,xtit='',charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,yr=yr,psym=8,syms=0.8,ytickformat='dstmwrp_exp'
  345 +
  346 + ;Plotting of the spectrum error points
  347 + rms=3.*((*!dustem_data.sed).sigma)(idx_spec)/2.
  348 + cgerrplot,((*!dustem_data.sed).wav)(idx_spec),((*!dustem_data.sed).values)(idx_spec)-rms,((*!dustem_data.sed).values)(idx_spec)+rms,color='Powder Blue'
  349 +
  350 + endif
  351 +
  352 + if ct_filt ne 0 then begin
  353 + ;Plotting of filter data points (to be fitted) + testing for prior plotting
  354 + if ct_spec ne 0 then cgoplot,((*!dustem_data.sed).wav)(idx_filt),((*!dustem_data.sed).values)(idx_filt),charsize=1.15,color='Dodger Blue',psym=8,syms=0.8,pos=position,/ys,xs=9,noerase=1,xtickformat='(A1)',xr=xr,yr=yr,ytickformat='dstmwrp_exp',/ylog,/xlog else $
  355 + cgplot,((*!dustem_data.sed).wav)(idx_filt),((*!dustem_data.sed).values)(idx_filt),charsize=1.15,color='Dodger Blue',psym=8,syms=0.8,pos=position,/ys,xs=9,noerase=1,xtickformat='(A1)',xtit='',xr=xr,yr=yr,ytickformat='dstmwrp_exp',/ylog,/xlog
  356 +
  357 + ;Plotting of the filter error points
  358 + rms=3.*((*!dustem_data.sed).sigma)(idx_filt)/2.;/dustem_sed(idx_filt)
  359 + cgerrplot,((*!dustem_data.sed).wav)(idx_filt),((*!dustem_data.sed).values)(idx_filt)-rms,((*!dustem_data.sed).values)(idx_filt)+rms,color='Dodger Blue'
  360 +
  361 + endif
  362 + ;Plotting of frequency axis
  363 + cgaxis, xaxis=1, xlog=1, xs=1, xminor=10, xticklen=0.05, xrange=((!const.c*1E6/(_extra.(ind_xr)))*1E-9),charsize=1.15,title=textoidl('\nu (GHz)')
  364 + xyouts,pospltxt[0],pospltxt[1],textoidl('I_{\nu} (MJy/sr)'),color=0,/normal,charsize=1.1
  365 + ;stop
  366 + ;Locating all the hidden data points (spectrum+filter)
  367 + match2,((*!dustem_data.sed).wav),((*!dustem_show.sed).wav),fit_sedpts,show_sedpts ;only show_sedpts is needed
  368 + idx_rmv_sed=where(show_sedpts eq -1, ct_hdnpts) ; indices of the points to hide
  369 +
  370 + if ct_hdnpts ne 0 then begin ;Hidden data points are present
  371 +
  372 + ;Locating the hidden spectrum and filter data points
  373 + idx_filt_hdn = where(((*!dustem_show.sed).filt_names)(idx_rmv_sed) NE 'SPECTRUM',ct_filt_hdn)
  374 + idx_spec_hdn = where(((*!dustem_show.sed).filt_names)(idx_rmv_sed) EQ 'SPECTRUM',ct_spec_hdn)
  375 +
  376 + ;Plotting of hidden spectrum data points
  377 + cgoplot,((*!dustem_show.sed).wav)(idx_spec_hdn),((*!dustem_show.sed).values)(idx_spec_hdn),pos=position,/ylog,/xlog,/ys,xs=9,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=yr,psym=8,syms=0.8
  378 +
  379 + ;Plotting of hidden spectrum error points
  380 + rms=3.*((*!dustem_show.sed).sigma)(idx_spec_hdn)/2.
  381 + cgerrplot,((*!dustem_show.sed).wav)(idx_spec_hdn),((*!dustem_show.sed).values)(idx_spec_hdn)-rms,((*!dustem_show.sed).values)(idx_spec_hdn)+rms,color='Black'
  382 +
  383 + ;Plotting of hidden filter data points
  384 + cgoplot,((*!dustem_show.sed).wav)(idx_filt_hdn),((*!dustem_show.sed).values)(idx_filt_hdn),pos=p_sed,/ylog,/xlog,/ys,xs=9,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=yr,psym=8,syms=0.8
  385 +
  386 + ;Plotting of hidden filter error point
  387 + rms=3.*((*!dustem_show.sed).sigma)(idx_filt_hdn)/2.
  388 + cgerrplot,((*!dustem_show.sed).wav)(idx_filt_hdn),((*!dustem_show.sed).values)(idx_filt_hdn)-rms,((*!dustem_show.sed).values)(idx_filt_hdn)+rms,color='Black'
  389 +
  390 + endif
  391 +
  392 +
  393 +
  394 + endelse
  395 +
  396 +
  397 +
  398 + endelse
  399 +
  400 + endelse ;
252 401  
253 402 end
254 403  
... ...
src/idl/dustemwrap_plot.pro
... ... @@ -83,8 +83,6 @@ cmdind_x = 0 ;for extinction
83 83 ;these following indices will be used to change the keep the same information in the _extra structure
84 84 ;this is an initial solution until I finish coding the _extra-filtering procedure.
85 85  
86   -
87   -
88 86 iswinsed = !dustemcgwin_id.sed EQ la_undef()
89 87 iswinext = !dustemcgwin_id.ext EQ la_undef()
90 88  
... ... @@ -96,7 +94,7 @@ if test_m then begin
96 94 ;Generating emission window and saving window ID
97 95  
98 96 if iswinsed then begin
99   - cgwindow, wtitle='DUSTEMWRAP v2.0 (EMISSION)', wback='grey';,wobject=winobj_m
  97 + cgwindow, wtitle='DUSTEMWRAP v2.0 (EMISSION)';, wback='grey';,wobject=winobj_m
100 98 winid_m = cgquery(dimensions=dim_m,/current) ;this has to be changed because the dimensions of this array change with the data sets present (extinction/emission).
101 99 !dustemcgwin_id.sed = winid_m
102 100  
... ... @@ -115,7 +113,7 @@ if test_m then begin
115 113 p_psed = [0.525,0.67,0.95,0.90]
116 114 ;p_spsed = [0.07,0.42,0.5,0.57]
117 115 ;p_psised = [,,,]
118   - p_qsed = [0.07,0.19,0.5,0.39]
  116 + p_qsed = [0.05,0.67,0.5,0.39] ;FIX THESE POSITIONS.
119 117 ;p_used = [,,,]
120 118 np_sed = [0.05,0.60,0.475,0.67]
121 119 ;np_psed = [0.525,0.60,0.95,0.67]
... ... @@ -140,16 +138,8 @@ if test_m then begin
140 138 np_sed = [0.07,0.10,0.97,0.30]
141 139  
142 140 posp_sed = [0.09,0.80]
143   -; posp_psed =
144   -; posp_spsed =
145   -; posp_qsed =
146   -; posp_used =
147   -
148   - posnp_sed = [0.09,0.25]
149   -; posnp_psed =
150   -; posnp_spsed =
151   -; posnp_qsed =
152   -; posnp_used =
  141 + posnp_sed = [0.09,0.25]
  142 +
153 143 endelse
154 144  
155 145 ;Plotting of sed data axes (whether or not data is present)
... ... @@ -157,8 +147,9 @@ if test_m then begin
157 147  
158 148 cgcontrol, execute=0
159 149  
160   - if ~iswinsed then goto, zone1
  150 + if ~iswinsed and test_sed then goto, zone1
161 151  
  152 + ;This is not the right test the user might want to show the prediction for sed and fit the stokes parameters
162 153 if ~test_sed then begin ; SED data is not present (For completeness) # This is only valid when !run_pol=1
163 154  
164 155 cgwindow,'dustemcgwin_dataset', st, dataset='SED', /nodata, position=p_sed, /addcmd, winid=winid_m, _extra=_extra
... ... @@ -169,7 +160,6 @@ if test_m then begin
169 160 cgwindow,'dustemcgwin_dataset', st, dataset='SED', position=p_sed, /addcmd, winid=winid_m, _extra=_extra
170 161 cgwindow,'dustemcgwin_dataset', st, dustem_sed, dataset='SED', /refresh ,position=p_sed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
171 162 !dustemcgwin_ncmds.sed.pl = cmdind_m
172   - stop
173 163 zone1:
174 164 if ~iswinsed then begin
175 165 cmdind_m = !dustemcgwin_ncmds.sed.pl
... ... @@ -179,7 +169,6 @@ if test_m then begin
179 169 cgwindow,'dustemcgwin_dataset', st, dataset='SED', /norm, position=np_sed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1 ;I think nodata can also be used too
180 170 cgwindow,'dustemcgwin_dataset', st, dustem_sed, dataset='SED', /refresh, /norm,position=np_sed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
181 171 !dustemcgwin_ncmds.sed.nrm = cmdind_m
182   - stop
183 172 zone2:
184 173 if ~iswinsed then begin
185 174 cmdind_m = !dustemcgwin_ncmds.sed.nrm
... ... @@ -187,108 +176,152 @@ if test_m then begin
187 176 endif
188 177  
189 178 endelse
190   -
191   -
192   - ;####################THIS IS THE OLD PART OF THE CODE. #################################
193   - ;#######################################################################################
194   -
195   -
196   -
197   -
198   - if ~!run_pol then goto, end_m
199   -
200   -
201   - if ~test_qsed then begin ; QSED data is not present (For completeness) # This is only valid when !run_pol=1
202   -
203   - xvar=dustem_get_wavelengths() ;supposedly does not modify the x axis range
204   - cgwindow,'cgplot',xvar,xvar,/nodata,/ylog,/xlog,/ys,xs=9,position=p_qsed,/addcmd,noerase=1,charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,yr=yr,winid=winid_m,psym=8,syms=0.8 & cmdind_m+=1
205   - cgwindow, 'cgaxis', xaxis=1 ,xlog=1 ,xrange=((!const.c*1E6/xr)*1E-9),/addcmd,charsize=1.15,title=textoidl('\nu (GHz)'),xticklen=0.05,xminor=10 & cmdind_m+=1
206   -
207   - ;Plotting of the title of the SED plot
208   - cgwindow,'xyouts',0.07,0.87,textoidl('Q_{\nu} (MJy/sr)'),color=0,/normal,charsize=1.1,/addcmd & cmdind_m+=1;,winid=winid_m
209   -
210   - ;Plotting of the normalized SED plot
211   - cgwindow,'cgplot',xvar,xvar,/xlog,/ys,xs=1,position=np_qsed,/addcmd,noerase=1,xtickformat='(A1)',color='Black',xr=xr,yr=[0.0,2.0],yticks=2,ymino=2,xticklen=0.1,ytickformat='(F6.2)',charsize=1.0 & cmdind_m+=1
212   -
213   - ;Plotting of the title of the normalized plot
214   - cgwindow,'xyouts',0.07,0.65,textoidl('norm'),color=0,/normal,charsize=1.1,/addcmd & cmdind_m+=1;,winid=winid_m
  179 + if ~!run_pol then begin;I don't think the order of the ;goto, end_m
  180 +
  181 + if ~iswinsed and test_qsed then goto, zone3
  182 +
  183 + if ~test_qsed then begin ;Qsed is not present
  184 +
  185 + cgwindow,'dustemcgwin_dataset', st, dataset='QSED', /nodata, position=p_qsed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  186 + cgwindow,'dustemcgwin_dataset', st, dataset='QSED', /norm, /nodata, position=np_qsed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  187 +
  188 + endif else begin ;Qsed data is present
  189 + cgwindow,'dustemcgwin_dataset', st, dataset='QSED', position=p_qsed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  190 + cgwindow,'dustemcgwin_dataset', st, dustem_qsed, dataset='QSED', /refresh ,position=p_qsed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  191 + !dustemcgwin_ncmds.qsed.pl = cmdind_m
  192 + zone3:
  193 + if ~iswinsed then begin
  194 + cmdind_m = !dustemcgwin_ncmds.qsed.pl
  195 + cgwindow,'dustemcgwin_dataset', st, dustem_qsed, dataset='QSED', /refresh ,position=p_qsed, winid=winid_m, _extra=_extra,/replacecmd,cmdindex=cmdind_m
  196 + goto, zone4
  197 + endif
  198 + cgwindow,'dustemcgwin_dataset', st, dataset='QSED', /norm, position=np_qsed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1 ;I think nodata can also be used too
  199 + cgwindow,'dustemcgwin_dataset', st, dustem_qsed, dataset='QSED', /refresh, /norm,position=np_qsed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  200 + !dustemcgwin_ncmds.qsed.nrm = cmdind_m
  201 + zone4:
  202 + if ~iswinsed then begin
  203 + cmdind_m = !dustemcgwin_ncmds.qsed.nrm
  204 + cgwindow,'dustemcgwin_dataset', st, dustem_qsed, dataset='QSED', /refresh, /norm,position=np_qsed, winid=winid_m, _extra=_extra,/replacecmd,cmdindex=cmdind_m
  205 + endif
  206 +
  207 + endelse
215 208  
216   - ;FORGOT THE PLOTTING OF THE TITLES. THIS SHOULD PROBABLY BE PLACED OUT.
  209 + if ~iswinsed and test_used then goto, zone5
  210 +
  211 + if ~test_used then begin ;Used is not present
  212 +
  213 + cgwindow,'dustemcgwin_dataset', st, dataset='USED', /nodata, position=p_used, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  214 + cgwindow,'dustemcgwin_dataset', st, dataset='USED', /norm, /nodata, position=np_used, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  215 +
  216 + endif else begin ;Used data is present
  217 + cgwindow,'dustemcgwin_dataset', st, dataset='USED', position=p_used, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  218 + cgwindow,'dustemcgwin_dataset', st, dustem_used, dataset='USED', /refresh ,position=p_used, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  219 + !dustemcgwin_ncmds.used.pl = cmdind_m
  220 + zone5:
  221 + if ~iswinsed then begin
  222 + cmdind_m = !dustemcgwin_ncmds.used.pl
  223 + cgwindow,'dustemcgwin_dataset', st, dustem_used, dataset='USED', /refresh ,position=p_used, winid=winid_m, _extra=_extra,/replacecmd,cmdindex=cmdind_m
  224 + goto, zone6
  225 + endif
  226 + cgwindow,'dustemcgwin_dataset', st, dataset='USED', /norm, position=np_used, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1 ;I think nodata can also be used too
  227 + cgwindow,'dustemcgwin_dataset', st, dustem_used, dataset='USED', /refresh, /norm,position=np_used, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  228 + !dustemcgwin_ncmds.used.nrm = cmdind_m
  229 + zone6:
  230 + if ~iswinsed then begin
  231 + cmdind_m = !dustemcgwin_ncmds.used.nrm
  232 + cgwindow,'dustemcgwin_dataset', st, dustem_used, dataset='USED', /refresh, /norm,position=np_used, winid=winid_m, _extra=_extra,/replacecmd,cmdindex=cmdind_m
  233 + endif
  234 +
  235 + endelse
  236 +
  237 + if ~iswinsed and test_polsed then goto, zone7
  238 +
  239 + if ~test_polsed then begin ;Polsed is not present
  240 +
  241 + cgwindow,'dustemcgwin_dataset', st, dataset='POLSED', /nodata, position=p_psed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  242 + cgwindow,'dustemcgwin_dataset', st, dataset='POLSED', /norm, /nodata, position=np_psed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  243 +
  244 + endif else begin ;Polsed data is present
  245 + cgwindow,'dustemcgwin_dataset', st, dataset='POLSED', position=p_psed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  246 + cgwindow,'dustemcgwin_dataset', st, dustem_polsed, dataset='POLSED', /refresh ,position=p_psed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  247 + !dustemcgwin_ncmds.polsed.pl = cmdind_m
  248 + zone7:
  249 + if ~iswinsed then begin
  250 + cmdind_m = !dustemcgwin_ncmds.polsed.pl
  251 + cgwindow,'dustemcgwin_dataset', st, dustem_polsed, dataset='POLSED', /refresh ,position=p_psed, winid=winid_m, _extra=_extra,/replacecmd,cmdindex=cmdind_m
  252 + goto, zone8
  253 + endif
  254 + cgwindow,'dustemcgwin_dataset', st, dataset='POLSED', /norm, position=np_psed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1 ;I think nodata can also be used too
  255 + cgwindow,'dustemcgwin_dataset', st, dustem_polsed, dataset='POLSED', /refresh, /norm,position=np_psed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  256 + !dustemcgwin_ncmds.polsed.nrm = cmdind_m
  257 + zone8:
  258 + if ~iswinsed then begin
  259 + cmdind_m = !dustemcgwin_ncmds.polsed.nrm
  260 + cgwindow,'dustemcgwin_dataset', st, dustem_polsed, dataset='POLSED', /refresh, /norm,position=np_psed, winid=winid_m, _extra=_extra,/replacecmd,cmdindex=cmdind_m
  261 + endif
  262 +
  263 + endelse
  264 +
  265 + if ~iswinsed and test_polfrac then goto, zone9
  266 +
  267 + if ~test_polfrac then begin ;Polfrac is not present
  268 +
  269 + cgwindow,'dustemcgwin_dataset', st, dataset='POLFRAC', /nodata, position=p_spsed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  270 + cgwindow,'dustemcgwin_dataset', st, dataset='POLFRAC', /norm, /nodata, position=np_spsed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  271 +
  272 + endif else begin ;Polfrac data is present
  273 + cgwindow,'dustemcgwin_dataset', st, dataset='POLFRAC', position=p_spsed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  274 + cgwindow,'dustemcgwin_dataset', st, dustem_polsed, dataset='POLFRAC', /refresh ,position=p_spsed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  275 + !dustemcgwin_ncmds.polfrac.pl = cmdind_m
  276 + zone9:
  277 + if ~iswinsed then begin
  278 + cmdind_m = !dustemcgwin_ncmds.polfrac.pl
  279 + cgwindow,'dustemcgwin_dataset', st, dustem_polfrac, dataset='POLFRAC', /refresh ,position=p_spsed, winid=winid_m, _extra=_extra,/replacecmd,cmdindex=cmdind_m
  280 + goto, zone10
  281 + endif
  282 + cgwindow,'dustemcgwin_dataset', st, dataset='POLFRAC', /norm, position=np_spsed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1 ;I think nodata can also be used too
  283 + cgwindow,'dustemcgwin_dataset', st, dustem_polfrac, dataset='POLFRAC', /refresh, /norm,position=np_spsed, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  284 + !dustemcgwin_ncmds.polfrac.nrm = cmdind_m
  285 + zone10:
  286 + if ~iswinsed then begin
  287 + cmdind_m = !dustemcgwin_ncmds.polfrac.nrm
  288 + cgwindow,'dustemcgwin_dataset', st, dustem_polfrac, dataset='POLFRAC', /refresh, /norm,position=np_spsed, winid=winid_m, _extra=_extra,/replacecmd,cmdindex=cmdind_m
  289 + endif
  290 +
  291 + endelse
  292 +
  293 + if ~iswinsed and test_psi_em then goto, zone11
  294 +
  295 + if ~test_psi_em then begin ;Polfrac is not present
  296 +
  297 + cgwindow,'dustemcgwin_dataset', st, dataset='PSI_EM', /nodata, position=p_psised, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  298 + cgwindow,'dustemcgwin_dataset', st, dataset='PSI_EM', /norm, /nodata, position=np_psised, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  299 +
  300 + endif else begin ;Polfrac data is present
  301 + cgwindow,'dustemcgwin_dataset', st, dataset='PSI_EM', position=p_psised, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  302 + cgwindow,'dustemcgwin_dataset', st, dustem_polsed, dataset='PSI_EM', /refresh ,position=p_psised, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  303 + !dustemcgwin_ncmds.psi_em.pl = cmdind_m
  304 + zone11:
  305 + if ~iswinsed then begin
  306 + cmdind_m = !dustemcgwin_ncmds.psi_em.pl
  307 + cgwindow,'dustemcgwin_dataset', st, dustem_psi_em, dataset='PSI_EM', /refresh ,position=p_psised, winid=winid_m, _extra=_extra,/replacecmd,cmdindex=cmdind_m
  308 + goto, zone12
  309 + endif
  310 + cgwindow,'dustemcgwin_dataset', st, dataset='PSI_EM', /norm, position=np_psised, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1 ;I think nodata can also be used too
  311 + cgwindow,'dustemcgwin_dataset', st, dustem_psi_em, dataset='PSI_EM', /refresh, /norm,position=np_psised, /addcmd, winid=winid_m, _extra=_extra & cmdind_m+=1
  312 + !dustemcgwin_ncmds.psi_em.nrm = cmdind_m
  313 + zone12:
  314 + if ~iswinsed then begin
  315 + cmdind_m = !dustemcgwin_ncmds.psi_em.nrm
  316 + cgwindow,'dustemcgwin_dataset', st, dustem_psi_em, dataset='PSI_EM', /refresh, /norm,position=np_psised, winid=winid_m, _extra=_extra,/replacecmd,cmdindex=cmdind_m
  317 + endif
  318 +
  319 + endelse
  320 +
217 321  
218   - endif else begin ;QSED exists
219   -
220   - ;Locating filter and spectrum data points
221   - idx_filtq=where((*!dustem_data.qsed).filt_names NE 'SPECTRUM',ct_filtq)
222   - idx_specq=where((*!dustem_data.qsed).filt_names EQ 'SPECTRUM',ct_specq)
223   -
224   - if ct_specq ne 0 then begin
225   -
226   - ;Plotting of spectrum data points (to be fitted)
227   - cgwindow,'cgplot',((*!dustem_data.qsed).wav)(idx_specq),((*!dustem_data.qsed).values)(idx_specq),/ylog,/xlog,/ys,xs=9,position=p_qsed,/addcmd,noerase=1,charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,yr=yr,winid=winid_m,psym=8,syms=0.8,ytickformat='dstmwrp_exp' & cmdind_m+=1
228   - ;stop
229   -
230   - ;Plotting of the spectrum error points
231   - rms=3.*((*!dustem_data.qsed).sigma)(idx_specq)/2.
232   - cgwindow,'cgerrplot',((*!dustem_data.qsed).wav)(idx_specq),((*!dustem_data.qsed).values)(idx_specq)-rms,((*!dustem_data.qsed).values)(idx_specq)+rms,/addcmd,color='Powder Blue' & cmdind_m+=1
233   -
234   - endif
235   -
236   - if ct_filtq ne 0 then begin
237   -
238   - if ct_specq ne 0 then txtcmd = 'cgoplot' else txtcmd = 'cgplot'
239   - ;Plotting of filter data points (to be fitted) ;
240   - cgwindow,txtcmd,((*!dustem_data.qsed).wav)(idx_filtq),((*!dustem_data.qsed).values)(idx_filtq),/addcmd,charsize=1.15,color='Dodger Blue',psym=8,syms=0.8,position=p_qsed,/ys,xs=9,noerase=1,xtickformat='(A1)',xr=xr,yr=yr,ytickformat='dstmwrp_exp',/ylog,/xlog & cmdind_m+=1
241   -
242   - ;Plotting of the filter error points
243   - rms=3.*((*!dustem_data.qsed).sigma)(idx_filtq)/2.;/dustem_sed(idx_filt)
244   - cgwindow,'cgerrplot',((*!dustem_data.qsed).wav)(idx_filtq),((*!dustem_data.qsed).values)(idx_filtq)-rms,((*!dustem_data.qsed).values)(idx_filtq)+rms,/addcmd,color='Dodger Blue' & cmdind_m+=1
245   -
246   - endif
247   - ;Plotting of frequency axis
248   - cgwindow, 'cgaxis', xaxis=1,xlog=1 ,xs=1,xminor=10, xticklen=0.05 ,xrange=((!const.c*1E6/(_extra.(ind_xr)))*1E-9),/addcmd,charsize=1.15,title=textoidl('\nu (GHz)') & cmdind_m+=1
249   - ;stop
250   -
251   - ;Locating all the hidden data points (spectrum+filter)
252   - match2,((*!dustem_data.qsed).wav),((*!dustem_show.qsed).wav),fit_sedptsq,show_sedptsq ;only show_sedpts is needed
253   - idx_rmv_sedq=where(show_sedptsq eq -1, ct_hdnptsq) ; indices of the points to hide
254   -
255   - if ct_hdnptsq ne 0 then begin ;Hidden data points are present
256   -
257   - ;Locating the hidden spectrum and filter data points
258   - idx_filt_hdnq = where(((*!dustem_show.qsed).filt_names)(idx_rmv_sedq) NE 'SPECTRUM',ct_filt_hdnq)
259   - idx_spec_hdnq = where(((*!dustem_show.qsed).filt_names)(idx_rmv_sedq) EQ 'SPECTRUM',ct_spec_hdnq)
260   -
261   - ;Plotting of hidden spectrum data points
262   - cgwindow,'cgoplot',((*!dustem_show.qsed).wav)(idx_spec_hdnq),((*!dustem_show.qsed).values)(idx_spec_hdnq),position=p_qsed,/ylog,/xlog,/ys,xs=9,/addcmd,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=yr,winid=winid_m,psym=8,syms=0.8 & cmdind_m+=1
263   -
264   - ;Plotting of hidden spectrum error points
265   - rms=3.*((*!dustem_show.qsed).sigma)(idx_spec_hdnq)/2.
266   - cgwindow,'cgerrplot',((*!dustem_show.qsed).wav)(idx_spec_hdnq),((*!dustem_show.qsed).values)(idx_spec_hdnq)-rms,((*!dustem_show.qsed).values)(idx_spec_hdnq)+rms,/addcmd,winid=winid_m,color='Black' & cmdind_m+=1
267   -
268   - ;Plotting of hidden filter data points
269   - cgwindow,'cgoplot',((*!dustem_show.qsed).wav)(idx_filt_hdnq),((*!dustem_show.qsed).values)(idx_filt_hdnq),pos=p_qsed,/ylog,/xlog,/ys,xs=9,/addcmd,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=yr,winid=winid_m,psym=8,syms=0.8 & cmdind_m+=1
270   -
271   - ;Plotting of hidden filter error point
272   - rms=3.*((*!dustem_show.qsed).sigma)(idx_filt_hdn)/2.
273   - cgwindow,'cgerrplot',((*!dustem_show.qsed).wav)(idx_filt_hdn),((*!dustem_show.qsed).values)(idx_filt_hdn)-rms,((*!dustem_show.qsed).values)(idx_filt_hdn)+rms,/addcmd,winid=winid_m,color='Black' & cmdind_m+=1
274   -
275   - endif
276   -
277   - ;Plotting of the title of the SED plot
278   - cgwindow,'xyouts',0.07,0.87,textoidl('I_{\nu} (MJy/sr)'),color=0,/normal,charsize=1.1,/addcmd & cmdind_m+=1;,winid=winid_m
279   -
280   - ;Plotting of the normalized SED plot
281   - xvar=dustem_get_wavelengths()
282   - cgwindow,'cgplot',xvar,xvar/xvar,/xlog,/ys,xs=1,position=np_qsed,/addcmd,noerase=1,xtickformat='(A1)',color='Black',xr=xr,yr=[0.0,2.0],yticks=2,ymino=2,xticklen=0.1,ytickformat='(F6.2)',charsize=1.0 & cmdind_m+=1
283   -
284   - ;Plotting of the title of the normalized plot
285   - cgwindow,'xyouts',0.07,0.65,textoidl('norm'),color=0,/normal,charsize=1.1,/addcmd & cmdind_m+=1;,winid=winid_m
286   -
287   - endelse
288   -
289   -
  322 + endif
290 323  
291   - end_m:
  324 + ;end_m:
292 325  
293 326 ;cgset, winid_m
294 327  
... ...