Blame view

src/idl/dustemcgwin_dataset.pro 249 KB
5f04fa07   Ilyes Choubani   general update
1
PRO dustemcgwin_dataset, st, dustem_interp, dustem_spec, extra_spec, dataset=dataset, norm=norm, refresh=refresh, nodata=nodata, position=position,positive_only=positive_only, negative_only=negative_only, _extra=_extra
b5314324   Ilyes Choubani   updating the plot...
2

b5314324   Ilyes Choubani   updating the plot...
3

b5314324   Ilyes Choubani   updating the plot...
4
;############################################################################################
5f04fa07   Ilyes Choubani   general update
5
6
7
8
9
10
11
12
if !run_pol then begin
    if isa(position) then begin
        if keyword_set(norm) then pospltxt = [position(0)+0.02,position(3)-0.02] else pospltxt = [position(0)+0.02,position(3)-0.03]  
    endif
endif else begin
    if isa(position) then pospltxt = [position(0)+0.02,position(3)-0.05] ;hard-coded but we can find a way 
endelse 

b5314324   Ilyes Choubani   updating the plot...
13
14
15
16
17
18
wavs=dustem_get_wavelengths()
n_plgns = n_tags(*!dustem_plugin)
Ngrains=(*!dustem_params).Ngrains
use_cols=dustem_grains_colors(Ngrains,/cgplot)
use_cols[1]='Cornflower'
fact = 1.e4*(*!dustem_HCD)/(4.*!pi)/(3.e8/1.e-6/st.sed.wav)*1.e20/1.e7 ; st.sed.wav and st.polsed.wav should remain the same
18e4331f   Ilyes Choubani   general update (f...
19
degtorad = !pi/180 ;factor that the arctan will be devided by in order to have an axis in degrees. Talk to JP maybe he wants angle in radians.
5f04fa07   Ilyes Choubani   general update
20
 
b5314324   Ilyes Choubani   updating the plot...
21
clrs_plgns = ['Rosy Brown','Gold','Light Coral','Slate Blue','Dark Khaki','Salmon','Dark Green'] ;FOR NOW
67bd858a   Ilyes Choubani   Replication of th...
22
23
;NB: plugins need to have different colors for extinction because they are not the same plugins. New array required.

3c479f24   Ilyes Choubani   Allowing to fix p...
24
scopes=tag_names((*!dustem_plugin))
b5314324   Ilyes Choubani   updating the plot...
25
tgnms_extra = tag_names(_extra)
c8368c6e   Ilyes Choubani   updating plotting...
26

4da8e20e   Ilyes Choubani   other procs that ...
27
28
29



4da8e20e   Ilyes Choubani   other procs that ...
30
31
32
33
34
;THIS BLOCK WILL HAVE TO BE MODIFIED CONSIDERABLY
;SO FAR ALL DATASETS HAVE ONE XR AND ONE YR
;WHEN USING EMISSION AND EXTINCTION BOTH XR_M AND XR_X HAVE TO BE SET


96a72c8b   Ilyes Choubani   seperating xrange...
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
ind_xrm = where(strmid(tgnms_extra,0,4) EQ 'XR_M',ct_xrm)
ind_xrx = where(strmid(tgnms_extra,0,4) EQ 'XR_X',ct_xrx)
ind_yrm = where(strmid(tgnms_extra,0,4) EQ 'YR_M',ct_yrm)
ind_yrx = where(strmid(tgnms_extra,0,4) EQ 'YR_X',ct_yrx)
ct_m = ct_xrm+ct_yrm
ct_x = ct_xrx+ct_yrx

IF ct_m+ct_x NE 0 THEN BEGIN

    IF ct_xrm NE 0 THEN xr_m = (_extra.(ind_xrm))
    IF ct_xrx NE 0 THEN xr_x = (_extra.(ind_xrx))
    IF ct_yrm NE 0 THEN yr_m = (_extra.(ind_yrm))
    IF ct_yrx NE 0 THEN yr_x = (_extra.(ind_yrx))

ENDIF ELSE BEGIN

    ind_xr = where(strmid(tgnms_extra,0,2) eq 'XR')
    ind_yr = where(strmid(tgnms_extra,0,2) eq 'YR')
    if ind_xr EQ -1 then xr=[1.00E+00,1.00E+05] else xr=(_extra.(ind_xr))
    if ind_yr EQ -1 then yr=[5.00E-03,1.00E+08] else yr=(_extra.(ind_yr))
    
ENDELSE 
5f04fa07   Ilyes Choubani   general update
57

4da8e20e   Ilyes Choubani   other procs that ...
58

5f04fa07   Ilyes Choubani   general update
59
60
61
frmt0='(A46)'
frmt1='(1E11.4)'
frmt2='(10F10.2)'
b5314324   Ilyes Choubani   updating the plot...
62
63


5f04fa07   Ilyes Choubani   general update
64
;############################################################################################
b5314324   Ilyes Choubani   updating the plot...
65

b5314324   Ilyes Choubani   updating the plot...
66

abebbdf3   Ilyes Choubani   General update: A...
67
68
;NB: SUSPETING A MAJR ERROR IN THE MATCHING OF STRUCTURE (FOR THE PLOTTING OF THE HIDDEN POINTS)
;INVERTING ALL THE INDICES THAT ARE CONCERNED BY THIS. 
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
69
70
71
;THIS CAN CREATE ERRORS (EVEN THOUGH IT WAS WRONG AND WORKED) SO REMEMBER YOU DID THIS. 

;I DO NOT REMEMBER RUNNING ANY OF THE TESTS HERE. 
abebbdf3   Ilyes Choubani   General update: A...
72

abebbdf3   Ilyes Choubani   General update: A...
73

b5314324   Ilyes Choubani   updating the plot...
74
75
76
77
78
79
if keyword_set(dataset) then begin
;!run_pol is implied for QSED/USED/POLSED etc...
    Case strupcase(dataset) of 
    
        'SED': begin
            
4b745987   Ilyes Choubani   minor update
80
81
82
83
            IF ct_m NE 0 then begin
                xr=xr_m
                yr=yr_m 
            endif
afde94a3   Ilyes Choubani   general update
84
85
86
87
88
89
            
            vectw=DINDGEN(1001)*(alog10(1E7) - alog10(1E5))/(1000 - 1L) + alog10(1E5)
            vectw=10^vectw[1:*]
            vectw=[wavs,vectw]
            vectx=vectw*0+1
            
0068116a   Ilyes Choubani   General update + ...
90
91
            idx_filt=where((*(*!dustem_data).sed).filt_names NE 'SPECTRUM',ct_filt)
            idx_spec=where((*(*!dustem_data).sed).filt_names EQ 'SPECTRUM',ct_spec)
b5314324   Ilyes Choubani   updating the plot...
92
93
94
95
96
97
98
99
100
            
            ;#1) get the plotting keywords (pertaining to each data set) @here when the _extra structure is ready
            
            if keyword_set(nodata) then begin ;when the data is not present
            
                if keyword_set(norm) then begin ;normalized plot
                    
                    xtit=textoidl('\lambda (\mum)')
                    if !run_pol then xtit = ''
afde94a3   Ilyes Choubani   general update
101
                    cgplot,vectw,vectx,/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
b5314324   Ilyes Choubani   updating the plot...
102
103
                    xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1                        
                
5f04fa07   Ilyes Choubani   general update
104
105
106
                endif ;else begin ;normal plot
                
                if not keyword_set(norm) then begin
afde94a3   Ilyes Choubani   general update
107
                    ;/NODATA    
b5314324   Ilyes Choubani   updating the plot...
108
                    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  
c0df0660   Ilyes Choubani   replaced all call...
109
                    axis, xaxis=1 ,xlog=1 ,xrange=((!const.c*1E6/xr)*1E-9),charsize=1.15,xtitle=textoidl('\nu (GHz)'),xticklen=0.05,xminor=10,color='black'
5f04fa07   Ilyes Choubani   general update
110
                    xyouts,pospltxt[0],pospltxt[1],textoidl('I_{\nu} (MJy/sr)'),color=0,/normal,charsize=1.3;,charthick=2.0
b5314324   Ilyes Choubani   updating the plot...
111
                  
5f04fa07   Ilyes Choubani   general update
112
113
                ;endelse  
                endif
b5314324   Ilyes Choubani   updating the plot...
114
            
5f04fa07   Ilyes Choubani   general update
115
116
            endif ;else begin ;when the data is present - to be replaced by if to test as a solution to the refreshing problem
            if not keyword_set(nodata) then begin
b5314324   Ilyes Choubani   updating the plot...
117
                if keyword_set(norm) then begin 
c8368c6e   Ilyes Choubani   updating plotting...
118
                    
b5314324   Ilyes Choubani   updating the plot...
119
120
                    if keyword_set(refresh) then begin ;The data points in the plot that are being refreshed 
                        
b5314324   Ilyes Choubani   updating the plot...
121
                        IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
122
                            xx=((*(*!dustem_data).sed).wav)[idx_spec]
5f04fa07   Ilyes Choubani   general update
123
                            yy=dustem_interp[idx_spec]
0068116a   Ilyes Choubani   General update + ...
124
125
126
                            rms=3.*((*(*!dustem_data).sed).sigma)(idx_spec)/2.
                            cgoplot,xx,((*(*!dustem_data).sed).values)[idx_spec]/yy,color='Powder Blue',psym=16,syms=0.8,noerase=1,pos=position
                            cgerrplot,((*(*!dustem_data).sed).wav)(idx_spec),(((*(*!dustem_data).sed).values)[idx_spec]-rms)/yy,(((*(*!dustem_data).sed).values)[idx_spec]+rms)/yy,color='Powder Blue'
c8368c6e   Ilyes Choubani   updating plotting...
127
                        ENDIF
b5314324   Ilyes Choubani   updating the plot...
128
                        
c8368c6e   Ilyes Choubani   updating plotting...
129
                        IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
130
                            xx=((*(*!dustem_data).sed).wav)[idx_filt]
5f04fa07   Ilyes Choubani   general update
131
                            yy=dustem_interp[idx_filt]
0068116a   Ilyes Choubani   General update + ...
132
133
134
                            rms=3.*((*(*!dustem_data).sed).sigma)(idx_filt)/2. 
                            cgoplot,xx,((*(*!dustem_data).sed).values)[idx_filt]/yy,psym=16,color='Dodger Blue',syms=0.8,noerase=1,pos=position
                            cgerrplot,((*(*!dustem_data).sed).wav)(idx_filt),(((*(*!dustem_data).sed).values)[idx_filt]-rms)/yy,(((*(*!dustem_data).sed).values)[idx_filt]+rms)/yy,color='Dodger Blue';,/overplot 
c8368c6e   Ilyes Choubani   updating plotting...
135
136
137
                        ENDIF
                            
                        
5f04fa07   Ilyes Choubani   general update
138
139
                    endif ;else begin ;The data points in the plot that remain unchanged ; UNNECESSARY BLOCK but needede to limit erros when calls are made with missing keywords.
                        ;stop
b5314324   Ilyes Choubani   updating the plot...
140
                        
5f04fa07   Ilyes Choubani   general update
141
142
                    if not keyword_set(refresh) then begin 
                        ;stop   
afde94a3   Ilyes Choubani   general update
143
                        
b5314324   Ilyes Choubani   updating the plot...
144
                        xtit=textoidl('\lambda (\mum)')
fcb6eade   Ilyes Choubani   general update - ...
145
146
147
148
                        if !run_pol then begin
                            xtit = ''
                            xtickformat='(A1)'
                        endif else xtickformat='(F10.2)' ;MAYBE YOU'LL CHANGE THIS FORMAT TO EXPONENTIAL NOTATION
e0d00de0   Ilyes Choubani   removing stops
149
                        
afde94a3   Ilyes Choubani   general update
150
                        cgplot,vectw,vectx,/xlog,/ys,xs=1,pos=position,noerase=1,xtickformat=xtickformat,color='Black',xr=xr,xtit=xtit,yr=[0.0,2.0],yticks=2,ymino=2,xticklen=0.1,ytickformat='(F6.2)',charsize=1.0
b5314324   Ilyes Choubani   updating the plot...
151
152
                        xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1
                    
5f04fa07   Ilyes Choubani   general update
153
154
                    ;endelse
                    endif
b5314324   Ilyes Choubani   updating the plot...
155
156
                    
                
5f04fa07   Ilyes Choubani   general update
157
158
                endif ;else begin ; normal plot
                if not keyword_set(norm) then begin        
b5314324   Ilyes Choubani   updating the plot...
159
160
                    if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
                        
b5314324   Ilyes Choubani   updating the plot...
161
162
163
164
165
                        ;Plotting of the spectra of the dust species
                        FOR i=0L,Ngrains-1 DO BEGIN
                            cgoplot,st.sed.wav,st.sed.(i+1)*fact,color=use_cols[i],pos=position,noerase=1
                        ENDFOR
                        
c8368c6e   Ilyes Choubani   updating plotting...
166
                                                
b5314324   Ilyes Choubani   updating the plot...
167
168
                        ;Plotting of the plugins.
                        for i=0L,n_plgns-1 do begin
3c479f24   Ilyes Choubani   Allowing to fix p...
169
170
171
172
173
174
175
176
177
                            
                            if isa((*!dustem_plugin).(0).spec) then begin 
                            
                                IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_SED') THEN begin
                                    cgoplot,st.sed.wav,((*(*!dustem_plugin).(i).spec)[*,0]),color=clrs_plgns[i],pos=position,noerase=1,linestyle=2               
                                ENDIF
                                
                            endif
                            
b5314324   Ilyes Choubani   updating the plot...
178
                        endfor
c8368c6e   Ilyes Choubani   updating plotting...
179
                                                
b5314324   Ilyes Choubani   updating the plot...
180
                        ;PLotting of the interpolates corresponding to spectrum and filter points
c8368c6e   Ilyes Choubani   updating plotting...
181
                           
b5314324   Ilyes Choubani   updating the plot...
182
183
                        IF ct_spec NE 0 THEN BEGIN
                        
0068116a   Ilyes Choubani   General update + ...
184
                            xx=((*(*!dustem_data).sed).wav)[idx_spec]
5f04fa07   Ilyes Choubani   general update
185
                            yy=dustem_interp[idx_spec]
abebbdf3   Ilyes Choubani   General update: A...
186
                            cgoplot,xx,yy,color='Indian Red',pos=position,psym=7,syms=1,noerase=1   
b5314324   Ilyes Choubani   updating the plot...
187
188
                        ENDIF
                        
c8368c6e   Ilyes Choubani   updating plotting...
189
190
                        
                        IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
191
                            xx=((*(*!dustem_data).sed).wav)[idx_filt]
5f04fa07   Ilyes Choubani   general update
192
                            yy=dustem_interp[idx_filt]
c8368c6e   Ilyes Choubani   updating plotting...
193
194
195
                            cgoplot,xx,yy,color='red',pos=position,psym=6,syms=2,noerase=1
                        ENDIF
                        
b5314324   Ilyes Choubani   updating the plot...
196
                        
c8368c6e   Ilyes Choubani   updating plotting...
197
                        ;Plotting of the total dust emission spectrum
5f04fa07   Ilyes Choubani   general update
198
                        cgoplot,st.sed.wav,dustem_spec,pos=position,noerase=1,/xlog,/ys,/xs,/ylog
c8368c6e   Ilyes Choubani   updating plotting...
199
200
201
                         
                                        
                                
5f04fa07   Ilyes Choubani   general update
202
203
204
                    endif ;else begin ;The data points in the plot that remain unchanged.
                        ;stop
                    if not keyword_set(refresh) then begin
b5314324   Ilyes Choubani   updating the plot...
205
206
207
208
                        ;Spectrum points are treated before for plotting reasons. 
                        if ct_spec ne 0 then begin 
                            
                            ;Plotting of spectrum data points (to be fitted)
0068116a   Ilyes Choubani   General update + ...
209
                            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=16,syms=0.8,ytickformat='dstmwrp_exp'                
b5314324   Ilyes Choubani   updating the plot...
210
211
                            
                            ;Plotting of the spectrum error points
0068116a   Ilyes Choubani   General update + ...
212
213
                            rms=3.*((*(*!dustem_data).sed).sigma)(idx_spec)/2.
                            cgerrplot,((*(*!dustem_data).sed).wav)(idx_spec),((*(*!dustem_data).sed).values)(idx_spec)-rms,((*(*!dustem_data).sed).values)(idx_spec)+rms,color='Powder Blue'
b5314324   Ilyes Choubani   updating the plot...
214
215
216
217

                        endif
                        
                        if ct_filt ne 0 then begin
c8368c6e   Ilyes Choubani   updating plotting...
218
                        
b5314324   Ilyes Choubani   updating the plot...
219
                            ;Plotting of filter data points (to be fitted) + testing for prior plotting                         
0068116a   Ilyes Choubani   General update + ...
220
221
                            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=16,syms=0.8,pos=position,/ys,xs=9,noerase=1,xtickformat='(A1)',xr=xr,yr=yr,ytickformat='dstmwrp_exp',/ylog,/xlog else $
                                cgplot,((*(*!dustem_data).sed).wav)(idx_filt),((*(*!dustem_data).sed).values)(idx_filt),charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,pos=position,/ys,xs=9,noerase=1,xtickformat='(A1)',xtit=' ',xr=xr,yr=yr,ytickformat='dstmwrp_exp',/ylog,/xlog
c8368c6e   Ilyes Choubani   updating plotting...
222
                            
b5314324   Ilyes Choubani   updating the plot...
223
224
                            
                            ;Plotting of the filter error points
0068116a   Ilyes Choubani   General update + ...
225
226
                            rms=3.*((*(*!dustem_data).sed).sigma)(idx_filt)/2.;/dustem_sed(idx_filt)
                            cgerrplot,((*(*!dustem_data).sed).wav)(idx_filt),((*(*!dustem_data).sed).values)(idx_filt)-rms,((*(*!dustem_data).sed).values)(idx_filt)+rms,color='Dodger Blue'
c8368c6e   Ilyes Choubani   updating plotting...
227
                            
b5314324   Ilyes Choubani   updating the plot...
228
                        endif
c8368c6e   Ilyes Choubani   updating plotting...
229
230
                        
                        
b5314324   Ilyes Choubani   updating the plot...
231
                        ;Plotting of frequency axis
5c1fdbfb   Ilyes Choubani   small modificatio...
232
                        axis, xaxis=1, xlog=1, xs=1, xminor=10, xticklen=0.05, xrange=((!const.c*1E6/(xr))*1E-9),charsize=1.15,xtitle=textoidl('\nu (GHz)'),color='black'
c8368c6e   Ilyes Choubani   updating plotting...
233
                        
5f04fa07   Ilyes Choubani   general update
234
                        xyouts,pospltxt[0],pospltxt[1],textoidl('I_{\nu} (MJy/sr)'),color=0,/normal,charsize=1.3;,charthick=2.0
c8368c6e   Ilyes Choubani   updating plotting...
235
                         
b5314324   Ilyes Choubani   updating the plot...
236
                        ;Locating all the hidden data points (spectrum+filter)
0068116a   Ilyes Choubani   General update + ...
237
                        match2,((*(*!dustem_data).sed).wav),((*(*!dustem_show).sed).wav),show_sedpts,fit_sedpts ;only show_sedpts is needed
74103816   Ilyes Choubani   small update
238
                        idx_rmv_sed=where(fit_sedpts eq -1, ct_hdnpts) ; indices of the points to hide
2df3360b   Ilyes Choubani   Correcting error:...
239
                        ;Locating the hidden spectrum and filter data points                                        
0068116a   Ilyes Choubani   General update + ...
240
241
                        idx_filt_hdn = where((((*(*!dustem_show).sed).filt_names))(idx_rmv_sed) NE 'SPECTRUM',ct_filt_hdn)
                        idx_spec_hdn = where(((*(*!dustem_show).sed).filt_names)(idx_rmv_sed) EQ 'SPECTRUM',ct_spec_hdn)
2df3360b   Ilyes Choubani   Correcting error:...
242
                         
c8368c6e   Ilyes Choubani   updating plotting...
243
                        if ct_hdnpts ne 0 then begin ;Hidden data points are present 
18e4331f   Ilyes Choubani   general update (f...
244
                            ;stop
18e4331f   Ilyes Choubani   general update (f...
245
246
                            if ct_spec_hdn ne 0 then begin
                                ;Plotting of hidden spectrum data points
0068116a   Ilyes Choubani   General update + ...
247
                                cgoplot,(((*(*!dustem_show).sed).wav)[idx_rmv_sed])(idx_spec_hdn),(((*(*!dustem_show).sed).values)[idx_rmv_sed])(idx_spec_hdn),pos=position,/ylog,/xlog,/ys,xs=9,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=yr,psym=16,syms=0.8
18e4331f   Ilyes Choubani   general update (f...
248
249
                                
                                ;Plotting of hidden spectrum error points
0068116a   Ilyes Choubani   General update + ...
250
251
                                rms=3.*(((*(*!dustem_show).sed).sigma)[idx_rmv_sed])(idx_spec_hdn)/2.
                                cgerrplot,(((*(*!dustem_show).sed).wav)[idx_rmv_sed])(idx_spec_hdn),(((*(*!dustem_show).sed).values)[idx_rmv_sed])(idx_spec_hdn)-rms,(((*(*!dustem_show).sed).values)[idx_rmv_sed])(idx_spec_hdn)+rms,color='Black'
18e4331f   Ilyes Choubani   general update (f...
252
                            endif                                            
b5314324   Ilyes Choubani   updating the plot...
253
                            
18e4331f   Ilyes Choubani   general update (f...
254
                            if ct_filt_hdn then begin
b5314324   Ilyes Choubani   updating the plot...
255
                            ;Plotting of hidden filter data points 
0068116a   Ilyes Choubani   General update + ...
256
                                cgoplot,(((*(*!dustem_show).sed).wav)[idx_rmv_sed])(idx_filt_hdn),(((*(*!dustem_show).sed).values)[idx_rmv_sed])(idx_filt_hdn),pos=position,/ylog,/xlog,/ys,xs=9,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=yr,psym=16,syms=0.8                                           
18e4331f   Ilyes Choubani   general update (f...
257
258
                                
                                ;Plotting of hidden filter error point
0068116a   Ilyes Choubani   General update + ...
259
260
                                rms=3.*(((*(*!dustem_show).sed).sigma)[idx_rmv_sed])(idx_filt_hdn)/2.
                                cgerrplot,(((*(*!dustem_show).sed).wav)[idx_rmv_sed])(idx_filt_hdn),(((*(*!dustem_show).sed).values)[idx_rmv_sed])(idx_filt_hdn)-rms,(((*(*!dustem_show).sed).values)[idx_rmv_sed])(idx_filt_hdn)+rms,color='Black'
18e4331f   Ilyes Choubani   general update (f...
261
262
                                
                            endif
b5314324   Ilyes Choubani   updating the plot...
263
264
265
266
267
                                                           
                        endif    
                        
                        
                    
5f04fa07   Ilyes Choubani   general update
268
269
                    ;endelse 
                    endif
b5314324   Ilyes Choubani   updating the plot...
270
271
                
                
5f04fa07   Ilyes Choubani   general update
272
273
274
275
                ;endelse 
                endif            
            ;endelse
            endif 
18e4331f   Ilyes Choubani   general update (f...
276
        ;stop    
b5314324   Ilyes Choubani   updating the plot...
277
278
        end
        
afde94a3   Ilyes Choubani   general update
279
        'EXT': begin ;BE VERY CAREFUL THE EXTINCTION STRUCTURE AS REDERED BY DUSTEM IS DIFFERENT THAN THE EMISSION ONE
b5314324   Ilyes Choubani   updating the plot...
280
        
afde94a3   Ilyes Choubani   general update
281
282
283
284
285
;             ;So far manually changing xr and yr.
;             
;             xr=[0.01,30]
;             yr=[1.00E-06,10]
            
4b745987   Ilyes Choubani   minor update
286
            IF ct_x NE 0 then begin
96a72c8b   Ilyes Choubani   seperating xrange...
287
            
4b745987   Ilyes Choubani   minor update
288
289
290
291
                xr=xr_x 
                yr=yr_x
                
            ENDIF
afde94a3   Ilyes Choubani   general update
292
293
294
295
296
            vectw=DINDGEN(1001)*(alog10(1E7) - alog10(1E5))/(1000 - 1L) + alog10(1E5)
            vectw=10^vectw[1:*]
            vectw=[wavs,vectw]
            vectx=vectw*0+1
            
0068116a   Ilyes Choubani   General update + ...
297
298
            idx_filt=where((*(*!dustem_data).ext).filt_names NE 'SPECTRUM',ct_filt)
            idx_spec=where((*(*!dustem_data).ext).filt_names EQ 'SPECTRUM',ct_spec)
67bd858a   Ilyes Choubani   Replication of th...
299
300
301
302
303
304
305
            
            ;#1) get the plotting keywords (pertaining to each data set) @here when the _extra structure is ready
            
            if keyword_set(nodata) then begin ;when the data is not present
            
                if keyword_set(norm) then begin ;normalized plot
                    
f2caf3f1   Ilyes Choubani   Debugging some er...
306
                    xtit=textoidl('1/\lambda (\mum^{-1})')
67bd858a   Ilyes Choubani   Replication of th...
307
                    if !run_pol then xtit = ''
afde94a3   Ilyes Choubani   general update
308
                    cgplot,1/vectw,vectx,/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
67bd858a   Ilyes Choubani   Replication of th...
309
310
311
312
313
                    xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1                        
                
                endif ;else begin ;normal plot
                
                if not keyword_set(norm) then begin
afde94a3   Ilyes Choubani   general update
314
                    ;/NODATA    
67bd858a   Ilyes Choubani   Replication of th...
315
                    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  
c0df0660   Ilyes Choubani   replaced all call...
316
                    axis, xaxis=1 ,xlog=1 ,xrange=((!const.c*1E6*xr)*1E-9),charsize=1.15,xtitle=textoidl('\nu (GHz)'),xticklen=0.05,xminor=10,color='black'
f2caf3f1   Ilyes Choubani   Debugging some er...
317
                    xyouts,pospltxt[0],pospltxt[1],textoidl('\tau_{EXT}'),color=0,/normal,charsize=1.3;,charthick=2.0
67bd858a   Ilyes Choubani   Replication of th...
318
319
320
321
322
323
324
325
326
327
328
                  
                ;endelse  
                endif
            
            endif ;else begin ;when the data is present - to be replaced by if to test as a solution to the refreshing problem
            if not keyword_set(nodata) then begin
                if keyword_set(norm) then begin 
                    
                    if keyword_set(refresh) then begin ;The data points in the plot that are being refreshed 
                        
                        IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
329
                            xx=((*(*!dustem_data).ext).wav)[idx_spec]
67bd858a   Ilyes Choubani   Replication of th...
330
                            yy=dustem_interp[idx_spec]
0068116a   Ilyes Choubani   General update + ...
331
                            rms=3.*((*(*!dustem_data).ext).sigma)(idx_spec)/2.
94c4dffa   Ilyes Choubani   update + fixes fo...
332
333
                            indzero = where(yy NE 0, ct_zero)
                            IF ct_zero NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
334
335
                                cgoplot,(1/xx)[indzero],(((*(*!dustem_data).ext).values)[idx_spec])[indzero]/yy[indzero],color='Powder Blue',psym=16,syms=0.8,noerase=1,pos=position
                                cgerrplot,(1/((*(*!dustem_data).ext).wav)(idx_spec))[indzero],((((*(*!dustem_data).ext).values)[idx_spec])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).ext).values)[idx_spec])[indzero]+rms[indzero])/yy[indzero],color='Powder Blue'
94c4dffa   Ilyes Choubani   update + fixes fo...
336
                            ENDIF
67bd858a   Ilyes Choubani   Replication of th...
337
338
339
                        ENDIF
                        
                        IF ct_filt NE 0 THEN BEGIN ; There are no filter points for now...
0068116a   Ilyes Choubani   General update + ...
340
                            xx=((*(*!dustem_data).ext).wav)[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
341
                            yy=dustem_interp[idx_filt]
0068116a   Ilyes Choubani   General update + ...
342
                            rms=3.*((*(*!dustem_data).ext).sigma)(idx_filt)/2.
94c4dffa   Ilyes Choubani   update + fixes fo...
343
344
                            indzero = where(yy NE 0, ct_zero)
                            IF ct_zero NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
345
346
                                cgoplot,(1/xx)[indzero],(((*(*!dustem_data).ext).values)[idx_filt])[indzero]/yy[indzero],psym=16,color='Dodger Blue',syms=0.8,noerase=1,pos=position
                                cgerrplot,(1/((*(*!dustem_data).ext).wav)(idx_filt))[indzero],((((*(*!dustem_data).ext).values)[idx_filt])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).ext).values)[idx_filt])[indzero]+rms[indzero])/yy[indzero],color='Dodger Blue';,/overplot 
94c4dffa   Ilyes Choubani   update + fixes fo...
347
                            ENDIF
67bd858a   Ilyes Choubani   Replication of th...
348
349
350
351
352
353
354
355
                        ENDIF
                            
                        
                    endif ;else begin ;The data points in the plot that remain unchanged ; UNNECESSARY BLOCK but needede to limit erros when calls are made with missing keywords.
                        ;stop
                        
                    if not keyword_set(refresh) then begin 
                        ;stop   
f2caf3f1   Ilyes Choubani   Debugging some er...
356
                        xtit=textoidl('1/\lambda (\mum^{-1})')
67bd858a   Ilyes Choubani   Replication of th...
357
358
359
360
                        if !run_pol then begin
                            xtit = ''
                            xtickformat='(A1)'
                        endif else xtickformat='(F10.2)' ;MAYBE YOU'LL CHANGE THIS FORMAT TO EXPONENTIAL NOTATION
afde94a3   Ilyes Choubani   general update
361
                        cgplot,1/vectw,vectx,/xlog,/ys,xs=1,pos=position,noerase=1,xtickformat=xtickformat,color='Black',xr=xr,xtit=xtit,yr=[0.0,2.0],yticks=2,ymino=2,xticklen=0.1,ytickformat='(F6.2)',charsize=1.0
67bd858a   Ilyes Choubani   Replication of th...
362
363
364
365
366
367
368
369
370
371
372
373
374
                        xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1
                    
                    ;endelse
                    endif
                    
                
                endif ;else begin ; normal plot
                if not keyword_set(norm) then begin        
                    if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
                        
                        ;not so sure about the multiplicative factor
                        
                        ;Plotting of the spectra of the dust species
afde94a3   Ilyes Choubani   general update
375
                    
67bd858a   Ilyes Choubani   Replication of th...
376
                        FOR i=0L,Ngrains-1 DO BEGIN
07372e26   Ilyes Choubani   Corrected huge pl...
377
                            cgoplot,1/st.ext.wav,transpose((st.ext.(1))[i,*]+(st.ext.(2))[i,*])*(*!dustem_HCD)/1.0e21,color=use_cols[i],pos=position,noerase=1
67bd858a   Ilyes Choubani   Replication of th...
378
                        ENDFOR
07372e26   Ilyes Choubani   Corrected huge pl...
379
                            
67bd858a   Ilyes Choubani   Replication of th...
380
381
382
383
384
385
386
                                                
                        ;Plotting of the plugins.
                        for i=0L,n_plgns-1 do begin
                            
                            if isa((*!dustem_plugin).(0).spec) then begin 
                            
                                IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_EXT') THEN begin
afde94a3   Ilyes Choubani   general update
387
                                    cgoplot,1/st.ext.wav,((*(*!dustem_plugin).(i).spec)[*,0]),color=clrs_plgns[i],pos=position,noerase=1,linestyle=2               
67bd858a   Ilyes Choubani   Replication of th...
388
389
390
391
392
393
394
395
396
397
398
                                ENDIF
                                
                            endif
                            
                        endfor
                        
                                                
                        ;PLotting of the interpolates corresponding to spectrum and filter points
                           
                        IF ct_spec NE 0 THEN BEGIN
                        
0068116a   Ilyes Choubani   General update + ...
399
                            xx=((*(*!dustem_data).ext).wav)[idx_spec]
67bd858a   Ilyes Choubani   Replication of th...
400
                            yy=dustem_interp[idx_spec]
afde94a3   Ilyes Choubani   general update
401
                            cgoplot,1/xx,yy,color='Indian Red',pos=position,psym=7,syms=1,noerase=1   
67bd858a   Ilyes Choubani   Replication of th...
402
403
404
405
                        ENDIF
                        
                        
                        IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
406
                            xx=((*(*!dustem_data).ext).wav)[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
407
                            yy=dustem_interp[idx_filt]
afde94a3   Ilyes Choubani   general update
408
                            cgoplot,1/xx,yy,color='red',pos=position,psym=6,syms=2,noerase=1
67bd858a   Ilyes Choubani   Replication of th...
409
410
411
412
                        ENDIF
                        
                        
                        ;Plotting of the total dust emission spectrum
afde94a3   Ilyes Choubani   general update
413
                        cgoplot,1/st.ext.wav,dustem_spec,pos=position,noerase=1,/xlog,/ys,/xs,/ylog
67bd858a   Ilyes Choubani   Replication of th...
414
415
416
417
418
419
420
421
422
423
                         
                                        
                                
                    endif ;else begin ;The data points in the plot that remain unchanged.
                        ;stop
                    if not keyword_set(refresh) then begin
                        ;Spectrum points are treated before for plotting reasons. 
                        if ct_spec ne 0 then begin 
                            
                            ;Plotting of spectrum data points (to be fitted)
0068116a   Ilyes Choubani   General update + ...
424
                            cgplot,1/((*(*!dustem_data).ext).wav)(idx_spec),((*(*!dustem_data).ext).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=16,syms=0.8,ytickformat='dstmwrp_exp'                
67bd858a   Ilyes Choubani   Replication of th...
425
426
                            
                            ;Plotting of the spectrum error points
0068116a   Ilyes Choubani   General update + ...
427
428
                            rms=3.*((*(*!dustem_data).ext).sigma)(idx_spec)/2.
                            cgerrplot,1/((*(*!dustem_data).ext).wav)(idx_spec),((*(*!dustem_data).ext).values)(idx_spec)-rms,((*(*!dustem_data).ext).values)(idx_spec)+rms,color='Powder Blue'
67bd858a   Ilyes Choubani   Replication of th...
429
430
431
432
433
434

                        endif
                        
                        if ct_filt ne 0 then begin
                        
                            ;Plotting of filter data points (to be fitted) + testing for prior plotting                         
0068116a   Ilyes Choubani   General update + ...
435
436
                            if ct_spec ne 0 then cgoplot,1/((*(*!dustem_data).ext).wav)(idx_filt),((*(*!dustem_data).ext).values)(idx_filt),charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,pos=position,/ys,xs=9,noerase=1,xtickformat='(A1)',xr=xr,yr=yr,ytickformat='dstmwrp_exp',/ylog,/xlog else $
                                cgplot,1/((*(*!dustem_data).ext).wav)(idx_filt),((*(*!dustem_data).ext).values)(idx_filt),charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,pos=position,/ys,xs=9,noerase=1,xtickformat='(A1)',xtit=' ',xr=xr,yr=yr,ytickformat='dstmwrp_exp',/ylog,/xlog
67bd858a   Ilyes Choubani   Replication of th...
437
438
439
                            
                            
                            ;Plotting of the filter error points
0068116a   Ilyes Choubani   General update + ...
440
441
                            rms=3.*((*(*!dustem_data).ext).sigma)(idx_filt)/2.;/dustem_sed(idx_filt)
                            cgerrplot,1/((*(*!dustem_data).ext).wav)(idx_filt),((*(*!dustem_data).ext).values)(idx_filt)-rms,((*(*!dustem_data).ext).values)(idx_filt)+rms,color='Dodger Blue'
67bd858a   Ilyes Choubani   Replication of th...
442
443
444
445
446
                            
                        endif
                        
                        
                        ;Plotting of frequency axis
c0df0660   Ilyes Choubani   replaced all call...
447
                        axis, xaxis=1, xlog=1, xs=1, xminor=10, xticklen=0.05, xrange=((!const.c*1E6*xr)*1E-9),charsize=1.15,xtitle=textoidl('\nu (GHz)'),color='black'
67bd858a   Ilyes Choubani   Replication of th...
448
                        
f2caf3f1   Ilyes Choubani   Debugging some er...
449
                        xyouts,pospltxt[0],pospltxt[1],textoidl('\tau_{EXT}'),color=0,/normal,charsize=1.3;,charthick=2.0
67bd858a   Ilyes Choubani   Replication of th...
450
451
                         
                        ;Locating all the hidden data points (spectrum+filter)
0068116a   Ilyes Choubani   General update + ...
452
                        match2,((*(*!dustem_data).ext).wav),((*(*!dustem_show).ext).wav),show_sedpts,fit_sedpts ;only show_sedpts is needed
74103816   Ilyes Choubani   small update
453
                        idx_rmv_sed=where(fit_sedpts eq -1, ct_hdnpts) ; indices of the points to hide
67bd858a   Ilyes Choubani   Replication of th...
454
                        ;Locating the hidden spectrum and filter data points                                        
0068116a   Ilyes Choubani   General update + ...
455
456
                        idx_filt_hdn = where((((*(*!dustem_show).ext).filt_names))(idx_rmv_sed) NE 'SPECTRUM',ct_filt_hdn)
                        idx_spec_hdn = where(((*(*!dustem_show).ext).filt_names)(idx_rmv_sed) EQ 'SPECTRUM',ct_spec_hdn)
67bd858a   Ilyes Choubani   Replication of th...
457
458
459
460
461
                         
                        if ct_hdnpts ne 0 then begin ;Hidden data points are present 
                            ;stop
                            if ct_spec_hdn ne 0 then begin
                                ;Plotting of hidden spectrum data points
0068116a   Ilyes Choubani   General update + ...
462
                                cgoplot,1/(((*(*!dustem_show).ext).wav)[idx_rmv_sed])(idx_spec_hdn),(((*(*!dustem_show).ext).values)[idx_rmv_sed])(idx_spec_hdn),pos=position,/ylog,/xlog,/ys,xs=9,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=yr,psym=16,syms=0.8
67bd858a   Ilyes Choubani   Replication of th...
463
464
                                
                                ;Plotting of hidden spectrum error points
0068116a   Ilyes Choubani   General update + ...
465
466
                                rms=3.*(((*(*!dustem_show).ext).sigma)[idx_rmv_sed])(idx_spec_hdn)/2.
                                cgerrplot,1/(((*(*!dustem_show).ext).wav)[idx_rmv_sed])(idx_spec_hdn),(((*(*!dustem_show).ext).values)[idx_rmv_sed])(idx_spec_hdn)-rms,(((*(*!dustem_show).ext).values)[idx_rmv_sed])(idx_spec_hdn)+rms,color='Black'
67bd858a   Ilyes Choubani   Replication of th...
467
468
469
470
                            endif                                            
                            
                            if ct_filt_hdn then begin
                            ;Plotting of hidden filter data points 
0068116a   Ilyes Choubani   General update + ...
471
                                cgoplot,1/(((*(*!dustem_show).ext).wav)[idx_rmv_sed])(idx_filt_hdn),(((*(*!dustem_show).ext).values)[idx_rmv_sed])(idx_filt_hdn),pos=position,/ylog,/xlog,/ys,xs=9,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=yr,psym=16,syms=0.8                                           
67bd858a   Ilyes Choubani   Replication of th...
472
473
                                
                                ;Plotting of hidden filter error point
0068116a   Ilyes Choubani   General update + ...
474
475
                                rms=3.*(((*(*!dustem_show).ext).sigma)[idx_rmv_sed])(idx_filt_hdn)/2.
                                cgerrplot,1/(((*(*!dustem_show).ext).wav)[idx_rmv_sed])(idx_filt_hdn),(((*(*!dustem_show).ext).values)[idx_rmv_sed])(idx_filt_hdn)-rms,(((*(*!dustem_show).ext).values)[idx_rmv_sed])(idx_filt_hdn)+rms,color='Black'
67bd858a   Ilyes Choubani   Replication of th...
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
                                
                            endif
                                                           
                        endif    
                        
                        
                    
                    ;endelse 
                    endif
                
                
                ;endelse 
                endif            
            ;endelse
            endif
          
b5314324   Ilyes Choubani   updating the plot...
492
493
494
        
        end
        
67bd858a   Ilyes Choubani   Replication of th...
495
496
        'POLEXT': begin 
            
4b745987   Ilyes Choubani   minor update
497
498
499
500
            IF ct_x NE 0 then begin
                xr=xr_x
                yr=yr_x
            ENDIF
afde94a3   Ilyes Choubani   general update
501
502
503
504
505
506
            
            vectw=DINDGEN(1001)*(alog10(1E7) - alog10(1E5))/(1000 - 1L) + alog10(1E5)
            vectw=10^vectw[1:*]
            vectw=[wavs,vectw]
            vectx=vectw*0+1
            
0068116a   Ilyes Choubani   General update + ...
507
508
            idx_filt=where((*(*!dustem_data).polext).filt_names NE 'SPECTRUM',ct_filt)
            idx_spec=where((*(*!dustem_data).polext).filt_names EQ 'SPECTRUM',ct_spec)
18e4331f   Ilyes Choubani   general update (f...
509
510
511
512
513
514
515
            
            ;#1) get the plotting keywords (pertaining to each data set) @here when the _extra structure is ready
            
            if keyword_set(nodata) then begin ;when the data is not present
            
                if keyword_set(norm) then begin ;normalized plot
                    
f2caf3f1   Ilyes Choubani   Debugging some er...
516
                    xtit=textoidl('1/\lambda (\mum^{_1})')
18e4331f   Ilyes Choubani   general update (f...
517
                    if !run_pol then xtit = ''
afde94a3   Ilyes Choubani   general update
518
                    cgplot,1/vectw,vectx,/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
18e4331f   Ilyes Choubani   general update (f...
519
520
521
                    xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1                        
                
                endif else begin ;normal plot
afde94a3   Ilyes Choubani   general update
522
                    ;/NODATA
18e4331f   Ilyes Choubani   general update (f...
523
                    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  
c0df0660   Ilyes Choubani   replaced all call...
524
                    axis, xaxis=1 ,xlog=1 ,xrange=((!const.c*1E6*xr)*1E-9),charsize=1.15,xtitle=textoidl('\nu (GHz)'),xticklen=0.05,xminor=10,color='black'
94c4dffa   Ilyes Choubani   update + fixes fo...
525
                    xyouts,pospltxt[0],pospltxt[1],textoidl('\tau_{PEXT}'),color=0,/normal,charsize=1.3;,charthick=2.0
18e4331f   Ilyes Choubani   general update (f...
526
527
528
529
530
531
532
533
534
535
536
                  
                endelse  
                
            
            endif else begin ;when the data is present 
            
                if keyword_set(norm) then begin 
                    
                    if keyword_set(refresh) then begin ;The data points in the plot that are being refreshed 
                        
                        IF ct_spec NE 0 THEN BEGIN
94c4dffa   Ilyes Choubani   update + fixes fo...
537
                            
0068116a   Ilyes Choubani   General update + ...
538
                            xx=((*(*!dustem_data).polext).wav)[idx_spec]
5f04fa07   Ilyes Choubani   general update
539
                            yy=dustem_interp[idx_spec]
0068116a   Ilyes Choubani   General update + ...
540
                            rms=3.*((*(*!dustem_data).polext).sigma)(idx_spec)/2.
94c4dffa   Ilyes Choubani   update + fixes fo...
541
542
543
544
                            indzero = where(yy NE 0, ct_zero)
                            
                            IF ct_zero NE 0 THEN BEGIN
                            
0068116a   Ilyes Choubani   General update + ...
545
546
                                cgoplot,(1/xx)[indzero],(((*(*!dustem_data).polext).values)[idx_spec])[indzero]/yy[indzero],color='Powder Blue',psym=16,syms=0.8,noerase=1,pos=position
                                cgerrplot,(1/((*(*!dustem_data).polext).wav)(idx_spec))[indzero],((((*(*!dustem_data).polext).values)[idx_spec])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).polext).values)[idx_spec])[indzero]+rms[indzero])/yy[indzero],color='Powder Blue'
94c4dffa   Ilyes Choubani   update + fixes fo...
547
548
                            
                            ENDIF
18e4331f   Ilyes Choubani   general update (f...
549
550
551
                        ENDIF
                        
                        IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
552
                            xx=((*(*!dustem_data).polext).wav)[idx_filt]
5f04fa07   Ilyes Choubani   general update
553
                            yy=dustem_interp[idx_filt]
0068116a   Ilyes Choubani   General update + ...
554
                            rms=3.*((*(*!dustem_data).polext).sigma)(idx_filt)/2.
94c4dffa   Ilyes Choubani   update + fixes fo...
555
556
557
                            indzero = where(yy NE 0, ct_zero)
                            IF ct_zero NE 0 THEN BEGIN
                             
0068116a   Ilyes Choubani   General update + ...
558
559
                                cgoplot,(1/xx)[indzero],(((*(*!dustem_data).polext).values)[idx_filt])[indzero]/yy[indzero],psym=16,color='Dodger Blue',syms=0.8,noerase=1,pos=position
                                cgerrplot,(1/((*(*!dustem_data).polext).wav)(idx_filt))[indzero],((((*(*!dustem_data).polext).values)[idx_filt])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).polext).values)[idx_filt])[indzero]+rms[indzero])/yy[indzero],color='Dodger Blue';,/overplot 
94c4dffa   Ilyes Choubani   update + fixes fo...
560
561
                            
                            ENDIF
18e4331f   Ilyes Choubani   general update (f...
562
563
564
                        ENDIF
                            
                        
5f04fa07   Ilyes Choubani   general update
565
                    endif else begin ;The data points in the plot that remain unchanged ; UNNECESSARY BLOCK but needed to limit erros when calls are made with missing keywords.
18e4331f   Ilyes Choubani   general update (f...
566
                        
f2caf3f1   Ilyes Choubani   Debugging some er...
567
                        xtit=textoidl('1/\lambda (\mum^{-1})')
18e4331f   Ilyes Choubani   general update (f...
568
                        if !run_pol then xtit = ''
afde94a3   Ilyes Choubani   general update
569
                        cgplot,1/vectw,vectx,/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
18e4331f   Ilyes Choubani   general update (f...
570
571
572
573
574
575
576
577
578
579
580
                        xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1
                    
                    endelse
                    
                
                endif else begin ; normal plot
                        
                    if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
                        
                        ;Plotting of the spectra of the dust species
                        FOR i=0L,Ngrains-1 DO BEGIN
07372e26   Ilyes Choubani   Corrected huge pl...
581
582
                            vecto = transpose(((st.polext.(1))[i,*]+(st.polext.(2))[i,*]))
                            cgoplot,1/st.polext.wav,vecto*(*!dustem_HCD)/1.0e21,color=use_cols[i],pos=position,noerase=1
18e4331f   Ilyes Choubani   general update (f...
583
584
585
586
587
588
                        ENDFOR
                        
                        ;stop
                                                
                        ;Plotting of the plugins.
                        for i=0L,n_plgns-1 do begin
3c479f24   Ilyes Choubani   Allowing to fix p...
589
                            If isa((*!dustem_plugin).(0).spec) then begin
67bd858a   Ilyes Choubani   Replication of th...
590
                                IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLEXT') THEN begin
afde94a3   Ilyes Choubani   general update
591
                                    cgoplot,1/st.polext.wav,sqrt(((*(*!dustem_plugin).(i).spec)[*,1])^2+((*(*!dustem_plugin).(i).spec)[*,2])^2),color=clrs_plgns[i],pos=position,noerase=1,linestyle=2               
3c479f24   Ilyes Choubani   Allowing to fix p...
592
593
                                ENDIF 
                            endif
18e4331f   Ilyes Choubani   general update (f...
594
595
596
597
598
599
                        endfor
                                                
                        ;PLotting of the interpolates corresponding to spectrum and filter points
                           
                        IF ct_spec NE 0 THEN BEGIN
                        
0068116a   Ilyes Choubani   General update + ...
600
                            xx=((*(*!dustem_data).polext).wav)[idx_spec]
5f04fa07   Ilyes Choubani   general update
601
                            yy=dustem_interp[idx_spec]
afde94a3   Ilyes Choubani   general update
602
                            cgoplot,1/xx,yy,color='Indian Red',pos=position,psym=7,syms=2,noerase=1   
18e4331f   Ilyes Choubani   general update (f...
603
604
605
606
                        ENDIF
                        
                        
                        IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
607
                            xx=((*(*!dustem_data).polext).wav)[idx_filt]
5f04fa07   Ilyes Choubani   general update
608
                            yy=dustem_interp[idx_filt]
afde94a3   Ilyes Choubani   general update
609
                            cgoplot,1/xx,yy,color='red',pos=position,psym=6,syms=2,noerase=1
18e4331f   Ilyes Choubani   general update (f...
610
611
612
                        ENDIF
                        
                        ;Plotting of the total dust emission spectru
afde94a3   Ilyes Choubani   general update
613
                        cgoplot,1/st.polext.wav,dustem_spec,pos=position,noerase=1,/xlog,/ys,/xs,/ylog
5f04fa07   Ilyes Choubani   general update
614
                        ;cgoplot,st.polsed.wav,st.polsed.em_tot*fact,pos=position,noerase=1,/xlog,/ys,/xs,/ylog
18e4331f   Ilyes Choubani   general update (f...
615
616
617
618
619
620
621
622
                                        
                                
                    endif else begin ;The data points in the plot that remain unchanged.
                        
                        ;Spectrum points are treated before for plotting reasons. 
                        if ct_spec ne 0 then begin 
                            
                            ;Plotting of spectrum data points (to be fitted)
0068116a   Ilyes Choubani   General update + ...
623
                            cgplot,1/((*(*!dustem_data).polext).wav)(idx_spec),((*(*!dustem_data).polext).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'                
18e4331f   Ilyes Choubani   general update (f...
624
625
                            
                            ;Plotting of the spectrum error points
0068116a   Ilyes Choubani   General update + ...
626
627
                            rms=3.*((*(*!dustem_data).polext).sigma)(idx_spec)/2.
                            cgerrplot,1/((*(*!dustem_data).polext).wav)(idx_spec),((*(*!dustem_data).polext).values)(idx_spec)-rms,((*(*!dustem_data).polext).values)(idx_spec)+rms,color='Powder Blue'
18e4331f   Ilyes Choubani   general update (f...
628
629
630
631
632
633

                        endif
                        
                        if ct_filt ne 0 then begin
                            plotsym,0,/fill
                            ;Plotting of filter data points (to be fitted) + testing for prior plotting                         
0068116a   Ilyes Choubani   General update + ...
634
635
                            if ct_spec ne 0 then cgoplot,1/((*(*!dustem_data).polext).wav)(idx_filt),((*(*!dustem_data).polext).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 $
                                cgplot,1/((*(*!dustem_data).polext).wav)(idx_filt),((*(*!dustem_data).polext).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
18e4331f   Ilyes Choubani   general update (f...
636
637
638
                            
                            
                            ;Plotting of the filter error points
0068116a   Ilyes Choubani   General update + ...
639
640
                            rms=3.*((*(*!dustem_data).polext).sigma)(idx_filt)/2.;/dustem_polsed(idx_filt)
                            cgerrplot,1/((*(*!dustem_data).polext).wav)(idx_filt),((*(*!dustem_data).polext).values)(idx_filt)-rms,((*(*!dustem_data).polext).values)(idx_filt)+rms,color='Dodger Blue'
18e4331f   Ilyes Choubani   general update (f...
641
642
643
644
645
                            
                        endif
                        
                        
                        ;Plotting of frequency axis
c0df0660   Ilyes Choubani   replaced all call...
646
                        axis, xaxis=1, xlog=1, xs=1, xminor=10, xticklen=0.05, xrange=((!const.c*1E6*xr)*1E-9),charsize=1.15,xtitle=textoidl('\nu (GHz)'),color='black'
18e4331f   Ilyes Choubani   general update (f...
647
                        
94c4dffa   Ilyes Choubani   update + fixes fo...
648
                        xyouts,pospltxt[0],pospltxt[1],textoidl('\tau_{PEXT}'),color=0,/normal,charsize=1.3;,charthick=2.0
18e4331f   Ilyes Choubani   general update (f...
649
650
                         
                        ;Locating all the hidden data points (spectrum+filter)
0068116a   Ilyes Choubani   General update + ...
651
                        match2,((*(*!dustem_data).polext).wav),((*(*!dustem_show).polext).wav),show_polsedpts,fit_polsedpts ;only show_polsedpts is needed
74103816   Ilyes Choubani   small update
652
                        idx_rmv_polsed=where(fit_polsedpts eq -1, ct_hdnpts) ; indices of the points to hide  - not renaming this and keeping the polsed notation
2df3360b   Ilyes Choubani   Correcting error:...
653
                        ;Locating the hidden spectrum and filter data points                                        
0068116a   Ilyes Choubani   General update + ...
654
655
                        idx_filt_hdn = where((((*(*!dustem_show).polext).filt_names))(idx_rmv_polsed) NE 'SPECTRUM',ct_filt_hdn)
                        idx_spec_hdn = where(((*(*!dustem_show).polext).filt_names)(idx_rmv_polsed) EQ 'SPECTRUM',ct_spec_hdn)
2df3360b   Ilyes Choubani   Correcting error:...
656
                        
1355825c   Ilyes Choubani   General update
657
                        ;stop
18e4331f   Ilyes Choubani   general update (f...
658
659
                        if ct_hdnpts ne 0 then begin ;Hidden data points are present 
                            ;stop
18e4331f   Ilyes Choubani   general update (f...
660
661
662
                            
                            if ct_spec_hdn ne 0 then begin
                                ;Plotting of hidden spectrum data points
0068116a   Ilyes Choubani   General update + ...
663
                                cgoplot,1/(((*(*!dustem_show).polext).wav)[idx_rmv_polsed])(idx_spec_hdn),(((*(*!dustem_show).polext).values)[idx_rmv_polsed])(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
18e4331f   Ilyes Choubani   general update (f...
664
665
                                
                                ;Plotting of hidden spectrum error points
0068116a   Ilyes Choubani   General update + ...
666
667
                                rms=3.*(((*(*!dustem_show).polext).sigma)[idx_rmv_polsed])(idx_spec_hdn)/2.
                                cgerrplot,1/(((*(*!dustem_show).polext).wav)[idx_rmv_polsed])(idx_spec_hdn),(((*(*!dustem_show).polext).values)[idx_rmv_polsed])(idx_spec_hdn)-rms,(((*(*!dustem_show).polext).values)[idx_rmv_polsed])(idx_spec_hdn)+rms,color='Black'
18e4331f   Ilyes Choubani   general update (f...
668
669
                            endif                                            
                            
1355825c   Ilyes Choubani   General update
670
                            if ct_filt_hdn ne 0 then begin
18e4331f   Ilyes Choubani   general update (f...
671
                            ;Plotting of hidden filter data points 
0068116a   Ilyes Choubani   General update + ...
672
                                cgoplot,1/(((*(*!dustem_show).polext).wav)[idx_rmv_polsed])(idx_filt_hdn),(((*(*!dustem_show).polext).values)[idx_rmv_polsed])(idx_filt_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                                           
18e4331f   Ilyes Choubani   general update (f...
673
674
                                
                                ;Plotting of hidden filter error point
0068116a   Ilyes Choubani   General update + ...
675
676
                                rms=3.*(((*(*!dustem_show).polext).sigma)[idx_rmv_polsed])(idx_filt_hdn)/2.
                                cgerrplot,1/(((*(*!dustem_show).polext).wav)[idx_rmv_polsed])(idx_filt_hdn),(((*(*!dustem_show).polext).values)[idx_rmv_polsed])(idx_filt_hdn)-rms,(((*(*!dustem_show).polext).values)[idx_rmv_polsed])(idx_filt_hdn)+rms,color='Black'
18e4331f   Ilyes Choubani   general update (f...
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
                                
                            endif
                                                           
                        endif    
                        
                        
                    
                    endelse 
                
                
                
                endelse 
            
            endelse
        
67bd858a   Ilyes Choubani   Replication of th...
692
        
b5314324   Ilyes Choubani   updating the plot...
693
694
        end
        
67bd858a   Ilyes Choubani   Replication of th...
695
        'POLSED': begin 
1bc09467   Ilyes Choubani   fixed issue with ...
696
            
4b745987   Ilyes Choubani   minor update
697
698
699
700
701
            IF ct_m NE 0 then begin
                xr=xr_m 
                yr=yr_m
                
            ENDIF
1bc09467   Ilyes Choubani   fixed issue with ...
702
703
704
705
            vectw=DINDGEN(1001)*(alog10(1E7) - alog10(1E5))/(1000 - 1L) + alog10(1E5)
            vectw=10^vectw[1:*]
            vectw=[wavs,vectw]
            vectx=vectw*0+1
67bd858a   Ilyes Choubani   Replication of th...
706
            
0068116a   Ilyes Choubani   General update + ...
707
708
            idx_filt=where((*(*!dustem_data).polsed).filt_names NE 'SPECTRUM',ct_filt)
            idx_spec=where((*(*!dustem_data).polsed).filt_names EQ 'SPECTRUM',ct_spec)
1355825c   Ilyes Choubani   General update
709
710
711
712
713
            
            ;#1) get the plotting keywords (pertaining to each data set) @here when the _extra structure is ready
            
            if keyword_set(nodata) then begin ;when the data is not present
            
67bd858a   Ilyes Choubani   Replication of th...
714
715
716
717
                if keyword_set(norm) then begin ;normalized plot
                    
                    xtit=textoidl('\lambda (\mum)')
                    if !run_pol then xtit = ''
1bc09467   Ilyes Choubani   fixed issue with ...
718
                    cgplot,vectw,vectx,/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
67bd858a   Ilyes Choubani   Replication of th...
719
720
721
722
723
                    xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1                        
                
                endif else begin ;normal plot
                    
                    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  
c0df0660   Ilyes Choubani   replaced all call...
724
                    axis, xaxis=1 ,xlog=1 ,xrange=((!const.c*1E6/xr)*1E-9),charsize=1.15,xtitle=textoidl('\nu (GHz)'),xticklen=0.05,xminor=10,color='black'
67bd858a   Ilyes Choubani   Replication of th...
725
726
727
728
729
730
731
732
733
734
                    xyouts,pospltxt[0],pospltxt[1],textoidl('P_{\nu} (MJy/sr)'),color=0,/normal,charsize=1.3;,charthick=2.0
                  
                endelse  
                
            
            endif else begin ;when the data is present 
            
                if keyword_set(norm) then begin 
                    
                    if keyword_set(refresh) then begin ;The data points in the plot that are being refreshed 
1355825c   Ilyes Choubani   General update
735
                        
67bd858a   Ilyes Choubani   Replication of th...
736
                        IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
737
                            xx=((*(*!dustem_data).polsed).wav)[idx_spec]
67bd858a   Ilyes Choubani   Replication of th...
738
                            yy=dustem_interp[idx_spec]
0068116a   Ilyes Choubani   General update + ...
739
                            rms=3.*((*(*!dustem_data).polsed).sigma)(idx_spec)/2.
94c4dffa   Ilyes Choubani   update + fixes fo...
740
741
                            indzero = where(yy NE 0, ct_zero)
                            IF ct_zero NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
742
743
                                cgoplot,xx[indzero],(((*(*!dustem_data).polsed).values)[idx_spec])[indzero]/yy[indzero],color='Powder Blue',psym=16,syms=0.8,noerase=1,pos=position
                                cgerrplot,(((*(*!dustem_data).polsed).wav)(idx_spec))[indzero],((((*(*!dustem_data).polsed).values)[idx_spec])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).polsed).values)[idx_spec])[indzero]+rms[indzero])/yy[indzero],color='Powder Blue'
94c4dffa   Ilyes Choubani   update + fixes fo...
744
                            ENDIF
67bd858a   Ilyes Choubani   Replication of th...
745
                        ENDIF
1355825c   Ilyes Choubani   General update
746
                        
67bd858a   Ilyes Choubani   Replication of th...
747
                        IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
748
                            xx=((*(*!dustem_data).polsed).wav)[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
749
                            yy=dustem_interp[idx_filt]
0068116a   Ilyes Choubani   General update + ...
750
                            rms=3.*((*(*!dustem_data).polsed).sigma)(idx_filt)/2.
94c4dffa   Ilyes Choubani   update + fixes fo...
751
752
                            indzero = where(yy NE 0, ct_zero)
                            IF ct_zero NE 0 THEN BEGIN 
0068116a   Ilyes Choubani   General update + ...
753
754
                                cgoplot,xx[indzero],(((*(*!dustem_data).polsed).values)[idx_filt])[indzero]/yy[indzero],psym=16,color='Dodger Blue',syms=0.8,noerase=1,pos=position
                                cgerrplot,(((*(*!dustem_data).polsed).wav)(idx_filt))[indzero],((((*(*!dustem_data).polsed).values)[idx_filt])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).polsed).values)[idx_filt])[indzero]+rms[indzero])/yy[indzero],color='Dodger Blue';,/overplot 
94c4dffa   Ilyes Choubani   update + fixes fo...
755
                            ENDIF
67bd858a   Ilyes Choubani   Replication of th...
756
757
                        ENDIF
                            
1355825c   Ilyes Choubani   General update
758
                        
67bd858a   Ilyes Choubani   Replication of th...
759
                    endif else begin ;The data points in the plot that remain unchanged ; UNNECESSARY BLOCK but needed to limit erros when calls are made with missing keywords.
1bc09467   Ilyes Choubani   fixed issue with ...
760
                        
67bd858a   Ilyes Choubani   Replication of th...
761
762
                        xtit=textoidl('\lambda (\mum)')
                        if !run_pol then xtit = ''
afde94a3   Ilyes Choubani   general update
763
                        cgplot,vectw,vectx,/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
67bd858a   Ilyes Choubani   Replication of th...
764
765
766
767
768
769
                        xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1
                    
                    endelse
                    
                
                endif else begin ; normal plot
1355825c   Ilyes Choubani   General update
770
                        
67bd858a   Ilyes Choubani   Replication of th...
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
                    if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
                        
                        ;Plotting of the spectra of the dust species
                        FOR i=0L,Ngrains-1 DO BEGIN
                            cgoplot,st.polsed.wav,st.polsed.(i+1)*fact,color=use_cols[i],pos=position,noerase=1
                        ENDFOR
                        
                        ;stop
                                                
                        ;Plotting of the plugins.
                        for i=0L,n_plgns-1 do begin
                            If isa((*!dustem_plugin).(0).spec) then begin
                                IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN begin
                                    cgoplot,st.polsed.wav,sqrt(((*(*!dustem_plugin).(i).spec)[*,1])^2+((*(*!dustem_plugin).(i).spec)[*,2])^2),color=clrs_plgns[i],pos=position,noerase=1,linestyle=2               
                                ENDIF 
                            endif
                        endfor
                                                
                        ;PLotting of the interpolates corresponding to spectrum and filter points
                           
                        IF ct_spec NE 0 THEN BEGIN
                        
0068116a   Ilyes Choubani   General update + ...
793
                            xx=((*(*!dustem_data).polsed).wav)[idx_spec]
67bd858a   Ilyes Choubani   Replication of th...
794
795
796
797
798
799
                            yy=dustem_interp[idx_spec]
                            cgoplot,xx,yy,color='Indian Red',pos=position,psym=7,syms=2,noerase=1   
                        ENDIF
                        
                        
                        IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
800
                            xx=((*(*!dustem_data).polsed).wav)[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
                            yy=dustem_interp[idx_filt]
                            cgoplot,xx,yy,color='red',pos=position,psym=6,syms=2,noerase=1
                        ENDIF
                        
                        ;Plotting of the total dust emission spectru
                        cgoplot,st.polsed.wav,dustem_spec,pos=position,noerase=1,/xlog,/ys,/xs,/ylog
                        ;cgoplot,st.polsed.wav,st.polsed.em_tot*fact,pos=position,noerase=1,/xlog,/ys,/xs,/ylog
                                        
                                
                    endif else begin ;The data points in the plot that remain unchanged.
                        
                        ;Spectrum points are treated before for plotting reasons. 
                        if ct_spec ne 0 then begin 
                            
                            ;Plotting of spectrum data points (to be fitted)
0068116a   Ilyes Choubani   General update + ...
816
                            cgplot,((*(*!dustem_data).polsed).wav)(idx_spec),((*(*!dustem_data).polsed).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'                
67bd858a   Ilyes Choubani   Replication of th...
817
818
                            
                            ;Plotting of the spectrum error points
0068116a   Ilyes Choubani   General update + ...
819
820
                            rms=3.*((*(*!dustem_data).polsed).sigma)(idx_spec)/2.
                            cgerrplot,((*(*!dustem_data).polsed).wav)(idx_spec),((*(*!dustem_data).polsed).values)(idx_spec)-rms,((*(*!dustem_data).polsed).values)(idx_spec)+rms,color='Powder Blue'
67bd858a   Ilyes Choubani   Replication of th...
821
822
823
824
825
826

                        endif
                        
                        if ct_filt ne 0 then begin
                            plotsym,0,/fill
                            ;Plotting of filter data points (to be fitted) + testing for prior plotting                         
0068116a   Ilyes Choubani   General update + ...
827
828
                            if ct_spec ne 0 then cgoplot,((*(*!dustem_data).polsed).wav)(idx_filt),((*(*!dustem_data).polsed).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 $
                                cgplot,((*(*!dustem_data).polsed).wav)(idx_filt),((*(*!dustem_data).polsed).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
67bd858a   Ilyes Choubani   Replication of th...
829
830
831
                            
                            
                            ;Plotting of the filter error points
0068116a   Ilyes Choubani   General update + ...
832
833
                            rms=3.*((*(*!dustem_data).polsed).sigma)(idx_filt)/2.;/dustem_polsed(idx_filt)
                            cgerrplot,((*(*!dustem_data).polsed).wav)(idx_filt),((*(*!dustem_data).polsed).values)(idx_filt)-rms,((*(*!dustem_data).polsed).values)(idx_filt)+rms,color='Dodger Blue'
67bd858a   Ilyes Choubani   Replication of th...
834
835
836
837
838
                            
                        endif
                        
                        
                        ;Plotting of frequency axis
c0df0660   Ilyes Choubani   replaced all call...
839
                        axis, xaxis=1, xlog=1, xs=1, xminor=10, xticklen=0.05, xrange=((!const.c*1E6/(xr))*1E-9),charsize=1.15,xtitle=textoidl('\nu (GHz)'),color='black'
67bd858a   Ilyes Choubani   Replication of th...
840
841
842
843
                        
                        xyouts,pospltxt[0],pospltxt[1],textoidl('P_{\nu} (MJy/sr)'),color=0,/normal,charsize=1.3;,charthick=2.0
                         
                        ;Locating all the hidden data points (spectrum+filter)
0068116a   Ilyes Choubani   General update + ...
844
                        match2,((*(*!dustem_data).polsed).wav),((*(*!dustem_show).polsed).wav),show_polsedpts,fit_polsedpts ;only show_polsedpts is needed
74103816   Ilyes Choubani   small update
845
                        idx_rmv_polsed=where(fit_polsedpts eq -1, ct_hdnpts) ; indices of the points to hide
67bd858a   Ilyes Choubani   Replication of th...
846
                        ;Locating the hidden spectrum and filter data points                                        
0068116a   Ilyes Choubani   General update + ...
847
848
                        idx_filt_hdn = where((((*(*!dustem_show).polsed).filt_names))(idx_rmv_polsed) NE 'SPECTRUM',ct_filt_hdn)
                        idx_spec_hdn = where(((*(*!dustem_show).polsed).filt_names)(idx_rmv_polsed) EQ 'SPECTRUM',ct_spec_hdn)
67bd858a   Ilyes Choubani   Replication of th...
849
850
851
852
853
854
855
                        
                        ;stop
                        if ct_hdnpts ne 0 then begin ;Hidden data points are present 
                            ;stop
                            
                            if ct_spec_hdn ne 0 then begin
                                ;Plotting of hidden spectrum data points
0068116a   Ilyes Choubani   General update + ...
856
                                cgoplot,(((*(*!dustem_show).polsed).wav)[idx_rmv_polsed])(idx_spec_hdn),(((*(*!dustem_show).polsed).values)[idx_rmv_polsed])(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
67bd858a   Ilyes Choubani   Replication of th...
857
858
                                
                                ;Plotting of hidden spectrum error points
0068116a   Ilyes Choubani   General update + ...
859
860
                                rms=3.*(((*(*!dustem_show).polsed).sigma)[idx_rmv_polsed])(idx_spec_hdn)/2.
                                cgerrplot,(((*(*!dustem_show).polsed).wav)[idx_rmv_polsed])(idx_spec_hdn),(((*(*!dustem_show).polsed).values)[idx_rmv_polsed])(idx_spec_hdn)-rms,(((*(*!dustem_show).polsed).values)[idx_rmv_polsed])(idx_spec_hdn)+rms,color='Black'
67bd858a   Ilyes Choubani   Replication of th...
861
862
863
864
                            endif                                            
                            
                            if ct_filt_hdn ne 0 then begin
                            ;Plotting of hidden filter data points 
0068116a   Ilyes Choubani   General update + ...
865
                                cgoplot,(((*(*!dustem_show).polsed).wav)[idx_rmv_polsed])(idx_filt_hdn),(((*(*!dustem_show).polsed).values)[idx_rmv_polsed])(idx_filt_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                                           
67bd858a   Ilyes Choubani   Replication of th...
866
867
                                
                                ;Plotting of hidden filter error point
0068116a   Ilyes Choubani   General update + ...
868
869
                                rms=3.*(((*(*!dustem_show).polsed).sigma)[idx_rmv_polsed])(idx_filt_hdn)/2.
                                cgerrplot,(((*(*!dustem_show).polsed).wav)[idx_rmv_polsed])(idx_filt_hdn),(((*(*!dustem_show).polsed).values)[idx_rmv_polsed])(idx_filt_hdn)-rms,(((*(*!dustem_show).polsed).values)[idx_rmv_polsed])(idx_filt_hdn)+rms,color='Black'
67bd858a   Ilyes Choubani   Replication of th...
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
                                
                            endif
                                                           
                        endif    
                        
                        
                    
                    endelse 
                
                
                
                endelse 
            
            endelse
        
        end
        
        'POLFRAC': begin 
96a72c8b   Ilyes Choubani   seperating xrange...
888
            
4b745987   Ilyes Choubani   minor update
889
890
891
892
893
            IF ct_m NE 0 then begin
                xr=xr_m
                yr=yr_m
                
            ENDIF
0068116a   Ilyes Choubani   General update + ...
894
895
            idx_filt=where((*(*!dustem_data).polfrac).filt_names NE 'SPECTRUM',ct_filt)
            idx_spec=where((*(*!dustem_data).polfrac).filt_names EQ 'SPECTRUM',ct_spec)
67bd858a   Ilyes Choubani   Replication of th...
896
897
898
899
900
901
            
            
            if keyword_set(nodata) then begin ;when the data is not present
            
                    xtit = ''
                    cgplot,wavs,wavs*0.,/nodata,/xlog,/ys,xs=1,pos=position,noerase=1,charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,xtit='',yr=[1.00E-04,50.00],/ylog,psym=8,syms=0.8  
07372e26   Ilyes Choubani   Corrected huge pl...
902
                    xyouts,pospltxt[0],pospltxt[1],textoidl('p (%)'),color=0,/normal,charsize=1.3;,charthick=2.0
67bd858a   Ilyes Choubani   Replication of th...
903
904
905
906
                 
            endif else begin ;when the data is present ; normal plot     
                        
                    if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
907
                          
67bd858a   Ilyes Choubani   Replication of th...
908
                        FOR i=0L,Ngrains-1 DO BEGIN
1355825c   Ilyes Choubani   General update
909
                            
5f04fa07   Ilyes Choubani   general update
910
                            testneq = where(st.polsed.(i+1) ne 0,countneq)
1355825c   Ilyes Choubani   General update
911
                            
5f04fa07   Ilyes Choubani   general update
912
913
914
                            if countneq ne 0 then begin 
                                vecfin = st.polsed.(i+1)*0.0
                                
07372e26   Ilyes Choubani   Corrected huge pl...
915
916
                                vecfin[testneq] = ((st.polsed.(i+1))[testneq])*fact[testneq]/extra_spec[testneq];(st.sed.em_tot)[testneq];;(st.sed.em_tot)[testneq];spec[testneq];(st.sed.(i+1))[testneq];*fact;(st.sed.(i+1))[testneq]
                                
5f04fa07   Ilyes Choubani   general update
917
918
                                cgoplot,st.polsed.wav,vecfin*100,pos=position,noerase=1,color=use_cols[i],xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=[1.00E-04,50.00]
                            endif   
1355825c   Ilyes Choubani   General update
919
920
921
                        ENDFOR
                       
                        ;Plotting of the plugins. 
5f04fa07   Ilyes Choubani   general update
922
                         
1355825c   Ilyes Choubani   General update
923
                        for i=0L,n_plgns-1 do begin
5f04fa07   Ilyes Choubani   general update
924
                            
3c479f24   Ilyes Choubani   Allowing to fix p...
925
926
927
928
929
930
931
932
933
                            if isa((*!dustem_plugin).(0).spec) then begin
                            
                                IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN begin
                                    vecfin = st.polsed.em_tot*0.0
                                    vecfin[testneq] = sqrt((((*(*!dustem_plugin).(i).spec)[*,1])^2)[testneq]+(((*(*!dustem_plugin).(i).spec)[*,2])^2)[testneq])/((*(*!dustem_plugin).(i).spec)[*,0])[testneq]        
                                    cgoplot,st.polsed.wav,vecfin*100,color=clrs_plgns[i],pos=position,noerase=1,linestyle=2               
                                
                                ENDIF
                            endif
1355825c   Ilyes Choubani   General update
934
                            
1355825c   Ilyes Choubani   General update
935
936
                        endfor
                       
5f04fa07   Ilyes Choubani   general update
937
938
                       ;STOPPED HERE. CHECK QSED NOW. MOVING ON NOW. 
                       
1355825c   Ilyes Choubani   General update
939
940
941
942
943
                        
                         ;PLotting of the interpolates corresponding to spectrum and filter points
                        
                         IF ct_spec NE 0 THEN BEGIN
                         
0068116a   Ilyes Choubani   General update + ...
944
                             xx=((*(*!dustem_data).polfrac).wav)[idx_spec]
5f04fa07   Ilyes Choubani   general update
945
                             yy=dustem_interp[idx_spec]
fcb6eade   Ilyes Choubani   general update - ...
946
                             cgoplot,xx,yy*100,color='Indian Red',pos=position,psym=7,syms=2,noerase=1   
1355825c   Ilyes Choubani   General update
947
948
949
950
                         ENDIF
                         
                         
                         IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
951
                             xx=((*(*!dustem_data).polfrac).wav)[idx_filt]
5f04fa07   Ilyes Choubani   general update
952
                             yy=dustem_interp[idx_filt]
1355825c   Ilyes Choubani   General update
953
954
955
956
957
                             cgoplot,xx,yy*100,color='red',pos=position,psym=6,syms=2,noerase=1
                         ENDIF
                         
                         
                         ;Plotting of the total dust emission spectrum
afde94a3   Ilyes Choubani   general update
958
                         cgoplot,st.polsed.wav,dustem_spec*100,pos=position,noerase=1,/xlog,/ys,/xs               
1355825c   Ilyes Choubani   General update
959
960
961
                                
                    endif else begin ;The data points in the plot that remain unchanged.
                        
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
962

1355825c   Ilyes Choubani   General update
963
                        ;Spectrum points are treated before for plotting reasons. 
9cb38725   Ilyes Choubani   Fixed tests relat...
964
                        
1355825c   Ilyes Choubani   General update
965
966
967
                        if ct_spec ne 0 then begin 
                            
                            ;Plotting of spectrum data points (to be fitted)
0068116a   Ilyes Choubani   General update + ...
968
                            cgplot,((*(*!dustem_data).polfrac).wav)(idx_spec),((*(*!dustem_data).polfrac).values)(idx_spec)*100,/xlog,/ylog,/ys,xs=1,pos=position,noerase=1,xtit=' ',charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,yr=[1.00E-04,50.00],psym=16,syms=0.8;,ytickformat='dstmwrp_exp'                
1355825c   Ilyes Choubani   General update
969
970
                            
                            ;Plotting of the spectrum error points
0068116a   Ilyes Choubani   General update + ...
971
972
                            rms=3.*((*(*!dustem_data).polfrac).sigma)(idx_spec)/2.
                            cgerrplot,((*(*!dustem_data).polfrac).wav)(idx_spec),(((*(*!dustem_data).polfrac).values)(idx_spec)-rms)*100,(((*(*!dustem_data).polfrac).values)(idx_spec)+rms)*100,color='Powder Blue'
1355825c   Ilyes Choubani   General update
973
974
975
976
977
978

                        endif
                        
                        if ct_filt ne 0 then begin
                        
                            ;Plotting of filter data points (to be fitted) + testing for prior plotting                         
0068116a   Ilyes Choubani   General update + ...
979
980
                            if ct_spec ne 0 then cgoplot,((*(*!dustem_data).polfrac).wav)(idx_filt),((*(*!dustem_data).polfrac).values)(idx_filt)*100,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,pos=position,/ys,xs=1,noerase=1,xtickformat='(A1)',xr=xr,yr=[1.00E-04,50.00],/xlog,/ylog else $;,ytickformat='dstmwrp_exp'
                                cgplot,((*(*!dustem_data).polfrac).wav)(idx_filt),((*(*!dustem_data).polfrac).values)(idx_filt)*100,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,pos=position,/ys,xs=1,noerase=1,xtickformat='(A1)',xtit=' ',xr=xr,yr=[1.00E-04,50.00],/xlog,/ylog;,ytickformat='dstmwrp_exp'
1355825c   Ilyes Choubani   General update
981
982
983
                            
                            
                            ;Plotting of the filter error points
0068116a   Ilyes Choubani   General update + ...
984
985
                            rms=3.*((*(*!dustem_data).polfrac).sigma)(idx_filt)/2.;/dustem_polfrac(idx_filt)
                            cgerrplot,((*(*!dustem_data).polfrac).wav)(idx_filt),(((*(*!dustem_data).polfrac).values)(idx_filt)-rms)*100,(((*(*!dustem_data).polfrac).values)(idx_filt)+rms)*100,color='Dodger Blue'
1355825c   Ilyes Choubani   General update
986
987
988
989
990
                            
                        endif
                        
                        
                        
07372e26   Ilyes Choubani   Corrected huge pl...
991
                        xyouts,pospltxt[0],pospltxt[1],textoidl('p (%)'),color=0,/normal,charsize=1.3;,charthick=2.0
1355825c   Ilyes Choubani   General update
992
993
994
995
                         
                        ;Locating all the hidden data points (spectrum+filter)
                        
                        ;The filtering has been done prior (in the primary routine)
0068116a   Ilyes Choubani   General update + ...
996
                        match2,((*(*!dustem_data).polfrac).wav),((*(*!dustem_show).polfrac).wav),show_polfracpts,fit_polfracpts ;only show_polfracpts is needed
74103816   Ilyes Choubani   small update
997
                        idx_rmv_polfrac=where(fit_polfracpts eq -1, ct_hdnpts) ; indices of the points to hide
1355825c   Ilyes Choubani   General update
998
                        ;stop
2df3360b   Ilyes Choubani   Correcting error:...
999
                        ;Locating the hidden spectrum and filter data points                                        
0068116a   Ilyes Choubani   General update + ...
1000
1001
                        idx_filt_hdn = where(((*(*!dustem_show).polfrac).filt_names)(idx_rmv_polfrac) NE 'SPECTRUM',ct_filt_hdn)
                        idx_spec_hdn = where(((*(*!dustem_show).polfrac).filt_names)(idx_rmv_polfrac) EQ 'SPECTRUM',ct_spec_hdn)
1355825c   Ilyes Choubani   General update
1002
1003
                        if ct_hdnpts ne 0 then begin ;Hidden data points are present 
                            ;stop
1355825c   Ilyes Choubani   General update
1004
1005
1006
                            
                            if ct_spec_hdn ne 0 then begin
                                ;Plotting of hidden spectrum data points
0068116a   Ilyes Choubani   General update + ...
1007
                                cgplot,(((*(*!dustem_show).polfrac).wav)[idx_rmv_polfrac])(idx_spec_hdn),(((*(*!dustem_show).polfrac).values)[idx_rmv_polfrac])(idx_spec_hdn)*100,pos=position,/xlog,/ylog,/ys,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=[1.00E-04,50.00],psym=8,syms=0.8
1355825c   Ilyes Choubani   General update
1008
1009
                                
                                ;Plotting of hidden spectrum error points
0068116a   Ilyes Choubani   General update + ...
1010
1011
                                rms=3.*(((*(*!dustem_show).polfrac).sigma)[idx_rmv_polfrac])(idx_spec_hdn)/2.
                                cgerrplot,(((*(*!dustem_show).polfrac).wav)[idx_rmv_polfrac])(idx_spec_hdn),((((*(*!dustem_show).polfrac).values)[idx_rmv_polfrac])(idx_spec_hdn)-rms)*100,((((*(*!dustem_show).polfrac).values)[idx_rmv_polfrac])(idx_spec_hdn)+rms)*100,color='Black'
1355825c   Ilyes Choubani   General update
1012
1013
1014
1015
1016
1017
                            endif                                           
                            
                            if ct_filt_hdn ne 0 then begin
                                ;stop
                                plotsym,0, /fill
                                ;Plotting of hidden filter data points 
0068116a   Ilyes Choubani   General update + ...
1018
                                cgplot,(((*(*!dustem_show).polfrac).wav)[idx_rmv_polfrac])(idx_filt_hdn),(((*(*!dustem_show).polfrac).values)[idx_rmv_polfrac])(idx_filt_hdn)*100,pos=position,/xlog,/ylog,/ys,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=[1.00E-04,50.00],psym=8,syms=0.8                                           
1355825c   Ilyes Choubani   General update
1019
1020
                                ;stop
                                ;Plotting of hidden filter error point
0068116a   Ilyes Choubani   General update + ...
1021
1022
                                rms=3.*(((*(*!dustem_show).polfrac).sigma)[idx_rmv_polfrac])(idx_filt_hdn)/2.
                                cgerrplot,(((*(*!dustem_show).polfrac).wav)[idx_rmv_polfrac])(idx_filt_hdn),((((*(*!dustem_show).polfrac).values)[idx_rmv_polfrac])(idx_filt_hdn)-rms)*100,((((*(*!dustem_show).polfrac).values)[idx_rmv_polfrac])(idx_filt_hdn)+rms)*100,color='Black'
1355825c   Ilyes Choubani   General update
1023
1024
1025
1026
1027
1028
1029
1030
1031
                                 
                            endif 
                                                           
                        endif 
                        
                    
                    endelse 
                
            endelse 
b5314324   Ilyes Choubani   updating the plot...
1032
1033
1034
        
        end
        
fdc0dcfe   Ilyes Choubani   adding forgotten ...
1035
        'FPOLEXT': BEGIN ; For completeness (not sure of the physical usefulness of this qauntity )
96a72c8b   Ilyes Choubani   seperating xrange...
1036
            
4b745987   Ilyes Choubani   minor update
1037
            IF ct_x NE 0 then begin
96a72c8b   Ilyes Choubani   seperating xrange...
1038
            
4b745987   Ilyes Choubani   minor update
1039
1040
1041
1042
                xr=xr_x
                yr=yr_x
                
            ENDIF
0068116a   Ilyes Choubani   General update + ...
1043
1044
            idx_filt=where((*(*!dustem_data).fpolext).filt_names NE 'SPECTRUM',ct_filt)
            idx_spec=where((*(*!dustem_data).fpolext).filt_names EQ 'SPECTRUM',ct_spec)
18e4331f   Ilyes Choubani   general update (f...
1045
            
18e4331f   Ilyes Choubani   general update (f...
1046
1047
1048
1049
            
            if keyword_set(nodata) then begin ;when the data is not present
            
                    xtit = ''
94c4dffa   Ilyes Choubani   update + fixes fo...
1050
1051
                    cgplot,wavs,wavs*0.,/nodata,/xlog,/ys,xs=1,pos=position,noerase=1,charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,xtit='',yr=[1.00E-04,10.00],/ylog,psym=8,syms=0.8  
                    xyouts,pospltxt[0],pospltxt[1],textoidl('\tau_{PEXT}/\tau_{EXT} (%)'),color=0,/normal,charsize=1.3;,charthick=2.0
18e4331f   Ilyes Choubani   general update (f...
1052
1053
1054
1055
1056
                 
            endif else begin ;when the data is present ; normal plot     
                        
                    if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
                        
67bd858a   Ilyes Choubani   Replication of th...
1057
                        
18e4331f   Ilyes Choubani   general update (f...
1058
                        FOR i=0L,Ngrains-1 DO BEGIN
5f04fa07   Ilyes Choubani   general update
1059
                            
07372e26   Ilyes Choubani   Corrected huge pl...
1060
1061
1062
                            vecto = transpose((st.polext.(1))[i,*]+(st.polext.(2))[i,*])
                            
                            testneq = where(vecto ne 0,countneq)
67bd858a   Ilyes Choubani   Replication of th...
1063
1064
                            
                            if countneq ne 0 then begin 
07372e26   Ilyes Choubani   Corrected huge pl...
1065
                                vecfin = vecto*0.0
5f04fa07   Ilyes Choubani   general update
1066
                                
07372e26   Ilyes Choubani   Corrected huge pl...
1067
                                vecfin[testneq] = (vecto[testneq])*(*!dustem_HCD)/1.0e21/extra_spec[testneq];(st.sed.em_tot)[testneq];spec[testneq];(st.sed.(i+1))[testneq];*fact;(st.sed.(i+1))[testneq]
67bd858a   Ilyes Choubani   Replication of th...
1068
                                 
94c4dffa   Ilyes Choubani   update + fixes fo...
1069
                                cgoplot,1/st.polext.wav,vecfin*100,pos=position,noerase=1,color=use_cols[i],xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=[1.00E-04,10.00]
67bd858a   Ilyes Choubani   Replication of th...
1070
                            endif   
18e4331f   Ilyes Choubani   general update (f...
1071
                        ENDFOR
67bd858a   Ilyes Choubani   Replication of th...
1072
1073
1074
                       
                        ;Plotting of the plugins. 
                         
18e4331f   Ilyes Choubani   general update (f...
1075
                        for i=0L,n_plgns-1 do begin
3c479f24   Ilyes Choubani   Allowing to fix p...
1076
1077
                            
                            if isa((*!dustem_plugin).(0).spec) then begin
67bd858a   Ilyes Choubani   Replication of th...
1078
1079
1080
1081
                            
                                IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLEXT') THEN begin
                                    vecfin = st.polext.ext_tot*0.0
                                    vecfin[testneq] = sqrt((((*(*!dustem_plugin).(i).spec)[*,1])^2)[testneq]+(((*(*!dustem_plugin).(i).spec)[*,2])^2)[testneq])/((*(*!dustem_plugin).(i).spec)[*,0])[testneq]        
afde94a3   Ilyes Choubani   general update
1082
                                    cgoplot,1/st.polext.wav,vecfin*100,color=clrs_plgns[i],pos=position,noerase=1,linestyle=2               
67bd858a   Ilyes Choubani   Replication of th...
1083
                                
3c479f24   Ilyes Choubani   Allowing to fix p...
1084
                                ENDIF
67bd858a   Ilyes Choubani   Replication of th...
1085
1086
                            endif
                            
18e4331f   Ilyes Choubani   general update (f...
1087
                        endfor
67bd858a   Ilyes Choubani   Replication of th...
1088
                       
67bd858a   Ilyes Choubani   Replication of th...
1089
                       
18e4331f   Ilyes Choubani   general update (f...
1090
1091
1092
1093
                         ;PLotting of the interpolates corresponding to spectrum and filter points
                        
                         IF ct_spec NE 0 THEN BEGIN
                         
0068116a   Ilyes Choubani   General update + ...
1094
                             xx=((*(*!dustem_data).fpolext).wav)[idx_spec]
5f04fa07   Ilyes Choubani   general update
1095
                             yy=dustem_interp[idx_spec]
afde94a3   Ilyes Choubani   general update
1096
                             cgoplot,1/xx,yy*100,color='Indian Red',pos=position,psym=7,syms=2,noerase=1   
18e4331f   Ilyes Choubani   general update (f...
1097
1098
1099
1100
                         ENDIF
                         
                         
                         IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1101
                             xx=((*(*!dustem_data).fpolext).wav)[idx_filt]
5f04fa07   Ilyes Choubani   general update
1102
                             yy=dustem_interp[idx_filt]
afde94a3   Ilyes Choubani   general update
1103
                             cgoplot,1/xx,yy*100,color='red',pos=position,psym=6,syms=2,noerase=1
18e4331f   Ilyes Choubani   general update (f...
1104
1105
1106
1107
                         ENDIF
                         
                         
                         ;Plotting of the total dust emission spectrum
afde94a3   Ilyes Choubani   general update
1108
                         cgoplot,1/st.polext.wav,dustem_spec*100,pos=position,noerase=1,/xlog,/ys,/xs
67bd858a   Ilyes Choubani   Replication of th...
1109
                                        
18e4331f   Ilyes Choubani   general update (f...
1110
1111
                                
                    endif else begin ;The data points in the plot that remain unchanged.
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1112
                         
18e4331f   Ilyes Choubani   general update (f...
1113
1114
                        
                        ;Spectrum points are treated before for plotting reasons. 
67bd858a   Ilyes Choubani   Replication of th...
1115
                        
18e4331f   Ilyes Choubani   general update (f...
1116
1117
1118
                        if ct_spec ne 0 then begin 
                            
                            ;Plotting of spectrum data points (to be fitted)
0068116a   Ilyes Choubani   General update + ...
1119
                            cgplot,1/((*(*!dustem_data).fpolext).wav)(idx_spec),((*(*!dustem_data).fpolext).values)(idx_spec)*100,/xlog,/ylog,/ys,xs=1,pos=position,noerase=1,xtit=' ',charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,yr=[1.00E-04,10.00],psym=16,syms=0.8;,ytickformat='dstmwrp_exp'                
18e4331f   Ilyes Choubani   general update (f...
1120
1121
                            
                            ;Plotting of the spectrum error points
0068116a   Ilyes Choubani   General update + ...
1122
1123
                            rms=3.*((*(*!dustem_data).fpolext).sigma)(idx_spec)/2.
                            cgerrplot,1/((*(*!dustem_data).fpolext).wav)(idx_spec),(((*(*!dustem_data).fpolext).values)(idx_spec)-rms)*100,(((*(*!dustem_data).fpolext).values)(idx_spec)+rms)*100,color='Powder Blue'
18e4331f   Ilyes Choubani   general update (f...
1124
1125
1126
1127
1128
1129

                        endif
                        
                        if ct_filt ne 0 then begin
                        
                            ;Plotting of filter data points (to be fitted) + testing for prior plotting                         
0068116a   Ilyes Choubani   General update + ...
1130
1131
                            if ct_spec ne 0 then cgoplot,1/((*(*!dustem_data).fpolext).wav)(idx_filt),((*(*!dustem_data).fpolext).values)(idx_filt)*100,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,pos=position,/ys,xs=1,noerase=1,xtickformat='(A1)',xr=xr,yr=[1.00E-04,10.00],/xlog,/ylog else $;,ytickformat='dstmwrp_exp'
                                cgplot,1/((*(*!dustem_data).fpolext).wav)(idx_filt),((*(*!dustem_data).fpolext).values)(idx_filt)*100,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,pos=position,/ys,xs=1,noerase=1,xtickformat='(A1)',xtit=' ',xr=xr,yr=[1.00E-04,10.00],/xlog,/ylog;,ytickformat='dstmwrp_exp'
18e4331f   Ilyes Choubani   general update (f...
1132
1133
1134
                            
                            
                            ;Plotting of the filter error points
0068116a   Ilyes Choubani   General update + ...
1135
1136
                            rms=3.*((*(*!dustem_data).fpolext).sigma)(idx_filt)/2.;/dustem_polfrac(idx_filt)
                            cgerrplot,1/((*(*!dustem_data).fpolext).wav)(idx_filt),(((*(*!dustem_data).fpolext).values)(idx_filt)-rms)*100,(((*(*!dustem_data).fpolext).values)(idx_filt)+rms)*100,color='Dodger Blue'
67bd858a   Ilyes Choubani   Replication of th...
1137
1138
1139
1140
1141
                            
                        endif
                        
                        
                        
94c4dffa   Ilyes Choubani   update + fixes fo...
1142
                        xyouts,pospltxt[0],pospltxt[1],textoidl('\tau_{PEXT}/\tau_{EXT} (%)'),color=0,/normal,charsize=1.3;,charthick=2.0
67bd858a   Ilyes Choubani   Replication of th...
1143
1144
1145
1146
                         
                        ;Locating all the hidden data points (spectrum+filter)
                        
                        ;The filtering has been done prior (in the primary routine)
0068116a   Ilyes Choubani   General update + ...
1147
                        match2,((*(*!dustem_data).fpolext).wav),((*(*!dustem_show).fpolext).wav),show_polfracpts,fit_polfracpts ;only show_polfracpts is needed
74103816   Ilyes Choubani   small update
1148
                        idx_rmv_polfrac=where(fit_polfracpts eq -1, ct_hdnpts) ; indices of the points to hide; 
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1149
                        
67bd858a   Ilyes Choubani   Replication of th...
1150
                        ;Locating the hidden spectrum and filter data points                                        
0068116a   Ilyes Choubani   General update + ...
1151
1152
                        idx_filt_hdn = where(((*(*!dustem_show).fpolext).filt_names)(idx_rmv_polfrac) NE 'SPECTRUM',ct_filt_hdn)
                        idx_spec_hdn = where(((*(*!dustem_show).fpolext).filt_names)(idx_rmv_polfrac) EQ 'SPECTRUM',ct_spec_hdn)
67bd858a   Ilyes Choubani   Replication of th...
1153
1154
1155
1156
1157
                        if ct_hdnpts ne 0 then begin ;Hidden data points are present 
                            ;stop
                            
                            if ct_spec_hdn ne 0 then begin
                                ;Plotting of hidden spectrum data points
0068116a   Ilyes Choubani   General update + ...
1158
                                cgplot,1/(((*(*!dustem_show).fpolext).wav)[idx_rmv_polfrac])(idx_spec_hdn),(((*(*!dustem_show).fpolext).values)[idx_rmv_polfrac])(idx_spec_hdn)*100,pos=position,/xlog,/ylog,/ys,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=[1.00E-04,10.00],psym=8,syms=0.8
67bd858a   Ilyes Choubani   Replication of th...
1159
1160
                                
                                ;Plotting of hidden spectrum error points
0068116a   Ilyes Choubani   General update + ...
1161
1162
                                rms=3.*(((*(*!dustem_show).fpolext).sigma)[idx_rmv_polfrac])(idx_spec_hdn)/2.
                                cgerrplot,1/(((*(*!dustem_show).fpolext).wav)[idx_rmv_polfrac])(idx_spec_hdn),((((*(*!dustem_show).fpolext).values)[idx_rmv_polfrac])(idx_spec_hdn)-rms)*100,((((*(*!dustem_show).fpolext).values)[idx_rmv_polfrac])(idx_spec_hdn)+rms)*100,color='Black'
67bd858a   Ilyes Choubani   Replication of th...
1163
1164
1165
1166
1167
1168
                            endif                                           
                            
                            if ct_filt_hdn ne 0 then begin
                                ;stop
                                plotsym,0, /fill
                                ;Plotting of hidden filter data points 
0068116a   Ilyes Choubani   General update + ...
1169
                                cgplot,1/(((*(*!dustem_show).fpolext).wav)[idx_rmv_polfrac])(idx_filt_hdn),(((*(*!dustem_show).fpolext).values)[idx_rmv_polfrac])(idx_filt_hdn)*100,pos=position,/xlog,/ylog,/ys,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=[1.00E-04,10.00],psym=8,syms=0.8                                           
67bd858a   Ilyes Choubani   Replication of th...
1170
1171
                                ;stop
                                ;Plotting of hidden filter error point
0068116a   Ilyes Choubani   General update + ...
1172
1173
                                rms=3.*(((*(*!dustem_show).fpolext).sigma)[idx_rmv_polfrac])(idx_filt_hdn)/2.
                                cgerrplot,1/(((*(*!dustem_show).fpolext).wav)[idx_rmv_polfrac])(idx_filt_hdn),((((*(*!dustem_show).fpolext).values)[idx_rmv_polfrac])(idx_filt_hdn)-rms)*100,((((*(*!dustem_show).fpolext).values)[idx_rmv_polfrac])(idx_filt_hdn)+rms)*100,color='Black'
67bd858a   Ilyes Choubani   Replication of th...
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
                                 
                            endif 
                                                           
                        endif 
                        
                    
                    endelse 
                
            endelse
        
        
        END
        
        
     
        'PSI_EM': begin ;will be copying code from qsed and hopefully it will work. NB: THIS IS FALSE . YOU DO NOT NEED A LOGARITHMIC AXIS
            
4b745987   Ilyes Choubani   minor update
1191
            IF ct_m NE 0 then begin
96a72c8b   Ilyes Choubani   seperating xrange...
1192
            
4b745987   Ilyes Choubani   minor update
1193
1194
1195
1196
                xr=xr_m 
                yr=yr_m
                
            ENDIF
0068116a   Ilyes Choubani   General update + ...
1197
1198
            idx_filt=where((*(*!dustem_data).psi_em).filt_names NE 'SPECTRUM',ct_filt)
            idx_spec=where((*(*!dustem_data).psi_em).filt_names EQ 'SPECTRUM',ct_spec)
67bd858a   Ilyes Choubani   Replication of th...
1199
1200
1201
1202
1203
1204
1205
            
            ;#1) get the plotting keywords (pertaining to each data set) @here when the _extra structure is ready
            
            if keyword_set(nodata) then begin ;when the data is not present
            
                    xtit = ''
                    cgplot,wavs,wavs*0.,/nodata,/xlog,/ys,xs=1,pos=position,noerase=1,charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,xtit='',yr=[-90.00,90.00],psym=8,syms=0.8  
07372e26   Ilyes Choubani   Corrected huge pl...
1206
                    xyouts,pospltxt[0],pospltxt[1],textoidl('\Psi (deg)'),color=0,/normal,charsize=1.3;,charthick=2.0
67bd858a   Ilyes Choubani   Replication of th...
1207
1208
1209
1210
1211
                 
            endif else begin ;when the data is present ; normal plot     
                        
                    if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
                        
67bd858a   Ilyes Choubani   Replication of th...
1212
1213
1214
1215
1216
1217
1218
                        
                        ;Plotting of the spectra of the dust species
                        FOR i=0L,Ngrains-1 DO BEGIN
                            testneq = where(st.polsed.(i+1) ne 0,countneq)
                            if countneq ne 0 then begin
                                vecfin = st.polsed.(i+1)*0.0
                            
07372e26   Ilyes Choubani   Corrected huge pl...
1219
                                vecfin[testneq] = ((st.polsed.(i+1))[testneq])/(st.sed.(i+1))[testneq];extra_spec[testneq];(st.sed.em_tot)[testneq];spec[testneq] ;removed multiplication by 'fact'. 
67bd858a   Ilyes Choubani   Replication of th...
1220
                                
07372e26   Ilyes Choubani   Corrected huge pl...
1221
1222
                                ;*****NB: These two lines will have to be modified if the polarization angle varies with the dust species and/or with wavelength
                                polar_ippsi2iqu,st.sed.(i+1)*fact,specqgrain,specugrain,vecfin,replicate(!dustem_psi,n_elements(vecfin)) ;temporary solution
f2caf3f1   Ilyes Choubani   Debugging some er...
1223
1224
1225
1226
1227
1228
1229
                                
                                ;You can replace the -0 values by 0 in order to avoid atan giving wrong values 
                                testnzero = where(specqgrain EQ -0., ct_nzero)
                                if ct_nzero ne 0 then specqgrain[testnzero] = 0
                                
                                cgoplot,st.polsed.wav,0.5*atan(specugrain, specqgrain)/!dtor,pos=position,noerase=1,color=use_cols[i],xr=xr,/xlog,ytickformat='(A1)',yr=[-90.00,90.00]
                                ;cgoplot,st.polsed.wav,replicate(!dustem_psi,n_elements(vecfin)),pos=position,noerase=1,color=use_cols[i],xr=xr,/xlog,ytickformat='(A1)',yr=[-90.00,90.00]
0068116a   Ilyes Choubani   General update + ...
1230
                                
67bd858a   Ilyes Choubani   Replication of th...
1231
1232
                            endif 
                        ENDFOR
1bc09467   Ilyes Choubani   fixed issue with ...
1233
                                                                        
67bd858a   Ilyes Choubani   Replication of th...
1234
1235
1236
1237
1238
1239
                        ;Plotting of the plugins.
                        for i=0L,n_plgns-1 do begin
                            
                            if isa((*!dustem_plugin).(0).spec) then begin
                                IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN begin
                                    ;dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i))[*,1],ppositions=position, /overplot, noerase=1, color=clrs_plgns[i], linestyle=2,xr=xr,/xlog
d7a2d8eb   Ilyes Choubani   typo
1240
                                    cgoplot,st.polsed.wav,0.5*atan((*(*!dustem_plugin).(i).spec)[*,2],(*(*!dustem_plugin).(i).spec)[*,1])/degtorad,pos=position,noerase=1, color=clrs_plgns[i], linestyle=2 ,xr=xr,/xlog,ytickformat='(A1)',yr=[-90.00,90.00]   
67bd858a   Ilyes Choubani   Replication of th...
1241
1242
1243
                                ENDIF
                            ENDIF
                        endfor
1bc09467   Ilyes Choubani   fixed issue with ...
1244
                        
67bd858a   Ilyes Choubani   Replication of th...
1245
1246
1247
1248
                         ;PLotting of the interpolates corresponding to spectrum and filter points
                        
                         IF ct_spec NE 0 THEN BEGIN
                         
0068116a   Ilyes Choubani   General update + ...
1249
                             xx=((*(*!dustem_data).psi_em).wav)[idx_spec]
67bd858a   Ilyes Choubani   Replication of th...
1250
1251
1252
                             yy=dustem_interp[idx_spec]
                             cgoplot,xx,yy,color='Indian Red',pos=position,psym=7,syms=2,noerase=1   
                         ENDIF
1bc09467   Ilyes Choubani   fixed issue with ...
1253
                         
67bd858a   Ilyes Choubani   Replication of th...
1254
1255
                         
                         IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1256
                             xx=((*(*!dustem_data).psi_em).wav)[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
1257
1258
1259
                             yy=dustem_interp[idx_filt]
                             cgoplot,xx,yy,color='red',pos=position,psym=6,syms=2,noerase=1
                         ENDIF
1bc09467   Ilyes Choubani   fixed issue with ...
1260
                         
67bd858a   Ilyes Choubani   Replication of th...
1261
1262
1263
1264
                         
                         ;Plotting of the total dust emission spectrum
                         ;cgoplot,st.sed.wav,0.5*atan(specu,specq)/degtorad,pos=position,noerase=1,/xlog,/ys,/xs
                         cgoplot,st.sed.wav,dustem_spec,pos=position,noerase=1,/xlog,/ys,/xs               
1bc09467   Ilyes Choubani   fixed issue with ...
1265
                                
67bd858a   Ilyes Choubani   Replication of th...
1266
                    endif else begin ;The data points in the plot that remain unchanged.
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1267
                         
67bd858a   Ilyes Choubani   Replication of th...
1268
1269
1270
1271
1272
                        
                        ;Spectrum points are treated before for plotting reasons. 
                        if ct_spec ne 0 then begin 
                            
                            ;Plotting of spectrum data points (to be fitted)
0068116a   Ilyes Choubani   General update + ...
1273
                            cgplot,((*(*!dustem_data).psi_em).wav)(idx_spec),((*(*!dustem_data).psi_em).values)(idx_spec),/xlog,/ys,xs=1,pos=position,noerase=1,xtit=' ',charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,yr=[-90.00,90.00],psym=16,syms=0.8;,ytickformat='dstmwrp_exp'                
67bd858a   Ilyes Choubani   Replication of th...
1274
1275
                            
                            ;Plotting of the spectrum error points
0068116a   Ilyes Choubani   General update + ...
1276
1277
                            rms=3.*((*(*!dustem_data).psi_em).sigma)(idx_spec)/2.
                            cgerrplot,((*(*!dustem_data).psi_em).wav)(idx_spec),((*(*!dustem_data).psi_em).values)(idx_spec)-rms,((*(*!dustem_data).psi_em).values)(idx_spec)+rms,color='Powder Blue'
67bd858a   Ilyes Choubani   Replication of th...
1278
1279
1280
1281
1282
1283

                        endif
                        
                        if ct_filt ne 0 then begin
                        
                            ;Plotting of filter data points (to be fitted) + testing for prior plotting                         
0068116a   Ilyes Choubani   General update + ...
1284
1285
                            if ct_spec ne 0 then cgoplot,((*(*!dustem_data).psi_em).wav)(idx_filt),((*(*!dustem_data).psi_em).values)(idx_filt),charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,pos=position,/ys,xs=1,noerase=1,xtickformat='(A1)',xr=xr,yr=[-90.00,90.00],/xlog else $;,ytickformat='dstmwrp_exp'
                                cgplot,((*(*!dustem_data).psi_em).wav)(idx_filt),((*(*!dustem_data).psi_em).values)(idx_filt),charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,pos=position,/ys,xs=1,noerase=1,xtickformat='(A1)',xtit=' ',xr=xr,yr=[-90.00,90.00],/xlog;,ytickformat='dstmwrp_exp'
67bd858a   Ilyes Choubani   Replication of th...
1286
1287
1288
                            
                            
                            ;Plotting of the filter error points
0068116a   Ilyes Choubani   General update + ...
1289
1290
                            rms=3.*((*(*!dustem_data).psi_em).sigma)(idx_filt)/2.;/dustem_psi_em(idx_filt)
                            cgerrplot,((*(*!dustem_data).psi_em).wav)(idx_filt),((*(*!dustem_data).psi_em).values)(idx_filt)-rms,((*(*!dustem_data).psi_em).values)(idx_filt)+rms,color='Dodger Blue'
67bd858a   Ilyes Choubani   Replication of th...
1291
1292
1293
1294
1295
                            
                        endif
                        
                        
                        
07372e26   Ilyes Choubani   Corrected huge pl...
1296
                        xyouts,pospltxt[0],pospltxt[1],textoidl('\Psi (deg)'),color=0,/normal,charsize=1.3;,charthick=2.0
67bd858a   Ilyes Choubani   Replication of th...
1297
1298
1299
1300
                         
                        ;Locating all the hidden data points (spectrum+filter)
                        
                        ;The filtering has been done prior (in the primary routine)
0068116a   Ilyes Choubani   General update + ...
1301
                        match2,((*(*!dustem_data).psi_em).wav),((*(*!dustem_show).psi_em).wav),show_psi_empts,fit_psi_empts ;only show_psi_empts is needed
74103816   Ilyes Choubani   small update
1302
                        idx_rmv_psi_em=where(fit_psi_empts eq -1, ct_hdnpts) ; indices of the points to hide
67bd858a   Ilyes Choubani   Replication of th...
1303
1304
                        ;stop
                        ;Locating the hidden spectrum and filter data points                                        
0068116a   Ilyes Choubani   General update + ...
1305
1306
                        idx_filt_hdn = where(((*(*!dustem_show).psi_em).filt_names)(idx_rmv_psi_em) NE 'SPECTRUM',ct_filt_hdn)
                        idx_spec_hdn = where(((*(*!dustem_show).psi_em).filt_names)(idx_rmv_psi_em) EQ 'SPECTRUM',ct_spec_hdn)
67bd858a   Ilyes Choubani   Replication of th...
1307
1308
1309
1310
1311
                        if ct_hdnpts ne 0 then begin ;Hidden data points are present 
                            ;stop
                            
                            if ct_spec_hdn ne 0 then begin
                                ;Plotting of hidden spectrum data points
0068116a   Ilyes Choubani   General update + ...
1312
                                cgplot,(((*(*!dustem_show).psi_em).wav)[idx_rmv_psi_em])(idx_spec_hdn),(((*(*!dustem_show).psi_em).values)[idx_rmv_psi_em])(idx_spec_hdn),pos=position,/xlog,/ys,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=[-90.00,90.00],psym=8,syms=0.8
67bd858a   Ilyes Choubani   Replication of th...
1313
1314
                                
                                ;Plotting of hidden spectrum error points
0068116a   Ilyes Choubani   General update + ...
1315
1316
                                rms=3.*(((*(*!dustem_show).psi_em).sigma)[idx_rmv_psi_em])(idx_spec_hdn)/2.
                                cgerrplot,(((*(*!dustem_show).psi_em).wav)[idx_rmv_psi_em])(idx_spec_hdn),(((*(*!dustem_show).psi_em).values)[idx_rmv_psi_em])(idx_spec_hdn)-rms,(((*(*!dustem_show).psi_em).values)[idx_rmv_psi_em])(idx_spec_hdn)+rms,color='Black'
67bd858a   Ilyes Choubani   Replication of th...
1317
1318
1319
1320
1321
1322
                            endif                                           
                            
                            if ct_filt_hdn ne 0 then begin
                                ;stop
                                plotsym,0, /fill
                                ;Plotting of hidden filter data points 
0068116a   Ilyes Choubani   General update + ...
1323
                                cgplot,(((*(*!dustem_show).psi_em).wav)[idx_rmv_psi_em])(idx_filt_hdn),(((*(*!dustem_show).psi_em).values)[idx_rmv_psi_em])(idx_filt_hdn),pos=position,/xlog,/ys,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=[-90.00,90.00],psym=8,syms=0.8                                           
67bd858a   Ilyes Choubani   Replication of th...
1324
1325
                                ;stop
                                ;Plotting of hidden filter error point
0068116a   Ilyes Choubani   General update + ...
1326
1327
                                rms=3.*(((*(*!dustem_show).psi_em).sigma)[idx_rmv_psi_em])(idx_filt_hdn)/2.
                                cgerrplot,(((*(*!dustem_show).psi_em).wav)[idx_rmv_psi_em])(idx_filt_hdn),(((*(*!dustem_show).psi_em).values)[idx_rmv_psi_em])(idx_filt_hdn)-rms,(((*(*!dustem_show).psi_em).values)[idx_rmv_psi_em])(idx_filt_hdn)+rms,color='Black'
67bd858a   Ilyes Choubani   Replication of th...
1328
1329
1330
1331
                                 
                            endif 
                                                           
                        endif 
67bd858a   Ilyes Choubani   Replication of th...
1332
1333
                    
                    endelse 
4b745987   Ilyes Choubani   minor update
1334
               
67bd858a   Ilyes Choubani   Replication of th...
1335
            endelse 
67bd858a   Ilyes Choubani   Replication of th...
1336
1337
1338
1339
1340
           
           
        end
        
        'PSI_EXT': begin ;MODIFYING THIS NOW - You should write a plugin for the modification of polarized extinction so that !dustem_psi_ext is different than !dustem_psi. 
96a72c8b   Ilyes Choubani   seperating xrange...
1341
1342
            
            
4b745987   Ilyes Choubani   minor update
1343
1344
1345
1346
            IF ct_x NE 0 then begin
                xr=xr_x 
                yr=yr_x
            ENDIF
67bd858a   Ilyes Choubani   Replication of th...
1347
        
0068116a   Ilyes Choubani   General update + ...
1348
1349
            idx_filt=where((*(*!dustem_data).psi_ext).filt_names NE 'SPECTRUM',ct_filt)
            idx_spec=where((*(*!dustem_data).psi_ext).filt_names EQ 'SPECTRUM',ct_spec)
67bd858a   Ilyes Choubani   Replication of th...
1350
1351
1352
1353
1354
1355
1356
            
            ;#1) get the plotting keywords (pertaining to each data set) @here when the _extra structure is ready
            
            if keyword_set(nodata) then begin ;when the data is not present
            
                    xtit = ''
                    cgplot,wavs,wavs*0.,/nodata,/xlog,/ys,xs=1,pos=position,noerase=1,charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,xtit='',yr=[-90.00,90.00],psym=8,syms=0.8  
f2caf3f1   Ilyes Choubani   Debugging some er...
1357
                    xyouts,pospltxt[0],pospltxt[1],textoidl('\Psi_{EXT} (deg)'),color=0,/normal,charsize=1.3;,charthick=2.0
67bd858a   Ilyes Choubani   Replication of th...
1358
1359
1360
1361
1362
1363
1364
1365
                 
            endif else begin ;when the data is present ; normal plot     
                        
                    if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
                        
                        ;##################TAKEN FROM SED
                        
                        ;Plotting of the spectra of the dust species
4b745987   Ilyes Choubani   minor update
1366
                        
67bd858a   Ilyes Choubani   Replication of th...
1367
                        FOR i=0L,Ngrains-1 DO BEGIN
4b745987   Ilyes Choubani   minor update
1368
                            
07372e26   Ilyes Choubani   Corrected huge pl...
1369
1370
1371
                            vecto = transpose((st.polext.(1))[i,*]+(st.polext.(2))[i,*])
                            vecte = transpose(((st.ext.(1))[i,*]+(st.ext.(2))[i,*]))
                            testneq = where(vecto ne 0,countneq)
f2caf3f1   Ilyes Choubani   Debugging some er...
1372
1373
1374
1375
                            
                            ;testing whether the polext values contain negative ones
                            testpos = where(vecto LT 0, countpos)
                            IF countpos NE 0 THEN vecto[testpos] = 0
4b745987   Ilyes Choubani   minor update
1376
                              
67bd858a   Ilyes Choubani   Replication of th...
1377
                            if countneq ne 0 then begin
67bd858a   Ilyes Choubani   Replication of th...
1378
                                
f2caf3f1   Ilyes Choubani   Debugging some er...
1379
                                vecfin = vecto*0.0
67bd858a   Ilyes Choubani   Replication of th...
1380
                                
07372e26   Ilyes Choubani   Corrected huge pl...
1381
                                vecfin[testneq] = (vecto[testneq])/vecte[testneq];extra_spec[testneq];(st.sed.em_tot)[testneq];spec[testneq] ;removed multiplication by 'fact'. 
67bd858a   Ilyes Choubani   Replication of th...
1382
                                
f2caf3f1   Ilyes Choubani   Debugging some er...
1383
1384
                                polar_ippsi2iqu,vecte*(*!dustem_HCD)/1.0e21,specqgrain,specugrain,vecfin,replicate(!dustem_psi_ext,n_elements(vecfin)) ;temporary solution
                                 
afde94a3   Ilyes Choubani   general update
1385
                                cgoplot,1/st.polext.wav,0.5*atan(specugrain,specqgrain)/degtorad,pos=position,noerase=1,color=use_cols[i],xr=xr,/xlog,ytickformat='(A1)',yr=[-90.00,90.00]
67bd858a   Ilyes Choubani   Replication of th...
1386
1387
                            endif 
                        ENDFOR
f2caf3f1   Ilyes Choubani   Debugging some er...
1388
                                                                              
67bd858a   Ilyes Choubani   Replication of th...
1389
1390
1391
1392
1393
1394
                        ;Plotting of the plugins.
                        for i=0L,n_plgns-1 do begin
                            
                            if isa((*!dustem_plugin).(0).spec) then begin
                                IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLEXT') THEN begin
                                    ;dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i))[*,1],ppositions=position, /overplot, noerase=1, color=clrs_plgns[i], linestyle=2,xr=xr,/xlog
afde94a3   Ilyes Choubani   general update
1395
                                    cgoplot_mlog,1/st.polext.wav,0.5*atan((*(*!dustem_plugin).(i).spec)[*,2],(*(*!dustem_plugin).(i).spec)[*,1])/degtorad,pos=position,noerase=1, color=clrs_plgns[i], linestyle=2 ,xr=xr,/xlog,ytickformat='(A1)',yr=[-90.00,90.00]   
67bd858a   Ilyes Choubani   Replication of th...
1396
1397
1398
1399
1400
1401
1402
1403
                                ENDIF
                            ENDIF
                        endfor
                        
                         ;PLotting of the interpolates corresponding to spectrum and filter points
                        
                         IF ct_spec NE 0 THEN BEGIN
                         
0068116a   Ilyes Choubani   General update + ...
1404
                             xx=((*(*!dustem_data).psi_ext).wav)[idx_spec]
67bd858a   Ilyes Choubani   Replication of th...
1405
                             yy=dustem_interp[idx_spec]
1bc09467   Ilyes Choubani   fixed issue with ...
1406
                             cgoplot,1/xx,yy,color='Indian Red',pos=position,psym=7,syms=2,noerase=1   
67bd858a   Ilyes Choubani   Replication of th...
1407
1408
1409
1410
                         ENDIF
                         
                         
                         IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1411
                             xx=((*(*!dustem_data).psi_ext).wav)[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
1412
                             yy=dustem_interp[idx_filt]
1bc09467   Ilyes Choubani   fixed issue with ...
1413
                             cgoplot,1/xx,yy,color='red',pos=position,psym=6,syms=2,noerase=1
67bd858a   Ilyes Choubani   Replication of th...
1414
1415
                         ENDIF
                         
67bd858a   Ilyes Choubani   Replication of th...
1416
1417
                         ;Plotting of the total dust emission spectrum
                         ;cgoplot,st.sed.wav,0.5*atan(specu,specq)/degtorad,pos=position,noerase=1,/xlog,/ys,/xs
1bc09467   Ilyes Choubani   fixed issue with ...
1418
                         cgoplot,1/st.ext.wav,dustem_spec,pos=position,noerase=1,/xlog,/ys,/xs               
67bd858a   Ilyes Choubani   Replication of th...
1419
1420
1421
                                
                    endif else begin ;The data points in the plot that remain unchanged.
                        
67bd858a   Ilyes Choubani   Replication of th...
1422
1423
1424
1425
                        ;Spectrum points are treated before for plotting reasons. 
                        if ct_spec ne 0 then begin 
                            
                            ;Plotting of spectrum data points (to be fitted)
0068116a   Ilyes Choubani   General update + ...
1426
                            cgplot,1/((*(*!dustem_data).psi_ext).wav)(idx_spec),((*(*!dustem_data).psi_ext).values)(idx_spec),/xlog,/ys,xs=1,pos=position,noerase=1,xtit=' ',charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,yr=[-90.00,90.00],psym=16,syms=0.8;,ytickformat='dstmwrp_exp'                
67bd858a   Ilyes Choubani   Replication of th...
1427
1428
                            
                            ;Plotting of the spectrum error points
0068116a   Ilyes Choubani   General update + ...
1429
1430
                            rms=3.*((*(*!dustem_data).psi_ext).sigma)(idx_spec)/2.
                            cgerrplot,1/((*(*!dustem_data).psi_ext).wav)(idx_spec),((*(*!dustem_data).psi_ext).values)(idx_spec)-rms,((*(*!dustem_data).psi_ext).values)(idx_spec)+rms,color='Powder Blue'
67bd858a   Ilyes Choubani   Replication of th...
1431
1432
1433
1434
1435
1436

                        endif
                        
                        if ct_filt ne 0 then begin
                        
                            ;Plotting of filter data points (to be fitted) + testing for prior plotting                         
0068116a   Ilyes Choubani   General update + ...
1437
1438
                            if ct_spec ne 0 then cgoplot,1/((*(*!dustem_data).psi_ext).wav)(idx_filt),((*(*!dustem_data).psi_ext).values)(idx_filt),charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,pos=position,/ys,xs=1,noerase=1,xtickformat='(A1)',xr=xr,yr=[-90.00,90.00],/xlog else $;,ytickformat='dstmwrp_exp'
                                cgplot,1/((*(*!dustem_data).psi_ext).wav)(idx_filt),((*(*!dustem_data).psi_ext).values)(idx_filt),charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,pos=position,/ys,xs=1,noerase=1,xtickformat='(A1)',xtit=' ',xr=xr,yr=[-90.00,90.00],/xlog;,ytickformat='dstmwrp_exp'
67bd858a   Ilyes Choubani   Replication of th...
1439
1440
1441
                            
                            
                            ;Plotting of the filter error points
0068116a   Ilyes Choubani   General update + ...
1442
1443
                            rms=3.*((*(*!dustem_data).psi_ext).sigma)(idx_filt)/2.;/dustem_psi_em(idx_filt)
                            cgerrplot,1/((*(*!dustem_data).psi_ext).wav)(idx_filt),((*(*!dustem_data).psi_ext).values)(idx_filt)-rms,((*(*!dustem_data).psi_ext).values)(idx_filt)+rms,color='Dodger Blue'
67bd858a   Ilyes Choubani   Replication of th...
1444
1445
1446
1447
1448
                            
                        endif
                        
                        
                        
f2caf3f1   Ilyes Choubani   Debugging some er...
1449
                        xyouts,pospltxt[0],pospltxt[1],textoidl('\Psi_{EXT} (deg)'),color=0,/normal,charsize=1.3;,charthick=2.0
67bd858a   Ilyes Choubani   Replication of th...
1450
1451
1452
1453
                         
                        ;Locating all the hidden data points (spectrum+filter)
                        
                        ;The filtering has been done prior (in the primary routine)
0068116a   Ilyes Choubani   General update + ...
1454
                        match2,((*(*!dustem_data).psi_ext).wav),((*(*!dustem_show).psi_ext).wav),show_psi_empts,fit_psi_empts ;only show_psi_empts is needed
74103816   Ilyes Choubani   small update
1455
                        idx_rmv_psi_em=where(fit_psi_empts eq -1, ct_hdnpts) ; indices of the points to hide
67bd858a   Ilyes Choubani   Replication of th...
1456
1457
                        ;stop
                        ;Locating the hidden spectrum and filter data points                                        
0068116a   Ilyes Choubani   General update + ...
1458
1459
                        idx_filt_hdn = where(((*(*!dustem_show).psi_ext).filt_names)(idx_rmv_psi_em) NE 'SPECTRUM',ct_filt_hdn) ;keeping psi_em notation for counters...
                        idx_spec_hdn = where(((*(*!dustem_show).psi_ext).filt_names)(idx_rmv_psi_em) EQ 'SPECTRUM',ct_spec_hdn)
67bd858a   Ilyes Choubani   Replication of th...
1460
1461
1462
1463
1464
                        if ct_hdnpts ne 0 then begin ;Hidden data points are present 
                            ;stop
                            
                            if ct_spec_hdn ne 0 then begin
                                ;Plotting of hidden spectrum data points
0068116a   Ilyes Choubani   General update + ...
1465
                                cgplot,1/(((*(*!dustem_show).psi_ext).wav)[idx_rmv_psi_em])(idx_spec_hdn),(((*(*!dustem_show).psi_ext).values)[idx_rmv_psi_em])(idx_spec_hdn),pos=position,/xlog,/ys,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=[-90.00,90.00],psym=8,syms=0.8
67bd858a   Ilyes Choubani   Replication of th...
1466
1467
                                
                                ;Plotting of hidden spectrum error points
0068116a   Ilyes Choubani   General update + ...
1468
1469
                                rms=3.*(((*(*!dustem_show).psi_ext).sigma)[idx_rmv_psi_em])(idx_spec_hdn)/2.
                                cgerrplot,1/(((*(*!dustem_show).psi_ext).wav)[idx_rmv_psi_em])(idx_spec_hdn),(((*(*!dustem_show).psi_ext).values)[idx_rmv_psi_em])(idx_spec_hdn)-rms,(((*(*!dustem_show).psi_ext).values)[idx_rmv_psi_em])(idx_spec_hdn)+rms,color='Black'
67bd858a   Ilyes Choubani   Replication of th...
1470
1471
1472
1473
1474
1475
                            endif                                           
                            
                            if ct_filt_hdn ne 0 then begin
                                ;stop
                                plotsym,0, /fill
                                ;Plotting of hidden filter data points 
0068116a   Ilyes Choubani   General update + ...
1476
                                cgplot,1/(((*(*!dustem_show).psi_ext).wav)[idx_rmv_psi_em])(idx_filt_hdn),(((*(*!dustem_show).psi_ext).values)[idx_rmv_psi_em])(idx_filt_hdn),pos=position,/xlog,/ys,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',color='Black',xr=xr,yr=[-90.00,90.00],psym=8,syms=0.8                                           
67bd858a   Ilyes Choubani   Replication of th...
1477
1478
                                ;stop
                                ;Plotting of hidden filter error point
0068116a   Ilyes Choubani   General update + ...
1479
1480
                                rms=3.*(((*(*!dustem_show).psi_ext).sigma)[idx_rmv_psi_em])(idx_filt_hdn)/2.
                                cgerrplot,1/(((*(*!dustem_show).psi_ext).wav)[idx_rmv_psi_em])(idx_filt_hdn),(((*(*!dustem_show).psi_ext).values)[idx_rmv_psi_em])(idx_filt_hdn)-rms,(((*(*!dustem_show).psi_ext).values)[idx_rmv_psi_em])(idx_filt_hdn)+rms,color='Black'
67bd858a   Ilyes Choubani   Replication of th...
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
                                 
                            endif 
                                                           
                        endif 
                        
                    endelse 
                
            endelse 
        
        end
        
        'QSED': begin ; THE ONE I WILL BE WORKING ON
96a72c8b   Ilyes Choubani   seperating xrange...
1493
            
4b745987   Ilyes Choubani   minor update
1494
1495
1496
1497
1498
            IF ct_m NE 0 then begin
            
                xr=xr_m
                yr=yr_m
            ENDIF
67bd858a   Ilyes Choubani   Replication of th...
1499
            
1bc09467   Ilyes Choubani   fixed issue with ...
1500
1501
1502
1503
1504
            vectw=DINDGEN(1001)*(alog10(1E7) - alog10(1E5))/(1000 - 1L) + alog10(1E5)
            vectw=10^vectw[1:*]
            vectw=[wavs,vectw]
            vectx=vectw*0+1
            
0068116a   Ilyes Choubani   General update + ...
1505
1506
            varvar=where((*(*!dustem_data).qsed).values GT 0, testpstv)
            varvar=where((*(*!dustem_data).qsed).values LT 0, testngtv)
67bd858a   Ilyes Choubani   Replication of th...
1507
            
07372e26   Ilyes Choubani   Corrected huge pl...
1508
            
0068116a   Ilyes Choubani   General update + ...
1509
1510
            idx_filt=where((*(*!dustem_data).qsed).filt_names NE 'SPECTRUM', ct_filt)
            idx_spec=where((*(*!dustem_data).qsed).filt_names EQ 'SPECTRUM' , ct_spec)
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1511
           
67bd858a   Ilyes Choubani   Replication of th...
1512
            ;Locating all the hidden data points (spectrum+filter)
0068116a   Ilyes Choubani   General update + ...
1513
            match2,((*(*!dustem_data).qsed).wav),((*(*!dustem_show).qsed).wav),show_sedpts,fit_sedpts ;only show_sedpts is needed
74103816   Ilyes Choubani   small update
1514
            idx_rmv_sed=where(fit_sedpts eq -1, ct_hdnpts) ; indices of the points to hide
67bd858a   Ilyes Choubani   Replication of th...
1515
            
67bd858a   Ilyes Choubani   Replication of th...
1516
1517
1518
1519
1520
1521
1522
1523
1524
            
            ;#1) get the plotting keywords (pertaining to each data set) @here when the _extra structure is ready
            
            if keyword_set(nodata) then begin ;when the data is not present
            
                if keyword_set(norm) then begin ;normalized plot
                    
                    xtit=textoidl('\lambda (\mum)')
                    if !run_pol then xtit = ''
1bc09467   Ilyes Choubani   fixed issue with ...
1525
                    cgplot,vectw,vectx,/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
67bd858a   Ilyes Choubani   Replication of th...
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
                    xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1                        
                
                endif else begin ;normal plot
                    
                    cgplot,wavs,wavs,/nodata,/ylog,/xlog,/ys,xs=1,pos=position,noerase=1,charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,xtit='',yr=yr,psym=8,syms=0.8  
                    ;cgaxis, xaxis=1 ,xlog=1 ,xrange=((!const.c*1E6/xr)*1E-9),charsize=1.15,title=textoidl('\nu (GHz)'),xticklen=0.05,xminor=10
                    xyouts,pospltxt[0],pospltxt[1],textoidl('Q_{\nu} (MJy/sr)'),color=0,/normal,charsize=1.3;,charthick=2.0
                  
                endelse  
                
            
            endif else begin ;when the data is present 
                
                if keyword_set(norm) then begin 
                    
                    if keyword_set(refresh) then begin ;The data points in the plot that are being refreshed 
                        
                        ;MAJOR LOOP OVER THE SING??? - YES BECAUSE YOU NEED TO KNOW WHICH ONE IS THE 
                
                        IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1546
                            xx=((*(*!dustem_data).qsed).wav)[idx_spec]
67bd858a   Ilyes Choubani   Replication of th...
1547
                            yy=dustem_interp[idx_spec]
0068116a   Ilyes Choubani   General update + ...
1548
                            rms=3.*((*(*!dustem_data).qsed).sigma)(idx_spec)/2.
f2caf3f1   Ilyes Choubani   Debugging some er...
1549
1550
                            indzero = where(yy NE 0, ct_zero)
                            IF ct_zero NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1551
1552
                                cgoplot,xx[indzero],(((*(*!dustem_data).qsed).values)(idx_spec))[indzero]/yy[indzero],pos=position,psym=16,color='Powder Blue',syms=0.8,noerase=1 
                                cgerrplot,(((*(*!dustem_data).qsed).wav)(idx_spec))[indzero],((((*(*!dustem_data).qsed).values)[idx_spec])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).qsed).values)[idx_spec])[indzero]+rms[indzero])/yy[indzero],color='Powder Blue'
f2caf3f1   Ilyes Choubani   Debugging some er...
1553
                            ENDIF 
67bd858a   Ilyes Choubani   Replication of th...
1554
1555
1556
1557
                        ENDIF
                        
                        IF ct_filt NE 0 THEN BEGIN
                            ;stop
0068116a   Ilyes Choubani   General update + ...
1558
                            xx=((*(*!dustem_data).qsed).wav)[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
1559
                            yy=dustem_interp[idx_filt]
0068116a   Ilyes Choubani   General update + ...
1560
                            rms=3.*((*(*!dustem_data).qsed).sigma)(idx_filt)/2.
f2caf3f1   Ilyes Choubani   Debugging some er...
1561
1562
                            indzero = where(yy NE 0, ct_zero)
                            IF ct_zero NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1563
1564
                                cgoplot,xx[indzero],(((*(*!dustem_data).qsed).values)(idx_filt))[indzero]/yy[indzero],pos=position,psym=16,color='Dodger Blue',syms=0.8,noerase=1 
                                cgerrplot,(((*(*!dustem_data).qsed).wav)(idx_filt))[indzero],((((*(*!dustem_data).qsed).values)[idx_filt])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).qsed).values)[idx_filt])[indzero]+rms[indzero])/yy[indzero],color='Dodger Blue' 
f2caf3f1   Ilyes Choubani   Debugging some er...
1565
                            ENDIF
67bd858a   Ilyes Choubani   Replication of th...
1566
1567
1568
1569
1570
                        ENDIF
      
                        
                    endif else begin ;The data points in the plot that remain unchanged
                        ;stop
afde94a3   Ilyes Choubani   general update
1571
                        ;stitching an array of 1000 more points (up to 1E7) after the end of the dustem wavelength array (dim=800 elements)
1bc09467   Ilyes Choubani   fixed issue with ...
1572
                        
67bd858a   Ilyes Choubani   Replication of th...
1573
1574
                        xtit=textoidl('\lambda (\mum)')
                        ;if !run_pol then xtit = ''
afde94a3   Ilyes Choubani   general update
1575
                        cgplot,vectw,vectx,/xlog,/ys,xs=1,pos=position,noerase=1,color='Black',xr=xr,xtit=xtit,yr=[0.0,2.0],yticks=2,ymino=2,xticklen=0.1,ytickformat='(F6.2)',charsize=1.0
67bd858a   Ilyes Choubani   Replication of th...
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
                        xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1
                    
                    endelse
                    
                
                endif else begin ; normal plot - STOPPED HERE FOR QSED
                              
                    if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
                        ;stop
                        if keyword_set(positive_only) then begin
     
                            if testpstv ne 0 then begin
                                ;stop
                                FOR i=0L,Ngrains-1 DO BEGIN
                                    
                                    testneq = where(st.polsed.(i+1) ne 0,countneq)
                                    ;stop
                                    if countneq ne 0 then begin 
                                        vecfin = st.polsed.(i+1)*0.0 ;em_tot can be used here right? 
                                        ;stop
07372e26   Ilyes Choubani   Corrected huge pl...
1596
                                        vecfin[testneq] = ((st.polsed.(i+1))[testneq])/((st.sed.(i+1))[testneq]);extra_spec[testneq];(st.sed.em_tot)[testneq];(st.sed.(i+1))[testneq];*fact;(st.sed.(i+1))[testneq]
67bd858a   Ilyes Choubani   Replication of th...
1597
                                        
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1598
1599
                                        polar_ippsi2iqu,st.sed.(i+1)*fact,specqgrain,specugrain,vecfin,replicate(!dustem_psi,n_elements(vecfin)) ;temporary solution
                                                                            
67bd858a   Ilyes Choubani   Replication of th...
1600
                                        dustem_plot_mlog,st.polsed.wav,specqgrain,ppositions=position,/positive_only,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1601
                                        
67bd858a   Ilyes Choubani   Replication of th...
1602
                                    endif
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1603
                                    
67bd858a   Ilyes Choubani   Replication of th...
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
                                ENDFOR
                                
                                for i=0L,n_plgns-1 do begin
                                    
                                    IF isa((*!dustem_plugin).(0).spec) THEN BEGIN
                                        IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN begin
                                         
                                            ;dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i))[*,1],ppositions=position, /overplot, noerase=1, color=clrs_plgns[i], linestyle=2,xr=xr,/xlog
                                            dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i).spec)[*,1],ppositions=position,/positive_only,/overplot,noerase=1, color=clrs_plgns[i], linestyle=2 ,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr      
                                        ENDIF
                                    ENDIF
                                endfor
                                
                                IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1618
                                    xx=((*(*!dustem_data).qsed).wav)[idx_spec]
67bd858a   Ilyes Choubani   Replication of th...
1619
                                    yy=dustem_interp[idx_spec]
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1620
                                    
67bd858a   Ilyes Choubani   Replication of th...
1621
1622
1623
1624
                                    dustem_plot_mlog,xx,yy,ppositions=position,/positive_only, /overplot, noerase=1, color='Indian Red',psym=7,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr 
                                ENDIF
                                
                                IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1625
                                    xx=((*(*!dustem_data).qsed).wav)[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
1626
                                    yy=dustem_interp[idx_filt]
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1627
                                    
67bd858a   Ilyes Choubani   Replication of th...
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
                                    dustem_plot_mlog,xx,yy,ppositions=position,/positive_only, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
                                ENDIF
                                
                                dustem_plot_mlog,st.polsed.wav,dustem_spec,ppositions=position,/positive_only,/overplot,noerase=1,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr                                    
                            
                            endif
                                    
                        
                        endif
                        
                        ;stop
                        if keyword_set(negative_only) then begin
                            ;stop     
                            if testngtv ne 0 then begin
                            
                                ;stop    
                                ;Plotting of the spectra of the dust species
                                FOR i=0L,Ngrains-1 DO BEGIN
0068116a   Ilyes Choubani   General update + ...
1646
                                    
67bd858a   Ilyes Choubani   Replication of th...
1647
1648
1649
1650
1651
                                    testneq = where(st.polsed.(i+1) ne 0,countneq)
                                    ;stop
                                    if countneq ne 0 then begin 
                                        vecfin = st.polsed.(i+1)*0.0 ;em_tot can be used here right? 
                                        ;stop
07372e26   Ilyes Choubani   Corrected huge pl...
1652
                                        vecfin[testneq] = ((st.polsed.(i+1))[testneq])/((st.sed.(i+1))[testneq]);extra_spec[testneq];(st.sed.em_tot)[testneq];(st.sed.(i+1))[testneq];*fact;(st.sed.(i+1))[testneq] 
67bd858a   Ilyes Choubani   Replication of th...
1653
1654
1655
1656
1657
                                        ;stop    
                                        polar_ippsi2iqu,st.sed.(i+1)*fact,specqgrain,specugrain,vecfin,replicate(!dustem_psi,n_elements(vecfin)) ;temporary solution
                                        ;stop
                                        ;dustem_plot_mlog,st.polsed.wav,specqgrain,ppositions=position,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog 
                                        dustem_plot_mlog,st.polsed.wav,specqgrain,ppositions=position,/negative_only,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
0068116a   Ilyes Choubani   General update + ...
1658
                                        
67bd858a   Ilyes Choubani   Replication of th...
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
                                    endif 
                                ENDFOR
                                ;Plotting of the plugins
                                for i=0L,n_plgns-1 do begin
                                    IF isa((*!dustem_plugin).(0).spec) THEN BEGIN
                                    
                                        IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN begin
     
                                            ;dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i))[*,1],ppositions=position, /overplot, noerase=1, color=clrs_plgns[i], linestyle=2,xr=xr,/xlog
                                            dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i).spec)[*,1],ppositions=position,/negative_only,/overplot,noerase=1, color=clrs_plgns[i], linestyle=2 ,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr      
                                        ENDIF
                                        
                                    ENDIF
                                endfor
                                ;PLotting of the interpolates corresponding to spectrum and filter points
                                IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1675
                                    xx=((*(*!dustem_data).qsed).wav)[idx_spec]
67bd858a   Ilyes Choubani   Replication of th...
1676
                                    yy=dustem_interp[idx_spec]
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1677
                                    
67bd858a   Ilyes Choubani   Replication of th...
1678
1679
1680
1681
                                    dustem_plot_mlog,xx,yy,ppositions=position,/negative_only, /overplot, noerase=1, color='Indian Red',psym=7,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr 
                                ENDIF
                                
                                IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1682
                                    xx=((*(*!dustem_data).qsed).wav)[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
1683
                                    yy=dustem_interp[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
                                    dustem_plot_mlog,xx,yy,ppositions=position,/negative_only, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
                                ENDIF
                                ;Plotting of the total dust emission spectrum
                                dustem_plot_mlog,st.polsed.wav,dustem_spec,ppositions=position,/negative_only,/overplot,noerase=1,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr                                    
                            
                            endif
                                    
                        
                        endif
                                                   
                      ;stop             
                    endif else begin ;The data points in the plot that remain unchanged.; DO NOT USE AN ELSE HERE. 
                        ;stop
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1697
                        
67bd858a   Ilyes Choubani   Replication of th...
1698
1699
1700
1701
                        xyouts,pospltxt[0],pospltxt[1],textoidl('Q_{\nu} (MJy/sr)'),color=0,/normal,charsize=1.3;,charthick=2.0  
                        ;if ct_hdnpts ne 0 then begin ;Hidden data points are present 
                            
                        ;Locating the hidden spectrum and filter data points     
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1702
                       
74103816   Ilyes Choubani   small update
1703
                        if ct_hdnpts NE 0 then begin
0068116a   Ilyes Choubani   General update + ...
1704
1705
1706
1707
                            idx_filt_hdn_pstv = where(((*(*!dustem_show).qsed).filt_names)(idx_rmv_sed) NE 'SPECTRUM' and ((*(*!dustem_show).qsed).values)(idx_rmv_sed) gt 0,ct_filt_hdn_pstv)
                            idx_spec_hdn_pstv = where(((*(*!dustem_show).qsed).filt_names)(idx_rmv_sed) EQ 'SPECTRUM' and ((*(*!dustem_show).qsed).values)(idx_rmv_sed) gt 0,ct_spec_hdn_pstv)
                            idx_filt_hdn_ngtv = where(((*(*!dustem_show).qsed).filt_names)(idx_rmv_sed) NE 'SPECTRUM' and ((*(*!dustem_show).qsed).values)(idx_rmv_sed) lt 0,ct_filt_hdn_ngtv)
                            idx_spec_hdn_ngtv = where(((*(*!dustem_show).qsed).filt_names)(idx_rmv_sed) EQ 'SPECTRUM' and ((*(*!dustem_show).qsed).values)(idx_rmv_sed) lt 0,ct_spec_hdn_ngtv)
67bd858a   Ilyes Choubani   Replication of th...
1708
1709
1710
1711
1712
1713
1714
                        endif
                        
                        
                        if keyword_set(positive_only) then begin
                            ;stop
                            if testpstv ne 0 then begin
                            ;stop
74103816   Ilyes Choubani   small update
1715
1716
1717
1718
1719
                                plotsym, 0
                                
                                
                                if ct_spec ne 0 then begin
                                
0068116a   Ilyes Choubani   General update + ...
1720
1721
1722
1723
                                    rms=3.*((*(*!dustem_data).qsed).sigma)(idx_spec)/2.
                                    ;dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),-((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,color='Dodger Blue',/positive_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,psym=16,syms=0.8,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)'     
74103816   Ilyes Choubani   small update
1724
1725
1726
1727
1728
                                 
                                endif
                                
                                if ct_filt ne 0 then begin
                                    
0068116a   Ilyes Choubani   General update + ...
1729
1730
1731
1732
1733
                                    rms=3.*((*(*!dustem_data).qsed).sigma)(idx_filt)/2.
                                   ; dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),-1.*((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    if ct_spec ne 0 then dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr,ytickformat='(A1)';,ytickformat='(A1)'
                                    if ct_spec eq 0 then dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,color='Dodger Blue',/positive_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,psym=16,syms=0.8,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)'
74103816   Ilyes Choubani   small update
1734
1735
                                        
                                endif
67bd858a   Ilyes Choubani   Replication of th...
1736
                                
74103816   Ilyes Choubani   small update
1737
1738
                                
                                if ct_hdnpts NE 0 then begin
67bd858a   Ilyes Choubani   Replication of th...
1739
1740
                                
                                    if ct_spec_hdn_pstv ne 0 then begin
0068116a   Ilyes Choubani   General update + ...
1741
1742
1743
                                        xx = (((*(*!dustem_show).qsed).wav)[idx_rmv_sed])(idx_spec_hdn_pstv)
                                        yy = (((*(*!dustem_show).qsed).values)[idx_rmv_sed])(idx_spec_hdn_pstv)
                                        rms=3.*(((*(*!dustem_show).qsed).sigma)[idx_rmv_sed])(idx_spec_hdn_pstv)/2.
67bd858a   Ilyes Choubani   Replication of th...
1744
                                        
74103816   Ilyes Choubani   small update
1745
1746
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',/overplot,xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)'  
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,noerase=1,color='Black',/overplot,rms=rms,yr=yr,xtickformat='(A1)',xr=xr,xs=1,/xlog,/ylog,ytickformat='(A1)'  ;,psym=8,syms=0.8
67bd858a   Ilyes Choubani   Replication of th...
1747
1748
1749
1750
1751
                                    
                                    endif 
                                    
                                    if ct_filt_hdn_pstv ne 0 then begin
                                    
0068116a   Ilyes Choubani   General update + ...
1752
1753
1754
                                        xx = (((*(*!dustem_show).qsed).wav)[idx_rmv_sed])(idx_filt_hdn_pstv)
                                        yy = (((*(*!dustem_show).qsed).values)[idx_rmv_sed])(idx_filt_hdn_pstv)
                                        rms=3.*(((*(*!dustem_show).qsed).sigma)[idx_rmv_sed])(idx_filt_hdn_pstv)/2.
67bd858a   Ilyes Choubani   Replication of th...
1755
                                        
74103816   Ilyes Choubani   small update
1756
1757
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)'     
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,color='Black',/overplot,rms=rms,xr=xr,yr=yr,xtickformat='(A1)',/xlog,/ylog,ytickformat='(A1)'  ;,psym=8,syms=0.8
67bd858a   Ilyes Choubani   Replication of th...
1758
1759
1760
1761
1762
1763
                                    
                                    endif
                                    
                                endif
                                
                                
74103816   Ilyes Choubani   small update
1764
                            endif else begin
67bd858a   Ilyes Choubani   Replication of th...
1765
                                
67bd858a   Ilyes Choubani   Replication of th...
1766
                                
1bc09467   Ilyes Choubani   fixed issue with ...
1767
                            
0068116a   Ilyes Choubani   General update + ...
1768
                                if ct_spec ne 0 then dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),-((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,charsize=1.15,/nodata,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
1bc09467   Ilyes Choubani   fixed issue with ...
1769
                                    
67bd858a   Ilyes Choubani   Replication of th...
1770
                                
0068116a   Ilyes Choubani   General update + ...
1771
                                if ct_filt ne 0 and ct_spec eq 0 then  dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),-((*(*!dustem_data).qsed).values)(idx_filt),/nodata,ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
f2caf3f1   Ilyes Choubani   Debugging some er...
1772
                                   
74103816   Ilyes Choubani   small update
1773
1774
1775
1776
                                
                                if ct_hdnpts NE 0 then begin
                                
                                    if ct_spec_hdn_pstv ne 0 then begin
0068116a   Ilyes Choubani   General update + ...
1777
1778
1779
                                        xx = (((*(*!dustem_show).qsed).wav)[idx_rmv_sed])(idx_spec_hdn_pstv)
                                        yy = (((*(*!dustem_show).qsed).values)[idx_rmv_sed])(idx_spec_hdn_pstv)
                                        rms=3.*(((*(*!dustem_show).qsed).sigma)[idx_rmv_sed])(idx_spec_hdn_pstv)/2.
74103816   Ilyes Choubani   small update
1780
1781
1782
1783
1784
1785
1786
1787
                                        
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',/overplot,xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)'  
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,noerase=1,color='Black',/overplot,rms=rms,yr=yr,xtickformat='(A1)',xr=xr,xs=1,/xlog,/ylog,ytickformat='(A1)'  ;,psym=8,syms=0.8
                                    
                                    endif 
                                    
                                    if ct_filt_hdn_pstv ne 0 then begin
                                    
0068116a   Ilyes Choubani   General update + ...
1788
1789
1790
                                        xx = (((*(*!dustem_show).qsed).wav)[idx_rmv_sed])(idx_filt_hdn_pstv)
                                        yy = (((*(*!dustem_show).qsed).values)[idx_rmv_sed])(idx_filt_hdn_pstv)
                                        rms=3.*(((*(*!dustem_show).qsed).sigma)[idx_rmv_sed])(idx_filt_hdn_pstv)/2.
74103816   Ilyes Choubani   small update
1791
1792
1793
1794
1795
1796
1797
1798
                                        
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)'     
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,color='Black',/overplot,rms=rms,xr=xr,yr=yr,xtickformat='(A1)',/xlog,/ylog,ytickformat='(A1)'  ;,psym=8,syms=0.8
                                    
                                    endif
                                    
                                endif
                                
67bd858a   Ilyes Choubani   Replication of th...
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
                            endelse                           
                        
                        endif 
                        
                        
                        if keyword_set(negative_only) then begin
                            
                            if testngtv ne 0 then begin
                                 
                                 ;plotsym, 0
67bd858a   Ilyes Choubani   Replication of th...
1809
                                
67bd858a   Ilyes Choubani   Replication of th...
1810
1811
                                 if ct_spec ne 0 then begin
                                 
0068116a   Ilyes Choubani   General update + ...
1812
1813
1814
1815
                                     rms=3.*((*(*!dustem_data).qsed).sigma)(idx_spec)/2.
                                     ;dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),-((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    ; if ct_spec_hdn_ngtv ne 0 then dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,/overplot,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr else begin
                                         dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
67bd858a   Ilyes Choubani   Replication of th...
1816
                                     ;endelse;,ytickformat='(A1)'
0068116a   Ilyes Choubani   General update + ...
1817
                                     dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,color='Dodger Blue',/negative_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)';,psym=16,syms=0.8     
67bd858a   Ilyes Choubani   Replication of th...
1818
1819
1820
1821
1822
                                  
                                 endif
                                 
                                 if ct_filt ne 0 then begin
                                     
0068116a   Ilyes Choubani   General update + ...
1823
1824
1825
1826
1827
                                     rms=3.*((*(*!dustem_data).qsed).sigma)(idx_filt)/2.
                                    ; dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),-1.*((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                     ;if ct_filt_hdn_ngtv ne 0 then  dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',/overplot,psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr else begin
                                     if ct_spec ne 0 then dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                     if ct_spec eq 0 then dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr
67bd858a   Ilyes Choubani   Replication of th...
1828
1829
                                     ;endelse ;,ytickformat='(A1)'
                                     
0068116a   Ilyes Choubani   General update + ...
1830
                                     dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,color='Dodger Blue',/negative_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)'
67bd858a   Ilyes Choubani   Replication of th...
1831
1832
                                         
                                 endif 
74103816   Ilyes Choubani   small update
1833
1834
1835
1836
                                 
                                 if ct_hdnpts NE 0 then begin
                                 
                                     if ct_spec_hdn_ngtv ne 0 then begin
0068116a   Ilyes Choubani   General update + ...
1837
1838
1839
                                         xx = (((*(*!dustem_show).qsed).wav)[idx_rmv_sed])(idx_spec_hdn_ngtv)
                                         yy = (((*(*!dustem_show).qsed).values)[idx_rmv_sed])(idx_spec_hdn_ngtv)
                                         rms=3.*(((*(*!dustem_show).qsed).sigma)[idx_rmv_sed])(idx_spec_hdn_ngtv)/2.
74103816   Ilyes Choubani   small update
1840
1841
1842
1843
1844
1845
1846
1847
                                         
                                         dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                         dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,noerase=1,color='Black',/overplot,rms=rms,yr=yr,xtickformat='(A1)',xr=xr,xs=1,/xlog,/ylog,ytickformat='(A1)';,psym=8,syms=0.8
                                     
                                     endif 
                                     
                                     if ct_filt_hdn_ngtv ne 0 then begin
                                     
0068116a   Ilyes Choubani   General update + ...
1848
1849
1850
                                         xx = (((*(*!dustem_show).qsed).wav)[idx_rmv_sed])(idx_filt_hdn_ngtv)
                                         yy = (((*(*!dustem_show).qsed).values)[idx_rmv_sed])(idx_filt_hdn_ngtv)
                                         rms=3.*(((*(*!dustem_show).qsed).sigma)[idx_rmv_sed])(idx_filt_hdn_ngtv)/2.
74103816   Ilyes Choubani   small update
1851
1852
1853
1854
1855
1856
1857
1858
                                         
                                         dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr ,ytickformat='(A1)'  
                                         dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,color='Black',/overplot,rms=rms,xr=xr,yr=yr,xtickformat='(A1)',/xlog,/ylog,ytickformat='(A1)';,psym=8,syms=0.8
                                     
                                     endif
                                
                                 endif

67bd858a   Ilyes Choubani   Replication of th...
1859
1860
                            
                            endif else begin
74103816   Ilyes Choubani   small update
1861
1862
                                
                                
0068116a   Ilyes Choubani   General update + ...
1863
                                if ct_spec ne 0 then dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),-((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,charsize=1.15,/nodata,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
1bc09467   Ilyes Choubani   fixed issue with ...
1864
                                    
e0d00de0   Ilyes Choubani   removing stops
1865
                                
0068116a   Ilyes Choubani   General update + ...
1866
                                if ct_filt ne 0 and ct_spec eq 0 then  dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),-((*(*!dustem_data).qsed).values)(idx_filt),/nodata,ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
74103816   Ilyes Choubani   small update
1867
1868
1869
1870
                                
                                if ct_hdnpts NE 0 then begin
                                
                                    if ct_spec_hdn_ngtv ne 0 then begin
0068116a   Ilyes Choubani   General update + ...
1871
1872
1873
                                        xx = (((*(*!dustem_show).qsed).wav)[idx_rmv_sed])(idx_spec_hdn_ngtv)
                                        yy = (((*(*!dustem_show).qsed).values)[idx_rmv_sed])(idx_spec_hdn_ngtv)
                                        rms=3.*(((*(*!dustem_show).qsed).sigma)[idx_rmv_sed])(idx_spec_hdn_ngtv)/2.
74103816   Ilyes Choubani   small update
1874
1875
1876
1877
1878
1879
1880
1881
                                        
                                        dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                        dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,noerase=1,color='Black',/overplot,rms=rms,yr=yr,xtickformat='(A1)',xr=xr,xs=1,/xlog,/ylog,ytickformat='(A1)';,psym=8,syms=0.8
                                    
                                    endif 
                                    
                                    if ct_filt_hdn_ngtv ne 0 then begin
                                    
0068116a   Ilyes Choubani   General update + ...
1882
1883
1884
                                        xx = (((*(*!dustem_show).qsed).wav)[idx_rmv_sed])(idx_filt_hdn_ngtv)
                                        yy = (((*(*!dustem_show).qsed).values)[idx_rmv_sed])(idx_filt_hdn_ngtv)
                                        rms=3.*(((*(*!dustem_show).qsed).sigma)[idx_rmv_sed])(idx_filt_hdn_ngtv)/2.
74103816   Ilyes Choubani   small update
1885
1886
1887
1888
1889
1890
1891
                                        
                                        dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr ,ytickformat='(A1)'  
                                        dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,color='Black',/overplot,rms=rms,xr=xr,yr=yr,xtickformat='(A1)',/xlog,/ylog,ytickformat='(A1)';,psym=8,syms=0.8
                                    
                                    endif
                                    
                                    endif
f2caf3f1   Ilyes Choubani   Debugging some er...
1892
                                  
67bd858a   Ilyes Choubani   Replication of th...
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
                            endelse
                            ;stop
                        endif
                        
                    
                    endelse 
                
                
                
                endelse 
            
            endelse ;

        
        END
        
        'USED': begin
96a72c8b   Ilyes Choubani   seperating xrange...
1910
            
4b745987   Ilyes Choubani   minor update
1911
1912
1913
1914
1915
1916
            IF ct_m NE 0 then begin
            
                xr=xr_m
                yr=yr_m
                
            ENDIF
96a72c8b   Ilyes Choubani   seperating xrange...
1917
            
1bc09467   Ilyes Choubani   fixed issue with ...
1918
1919
1920
1921
1922
            vectw=DINDGEN(1001)*(alog10(1E7) - alog10(1E5))/(1000 - 1L) + alog10(1E5)
            vectw=10^vectw[1:*]
            vectw=[wavs,vectw]
            vectx=vectw*0+1
        
67bd858a   Ilyes Choubani   Replication of th...
1923
1924
            ;SIGN-RELATED PARAMETERS/LOOPS HERE?
            ;negative & positive values regardless of data type (SPECTRUM or FILTER data points)
0068116a   Ilyes Choubani   General update + ...
1925
1926
            varvar=where((*(*!dustem_data).used).values LT 0, testngtv)
            varvar=where((*(*!dustem_data).used).values GT 0, testpstv)
67bd858a   Ilyes Choubani   Replication of th...
1927
            ;stop
0068116a   Ilyes Choubani   General update + ...
1928
1929
            idx_filt=where((*(*!dustem_data).used).filt_names NE 'SPECTRUM', ct_filt)
            idx_spec=where((*(*!dustem_data).used).filt_names EQ 'SPECTRUM' , ct_spec)
67bd858a   Ilyes Choubani   Replication of th...
1930
            
67bd858a   Ilyes Choubani   Replication of th...
1931
            ;Locating all the hidden data points (spectrum+filter)
0068116a   Ilyes Choubani   General update + ...
1932
            match2,((*(*!dustem_data).used).wav),((*(*!dustem_show).used).wav),show_sedpts,fit_sedpts ;only show_sedpts is needed
74103816   Ilyes Choubani   small update
1933
            idx_rmv_sed=where(fit_sedpts eq -1, ct_hdnpts) ; indices of the points to hide
67bd858a   Ilyes Choubani   Replication of th...
1934
            
67bd858a   Ilyes Choubani   Replication of th...
1935
1936
1937
1938
1939
1940
1941
1942
            ;#1) get the plotting keywords (pertaining to each data set) @here when the _extra structure is ready
            
            if keyword_set(nodata) then begin ;when the data is not present
            
                if keyword_set(norm) then begin ;normalized plot
                    
                    xtit=textoidl('\lambda (\mum)')
                    if !run_pol then xtit = ''
1bc09467   Ilyes Choubani   fixed issue with ...
1943
                    cgplot,vectw,vectx,/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
67bd858a   Ilyes Choubani   Replication of th...
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
                    xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1                        
                
                endif else begin ;normal plot
                    
                    cgplot,wavs,wavs,/nodata,/ylog,/xlog,/ys,xs=1,pos=position,noerase=1,charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,xtit='',yr=yr,psym=8,syms=0.8  
                    ;cgaxis, xaxis=1 ,xlog=1 ,xrange=((!const.c*1E6/xr)*1E-9),charsize=1.15,title=textoidl('\nu (GHz)'),xticklen=0.05,xminor=10
                    xyouts,pospltxt[0],pospltxt[1],textoidl('U_{\nu} (MJy/sr)'),color=0,/normal,charsize=1.3;,charthick=2.0
                  
                endelse  
                
            
            endif else begin ;when the data is present 
                
                if keyword_set(norm) then begin 
                    
                    if keyword_set(refresh) then begin ;The data points in the plot that are being refreshed 
                        
                        ;MAJOR LOOP OVER THE SING??? - YES BECAUSE YOU NEED TO KNOW WHICH ONE IS THE 
                
                        IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1964
                            xx=((*(*!dustem_data).used).wav)[idx_spec]
67bd858a   Ilyes Choubani   Replication of th...
1965
                            yy=dustem_interp[idx_spec]
0068116a   Ilyes Choubani   General update + ...
1966
                            rms=3.*((*(*!dustem_data).used).sigma)(idx_spec)/2.
f2caf3f1   Ilyes Choubani   Debugging some er...
1967
1968
                            indzero = where(yy NE 0, ct_zero)
                            IF ct_zero NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1969
1970
                                cgoplot,xx[indzero],(((*(*!dustem_data).used).values)(idx_spec))[indzero]/yy[indzero],pos=position,psym=16,color='Powder Blue',syms=0.8,noerase=1 
                                cgerrplot,(((*(*!dustem_data).used).wav)(idx_spec))[indzero],((((*(*!dustem_data).used).values)[idx_spec])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).used).values)[idx_spec])[indzero]+rms[indzero])/yy[indzero],color='Powder Blue'
f2caf3f1   Ilyes Choubani   Debugging some er...
1971
                            ENDIF
67bd858a   Ilyes Choubani   Replication of th...
1972
1973
1974
                        ENDIF
                        
                        IF ct_filt NE 0 THEN BEGIN
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
1975
                            
0068116a   Ilyes Choubani   General update + ...
1976
                            xx=((*(*!dustem_data).used).wav)[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
1977
                            yy=dustem_interp[idx_filt]
0068116a   Ilyes Choubani   General update + ...
1978
                            rms=3.*((*(*!dustem_data).used).sigma)(idx_filt)/2. 
f2caf3f1   Ilyes Choubani   Debugging some er...
1979
1980
                            indzero = where(yy NE 0, ct_zero)
                            IF ct_zero NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
1981
1982
                                cgoplot,xx[indzero],(((*(*!dustem_data).used).values)(idx_filt))[indzero]/yy[indzero],pos=position,psym=16,color='Dodger Blue',syms=0.8,noerase=1 
                                cgerrplot,(((*(*!dustem_data).used).wav)(idx_filt))[indzero],((((*(*!dustem_data).used).values)[idx_filt])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).used).values)[idx_filt])[indzero]+rms[indzero])/yy[indzero],color='Dodger Blue' 
f2caf3f1   Ilyes Choubani   Debugging some er...
1983
                            ENDIF
67bd858a   Ilyes Choubani   Replication of th...
1984
1985
1986
1987
                        ENDIF
      
                        
                    endif else begin ;The data points in the plot that remain unchanged
1bc09467   Ilyes Choubani   fixed issue with ...
1988
                        
67bd858a   Ilyes Choubani   Replication of th...
1989
1990
                        xtit=textoidl('\lambda (\mum)')
                        ;if !run_pol then xtit = ''
afde94a3   Ilyes Choubani   general update
1991
                        cgplot,vectw,vectx,/xlog,/ys,xs=1,pos=position,noerase=1,color='Black',xr=xr,xtit=xtit,yr=[0.0,2.0],yticks=2,ymino=2,xticklen=0.1,ytickformat='(F6.2)',charsize=1.0
67bd858a   Ilyes Choubani   Replication of th...
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
                        xyouts,pospltxt-[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1
                    
                    endelse
                    
                
                endif else begin ; normal plot - STOPPED HERE FOR used
                              
                    if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
                        
                        if keyword_set(positive_only) then begin
     
                            if testpstv ne 0 then begin
                                ;stop
                                FOR i=0L,Ngrains-1 DO BEGIN
                                    
                                    testneq = where(st.polsed.(i+1) ne 0,countneq)
                                    
                                    if countneq ne 0 then begin 
                                        vecfin = st.polsed.(i+1)*0.0 ;em_tot can be used here right? 
                                        
07372e26   Ilyes Choubani   Corrected huge pl...
2012
                                        vecfin[testneq] = ((st.polsed.(i+1))[testneq])/((st.sed.(i+1))[testneq]);extra_spec[testneq];(st.sed.em_tot)[testneq];(st.sed.(i+1))[testneq];*fact;(st.sed.(i+1))[testneq]
67bd858a   Ilyes Choubani   Replication of th...
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
                                            
                                        polar_ippsi2iqu,st.sed.(i+1)*fact,specqgrain,specugrain,vecfin,replicate(!dustem_psi,n_elements(vecfin)) ;temporary solution
                                        ;dustem_plot_mlog,st.polsed.wav,specqgrain,ppositions=position,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog 
                                        dustem_plot_mlog,st.polsed.wav,specugrain,ppositions=position,/positive_only,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
                                    endif 
                                    ;stop
                                ENDFOR
                                ;stop
                                for i=0L,n_plgns-1 do begin
                                    
                                    IF isa((*!dustem_plugin).(0).spec) THEN BEGIN
                                    
                                        IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN begin
                                            
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
2027
                                            
67bd858a   Ilyes Choubani   Replication of th...
2028
2029
2030
2031
2032
2033
2034
2035
                                            dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i).spec)[*,2],ppositions=position,/positive_only,/overplot,noerase=1, color=clrs_plgns[i], linestyle=2 ,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr      
                                        ENDIF
                                        
                                    ENDIF
                                    
                                endfor
                                
                                IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2036
                                    xx=((*(*!dustem_data).used).wav)[idx_spec]
67bd858a   Ilyes Choubani   Replication of th...
2037
2038
2039
2040
2041
2042
                                    yy=dustem_interp[idx_spec]
                                    ;dustem_plot_mlog,xx,yy,ppositions=position,/overplot, noerase=1, color='red',psym=7,syms=2,xr=xr,/xlog
                                    dustem_plot_mlog,xx,yy,ppositions=position,/positive_only, /overplot, noerase=1, color='Indian Red',psym=7,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr 
                                ENDIF
                                
                                IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2043
                                    xx=((*(*!dustem_data).used).wav)[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
                                    yy=dustem_interp[idx_filt]
                                    ;dustem_plot_mlog,xx,yy,ppositions=position, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog
                                    dustem_plot_mlog,xx,yy,ppositions=position,/positive_only, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
                                ENDIF
                                
                                dustem_plot_mlog,st.polsed.wav,dustem_spec,ppositions=position,/positive_only,/overplot,noerase=1,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr                                    
                            
                            endif
                                    
                        
                        endif
                        
                        
                        if keyword_set(negative_only) then begin
     
                            if testngtv ne 0 then begin
                            
                                ;Plotting of the spectra of the dust species
                                FOR i=0L,Ngrains-1 DO BEGIN
                                    testneq = where(st.polsed.(i+1) ne 0,countneq)
                                    if countneq ne 0 then begin
                                        vecfin = st.polsed.(i+1)*0.0 ;em_tot can be used here right? 
                                        
07372e26   Ilyes Choubani   Corrected huge pl...
2067
                                        vecfin[testneq] = ((st.polsed.(i+1))[testneq])/((st.sed.(i+1))[testneq]);extra_spec[testneq];(st.sed.em_tot)[testneq];(st.sed.(i+1))[testneq];*fact;(st.sed.(i+1))[testneq]
67bd858a   Ilyes Choubani   Replication of th...
2068
2069
                                        
                                        polar_ippsi2iqu,st.sed.(i+1)*fact,specqgrain,specugrain,vecfin,replicate(!dustem_psi,n_elements(vecfin)) ;temporary solution
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
2070
                                         
67bd858a   Ilyes Choubani   Replication of th...
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
                                        dustem_plot_mlog,st.polsed.wav,specugrain,ppositions=position,/negative_only,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
                                    endif    
                                ENDFOR
                                ;Plotting of the plugins
                                FOR i=0L,n_plgns-1 do begin
                                    IF isa((*!dustem_plugin).(0).spec) THEN BEGIN
                                    
                                        IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLSED') THEN begin
                                            ;dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i))[*,1],ppositions=position, /overplot, noerase=1, color=clrs_plgns[i], linestyle=2,xr=xr,/xlog
                                            dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i).spec)[*,2],ppositions=position,/negative_only,/overplot,noerase=1, color=clrs_plgns[i], linestyle=2 ,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr      
                                        ENDIF
                                    ENDIF
                                ENDFOR
                                ;PLotting of the interpolates corresponding to spectrum and filter points
                                IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2086
                                    xx=((*(*!dustem_data).used).wav)[idx_spec]
67bd858a   Ilyes Choubani   Replication of th...
2087
2088
2089
2090
2091
2092
                                    yy=dustem_interp[idx_spec]
                                    ;dustem_plot_mlog,xx,yy,ppositions=position,/overplot, noerase=1, color='red',psym=7,syms=2,xr=xr,/xlog
                                    dustem_plot_mlog,xx,yy,ppositions=position,/negative_only, /overplot, noerase=1, color='Indian Red',psym=7,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr 
                                ENDIF
                                
                                IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2093
                                    xx=((*(*!dustem_data).used).wav)[idx_filt]
67bd858a   Ilyes Choubani   Replication of th...
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
                                    yy=dustem_interp[idx_filt]
                                    ;dustem_plot_mlog,xx,yy,ppositions=position, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog
                                    dustem_plot_mlog,xx,yy,ppositions=position,/negative_only, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
                                ENDIF
                                
                                ;Plotting of the total dust emission spectrum
                                dustem_plot_mlog,st.polsed.wav,dustem_spec,ppositions=position,/negative_only,/overplot,noerase=1,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr                                    
                            
                            endif
                                    
                        
                        endif
                                                   
                      ;stop             
                    endif else begin ;The data points in the plot that remain unchanged.
                        ;stop
                        ;cgaxis, xaxis=1,xlog=1, xs=1,charsize=1.5,xtickformat='(A1)'
                        xyouts,pospltxt[0],pospltxt[1],textoidl('U_{\nu} (MJy/sr)'),color=0,/normal,charsize=1.3;,charthick=2.0  
                        ;if ct_hdnpts ne 0 then begin ;Hidden data points are present 
                        
                        ;Locating the hidden spectrum and filter data points     
                        ;SADLY I STILL DON'T HAVE A SOLUTION FOR THE PLOTTING OF NULL VALUES.                                   
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
2116
2117
                        
                        
74103816   Ilyes Choubani   small update
2118
                        if ct_hdnpts NE 0 then begin
0068116a   Ilyes Choubani   General update + ...
2119
2120
2121
2122
                            idx_filt_hdn_pstv = where(((*(*!dustem_show).used).filt_names)(idx_rmv_sed) NE 'SPECTRUM' and ((*(*!dustem_show).used).values)(idx_rmv_sed) gt 0,ct_filt_hdn_pstv)
                            idx_spec_hdn_pstv = where(((*(*!dustem_show).used).filt_names)(idx_rmv_sed) EQ 'SPECTRUM' and ((*(*!dustem_show).used).values)(idx_rmv_sed) gt 0,ct_spec_hdn_pstv)
                            idx_filt_hdn_ngtv = where(((*(*!dustem_show).used).filt_names)(idx_rmv_sed) NE 'SPECTRUM' and ((*(*!dustem_show).used).values)(idx_rmv_sed) lt 0,ct_filt_hdn_ngtv)
                            idx_spec_hdn_ngtv = where(((*(*!dustem_show).used).filt_names)(idx_rmv_sed) EQ 'SPECTRUM' and ((*(*!dustem_show).used).values)(idx_rmv_sed) lt 0,ct_spec_hdn_ngtv)
67bd858a   Ilyes Choubani   Replication of th...
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
                        endif
                        ;stop
                        
                        if keyword_set(positive_only) then begin
                            ;stop
                            if testpstv ne 0 then begin
                            ;stop
                                plotsym, 0
                                
                                 
                                if ct_spec ne 0 then begin
                                
0068116a   Ilyes Choubani   General update + ...
2135
2136
2137
2138
                                    rms=3.*((*(*!dustem_data).used).sigma)(idx_spec)/2.
                                    ;dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_spec),-((*(*!dustem_data).used).values)(idx_spec),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    ;if ct_spec_hdn_pstv ne 0 then dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_spec),((*(*!dustem_data).used).values)(idx_spec),ppositions=position,charsize=1.15,/overplot,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr else begin
                                        dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_spec),((*(*!dustem_data).used).values)(idx_spec),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr
67bd858a   Ilyes Choubani   Replication of th...
2139
                                    ;endelse;,ytickformat='(A1)'
0068116a   Ilyes Choubani   General update + ...
2140
                                    dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_spec),((*(*!dustem_data).used).values)(idx_spec),ppositions=position,color='Dodger Blue',/positive_only,noerase=1,/overplot,rms=rms,xtit='',xtickformat='(A1)',xs=1,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)'  ;,charsize=1.15,psym=16,syms=0.8
67bd858a   Ilyes Choubani   Replication of th...
2141
2142
2143
2144
2145
                                 
                                endif
                                
                                if ct_filt ne 0 then begin
                                    
0068116a   Ilyes Choubani   General update + ...
2146
2147
2148
2149
2150
                                    rms=3.*((*(*!dustem_data).used).sigma)(idx_filt)/2.
                                   ; dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_filt),-1.*((*(*!dustem_data).used).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    ;if ct_filt_hdn_pstv ne 0 then dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_filt),((*(*!dustem_data).used).values)(idx_filt),/overplot,ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr else begin
                                    if ct_spec ne 0 then dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_filt),((*(*!dustem_data).used).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                    if ct_spec eq 0 then dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_filt),((*(*!dustem_data).used).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr
67bd858a   Ilyes Choubani   Replication of th...
2151
                                    ;endelse;,ytickformat='(A1)'
0068116a   Ilyes Choubani   General update + ...
2152
                                    dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_filt),((*(*!dustem_data).used).values)(idx_filt),ppositions=position,color='Dodger Blue',/positive_only,noerase=1,/overplot,rms=rms,xtit='',xtickformat='(A1)',xs=1,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)';,charsize=1.15,psym=16,syms=0.8
67bd858a   Ilyes Choubani   Replication of th...
2153
2154
2155
                                        
                                endif
                                
74103816   Ilyes Choubani   small update
2156
                                if ct_hdnpts NE 0 then begin
67bd858a   Ilyes Choubani   Replication of th...
2157
2158
2159
                                
                                    if ct_spec_hdn_pstv ne 0 then begin
                                        ;stop
0068116a   Ilyes Choubani   General update + ...
2160
2161
2162
                                        xx = (((*(*!dustem_show).used).wav)[idx_rmv_sed])(idx_spec_hdn_pstv)
                                        yy = (((*(*!dustem_show).used).values)[idx_rmv_sed])(idx_spec_hdn_pstv)
                                        rms=3.*(((*(*!dustem_show).used).sigma)[idx_rmv_sed])(idx_spec_hdn_pstv)/2.
67bd858a   Ilyes Choubani   Replication of th...
2163
                                        
74103816   Ilyes Choubani   small update
2164
2165
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',/overplot,xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,noerase=1,color='Black',/overplot,rms=rms,yr=yr,xtickformat='(A1)',xr=xr,xs=1,/xlog,/ylog,ytickformat='(A1)';,psym=8,syms=0.8
67bd858a   Ilyes Choubani   Replication of th...
2166
2167
2168
2169
2170
                                    
                                    endif 
                                    
                                    if ct_filt_hdn_pstv ne 0 then begin
                                        ;stop
0068116a   Ilyes Choubani   General update + ...
2171
2172
2173
                                        xx = (((*(*!dustem_show).used).wav)[idx_rmv_sed])(idx_filt_hdn_pstv)
                                        yy = (((*(*!dustem_show).used).values)[idx_rmv_sed])(idx_filt_hdn_pstv)
                                        rms=3.*(((*(*!dustem_show).used).sigma)[idx_rmv_sed])(idx_filt_hdn_pstv)/2.
67bd858a   Ilyes Choubani   Replication of th...
2174
                                        
74103816   Ilyes Choubani   small update
2175
2176
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)' 
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,color='Black',/overplot,rms=rms,xr=xr,yr=yr,xtickformat='(A1)',/xlog,/ylog,ytickformat='(A1)';,psym=8,syms=0.8
67bd858a   Ilyes Choubani   Replication of th...
2177
2178
2179
2180
                                    
                                    endif
                                endif   
                            endif else begin
74103816   Ilyes Choubani   small update
2181
                                
0068116a   Ilyes Choubani   General update + ...
2182
                                if ct_spec ne 0 then dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_spec),-((*(*!dustem_data).used).values)(idx_spec),ppositions=position,charsize=1.15,/nodata,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
1bc09467   Ilyes Choubani   fixed issue with ...
2183
2184
                                    
                                
0068116a   Ilyes Choubani   General update + ...
2185
                                if ct_filt ne 0 and ct_spec eq 0 then  dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_filt),-((*(*!dustem_data).used).values)(idx_filt),/nodata,ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
f2caf3f1   Ilyes Choubani   Debugging some er...
2186
                                
74103816   Ilyes Choubani   small update
2187
2188
2189
2190
                                if ct_hdnpts NE 0 then begin
                                
                                    if ct_spec_hdn_pstv ne 0 then begin
                                        ;stop
0068116a   Ilyes Choubani   General update + ...
2191
2192
2193
                                        xx = (((*(*!dustem_show).used).wav)[idx_rmv_sed])(idx_spec_hdn_pstv)
                                        yy = (((*(*!dustem_show).used).values)[idx_rmv_sed])(idx_spec_hdn_pstv)
                                        rms=3.*(((*(*!dustem_show).used).sigma)[idx_rmv_sed])(idx_spec_hdn_pstv)/2.
74103816   Ilyes Choubani   small update
2194
2195
2196
2197
2198
2199
2200
2201
                                        
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',/overplot,xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,noerase=1,color='Black',/overplot,rms=rms,yr=yr,xtickformat='(A1)',xr=xr,xs=1,/xlog,/ylog,ytickformat='(A1)';,psym=8,syms=0.8
                                    
                                    endif 
                                    
                                    if ct_filt_hdn_pstv ne 0 then begin
                                        ;stop
0068116a   Ilyes Choubani   General update + ...
2202
2203
2204
                                        xx = (((*(*!dustem_show).used).wav)[idx_rmv_sed])(idx_filt_hdn_pstv)
                                        yy = (((*(*!dustem_show).used).values)[idx_rmv_sed])(idx_filt_hdn_pstv)
                                        rms=3.*(((*(*!dustem_show).used).sigma)[idx_rmv_sed])(idx_filt_hdn_pstv)/2.
74103816   Ilyes Choubani   small update
2205
2206
2207
2208
2209
2210
                                        
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)' 
                                        dustem_plot_mlog,xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,color='Black',/overplot,rms=rms,xr=xr,yr=yr,xtickformat='(A1)',/xlog,/ylog,ytickformat='(A1)';,psym=8,syms=0.8
                                    
                                    endif
                                endif   
67bd858a   Ilyes Choubani   Replication of th...
2211
                            endelse                          
18e4331f   Ilyes Choubani   general update (f...
2212
                        
67bd858a   Ilyes Choubani   Replication of th...
2213
                        endif 
18e4331f   Ilyes Choubani   general update (f...
2214
                        
67bd858a   Ilyes Choubani   Replication of th...
2215
                        if keyword_set(negative_only) then begin
18e4331f   Ilyes Choubani   general update (f...
2216
                            ;stop
67bd858a   Ilyes Choubani   Replication of th...
2217
2218
2219
2220
2221
2222
2223
                            if testngtv ne 0 then begin
                                 
                                 plotsym, 0
                                 
                                 
                                 if ct_spec ne 0 then begin
                                 
0068116a   Ilyes Choubani   General update + ...
2224
2225
2226
2227
                                     rms=3.*((*(*!dustem_data).used).sigma)(idx_spec)/2.
                                     ;dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_spec),-((*(*!dustem_data).used).values)(idx_spec),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                     ;if ct_spec_hdn_ngtv ne 0 then dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_spec),((*(*!dustem_data).used).values)(idx_spec),ppositions=position,/overplot,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr else begin
                                     dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_spec),((*(*!dustem_data).used).values)(idx_spec),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
67bd858a   Ilyes Choubani   Replication of th...
2228
                                     ;endelse;,ytickformat='(A1)'
0068116a   Ilyes Choubani   General update + ...
2229
                                     dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_spec),((*(*!dustem_data).used).values)(idx_spec),ppositions=position,color='Dodger Blue',/negative_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,psym=16,syms=0.8,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)'     
67bd858a   Ilyes Choubani   Replication of th...
2230
2231
2232
2233
2234
                                  
                                 endif
                                 
                                 if ct_filt ne 0 then begin
                                     
0068116a   Ilyes Choubani   General update + ...
2235
2236
2237
                                     rms=3.*((*(*!dustem_data).used).sigma)(idx_filt)/2.
                                    ; dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_filt),-1.*((*(*!dustem_data).used).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                     ;if ct_filt_hdn_ngtv ne 0 then  dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_filt),((*(*!dustem_data).used).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',/overplot,psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr else begin
74103816   Ilyes Choubani   small update
2238
                                     
0068116a   Ilyes Choubani   General update + ...
2239
2240
                                     if ct_spec ne 0 then dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_filt),((*(*!dustem_data).used).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                     if ct_spec eq 0 then dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_filt),((*(*!dustem_data).used).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
67bd858a   Ilyes Choubani   Replication of th...
2241
2242
                                     ;endelse ;,ytickformat='(A1)'
                                     
0068116a   Ilyes Choubani   General update + ...
2243
                                     dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_filt),((*(*!dustem_data).used).values)(idx_filt),ppositions=position,color='Dodger Blue',/negative_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,psym=16,syms=0.8,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)'
67bd858a   Ilyes Choubani   Replication of th...
2244
2245
2246
                                         
                                 endif
                                 
74103816   Ilyes Choubani   small update
2247
                                 if ct_hdnpts NE 0 then begin
67bd858a   Ilyes Choubani   Replication of th...
2248
2249
                                 
                                     if ct_spec_hdn_ngtv ne 0 then begin
0068116a   Ilyes Choubani   General update + ...
2250
2251
2252
                                         xx = (((*(*!dustem_show).used).wav)[idx_rmv_sed])(idx_spec_hdn_ngtv)
                                         yy = (((*(*!dustem_show).used).values)[idx_rmv_sed])(idx_spec_hdn_ngtv)
                                         rms=3.*(((*(*!dustem_show).used).sigma)[idx_rmv_sed])(idx_spec_hdn_ngtv)/2.
67bd858a   Ilyes Choubani   Replication of th...
2253
                                         
74103816   Ilyes Choubani   small update
2254
2255
                                         dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',/overplot,xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                         dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,noerase=1,color='Black',/overplot,rms=rms,yr=yr,xtickformat='(A1)',xr=xr,xs=1,/xlog,/ylog,ytickformat='(A1)';,psym=8,syms=0.8
67bd858a   Ilyes Choubani   Replication of th...
2256
2257
2258
2259
2260
                                     
                                     endif 
                                     
                                     if ct_filt_hdn_ngtv ne 0 then begin
                                     
0068116a   Ilyes Choubani   General update + ...
2261
2262
2263
                                         xx = (((*(*!dustem_show).used).wav)[idx_rmv_sed])(idx_filt_hdn_ngtv)
                                         yy = (((*(*!dustem_show).used).values)[idx_rmv_sed])(idx_filt_hdn_ngtv)
                                         rms=3.*(((*(*!dustem_show).used).sigma)[idx_rmv_sed])(idx_filt_hdn_ngtv)/2.
67bd858a   Ilyes Choubani   Replication of th...
2264
                                         
74103816   Ilyes Choubani   small update
2265
2266
                                         dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',/overplot,xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)'  
                                         dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,color='Black',/overplot,rms=rms,xr=xr,yr=yr,xtickformat='(A1)',/xlog,/ylog,ytickformat='(A1)';,psym=8,syms=0.8
67bd858a   Ilyes Choubani   Replication of th...
2267
2268
2269
2270
                                     
                                     endif

                                 endif 
18e4331f   Ilyes Choubani   general update (f...
2271
                            
67bd858a   Ilyes Choubani   Replication of th...
2272
                            endif else begin
1bc09467   Ilyes Choubani   fixed issue with ...
2273
                            
0068116a   Ilyes Choubani   General update + ...
2274
                                if ct_spec ne 0 then dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_spec),-((*(*!dustem_data).used).values)(idx_spec),ppositions=position,charsize=1.15,/nodata,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
1bc09467   Ilyes Choubani   fixed issue with ...
2275
2276
                                    
                                
0068116a   Ilyes Choubani   General update + ...
2277
                                if ct_filt ne 0 and ct_spec eq 0 then  dustem_plot_mlog,((*(*!dustem_data).used).wav)(idx_filt),-((*(*!dustem_data).used).values)(idx_filt),/nodata,ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
74103816   Ilyes Choubani   small update
2278
2279
2280
2281
2282
                                
                                
                                if ct_hdnpts NE 0 then begin
                                
                                    if ct_spec_hdn_ngtv ne 0 then begin
0068116a   Ilyes Choubani   General update + ...
2283
2284
2285
                                        xx = (((*(*!dustem_show).used).wav)[idx_rmv_sed])(idx_spec_hdn_ngtv)
                                        yy = (((*(*!dustem_show).used).values)[idx_rmv_sed])(idx_spec_hdn_ngtv)
                                        rms=3.*(((*(*!dustem_show).used).sigma)[idx_rmv_sed])(idx_spec_hdn_ngtv)/2.
74103816   Ilyes Choubani   small update
2286
2287
2288
2289
2290
2291
2292
2293
                                        
                                        dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',/overplot,xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                        dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,noerase=1,color='Black',/overplot,rms=rms,yr=yr,xtickformat='(A1)',xr=xr,xs=1,/xlog,/ylog,ytickformat='(A1)';,psym=8,syms=0.8
                                    
                                    endif 
                                    
                                    if ct_filt_hdn_ngtv ne 0 then begin
                                    
0068116a   Ilyes Choubani   General update + ...
2294
2295
2296
                                        xx = (((*(*!dustem_show).used).wav)[idx_rmv_sed])(idx_filt_hdn_ngtv)
                                        yy = (((*(*!dustem_show).used).values)[idx_rmv_sed])(idx_filt_hdn_ngtv)
                                        rms=3.*(((*(*!dustem_show).used).sigma)[idx_rmv_sed])(idx_filt_hdn_ngtv)/2.
74103816   Ilyes Choubani   small update
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
                                        
                                        dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,charsize=1.15,xtickformat='(A1)',/overplot,xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr,ytickformat='(A1)'  
                                        dustem_plot_mlog,xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,color='Black',/overplot,rms=rms,xr=xr,yr=yr,xtickformat='(A1)',/xlog,/ylog,ytickformat='(A1)';,psym=8,syms=0.8
                                    
                                    endif

                                endif     
                                 
                                 
                                 
                                 
                                 
67bd858a   Ilyes Choubani   Replication of th...
2309
2310
2311
                            endelse
                            ;stop
                        endif
18e4331f   Ilyes Choubani   general update (f...
2312
2313
2314
2315
2316
2317
                        
                    
                    endelse 
                
                
                
67bd858a   Ilyes Choubani   Replication of th...
2318
                endelse 
18e4331f   Ilyes Choubani   general update (f...
2319
            
67bd858a   Ilyes Choubani   Replication of th...
2320
2321
            endelse ;

b5314324   Ilyes Choubani   updating the plot...
2322
2323
2324
        
        end
        
afde94a3   Ilyes Choubani   general update
2325
        'QEXT': begin   ;Correct this like you corrected extinction...
1bc09467   Ilyes Choubani   fixed issue with ...
2326
            
4b745987   Ilyes Choubani   minor update
2327
2328
2329
2330
2331
2332
2333
            IF ct_x NE 0 then begin
            
                xr=xr_x 
                yr=yr_x
                
            ENDIF
            
1bc09467   Ilyes Choubani   fixed issue with ...
2334
2335
2336
2337
2338
2339
            vectw=DINDGEN(1001)*(alog10(1E7) - alog10(1E5))/(1000 - 1L) + alog10(1E5)
            vectw=10^vectw[1:*]
            vectw=[wavs,vectw]
            vectx=vectw*0+1
            
            
0068116a   Ilyes Choubani   General update + ...
2340
2341
            varvar=where((*(*!dustem_data).qext).values GT 0, testpstv)
            varvar=where((*(*!dustem_data).qext).values LT 0, testngtv)
2df3360b   Ilyes Choubani   Correcting error:...
2342
            
18e4331f   Ilyes Choubani   general update (f...
2343
            ;stop
0068116a   Ilyes Choubani   General update + ...
2344
2345
            idx_filt=where((*(*!dustem_data).qext).filt_names NE 'SPECTRUM', ct_filt)
            idx_spec=where((*(*!dustem_data).qext).filt_names EQ 'SPECTRUM' , ct_spec)
18e4331f   Ilyes Choubani   general update (f...
2346
            
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
2347
            
18e4331f   Ilyes Choubani   general update (f...
2348
            ;Locating all the hidden data points (spectrum+filter)
0068116a   Ilyes Choubani   General update + ...
2349
            match2,((*(*!dustem_data).qext).wav),((*(*!dustem_show).qext).wav),show_sedpts,fit_sedpts ;only show_sedpts is needed
74103816   Ilyes Choubani   small update
2350
            idx_rmv_sed=where(fit_sedpts eq -1, ct_hdnpts) ; indices of the points to hide
c8368c6e   Ilyes Choubani   updating plotting...
2351
            
5f04fa07   Ilyes Choubani   general update
2352
            ;stop
bc224f3e   Ilyes Choubani   Update of plottin...
2353
2354
2355
2356
2357
2358
2359
            
            ;#1) get the plotting keywords (pertaining to each data set) @here when the _extra structure is ready
            
            if keyword_set(nodata) then begin ;when the data is not present
            
                if keyword_set(norm) then begin ;normalized plot
                    
f2caf3f1   Ilyes Choubani   Debugging some er...
2360
                    xtit=textoidl('1/\lambda (\mum^{-1})')
bc224f3e   Ilyes Choubani   Update of plottin...
2361
                    if !run_pol then xtit = ''
1bc09467   Ilyes Choubani   fixed issue with ...
2362
                    cgplot,1/vectw,vectx,/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
bc224f3e   Ilyes Choubani   Update of plottin...
2363
2364
2365
2366
                    xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1                        
                
                endif else begin ;normal plot
                    
18e4331f   Ilyes Choubani   general update (f...
2367
2368
                    cgplot,wavs,wavs,/nodata,/ylog,/xlog,/ys,xs=1,pos=position,noerase=1,charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,xtit='',yr=yr,psym=8,syms=0.8  
                    ;cgaxis, xaxis=1 ,xlog=1 ,xrange=((!const.c*1E6/xr)*1E-9),charsize=1.15,title=textoidl('\nu (GHz)'),xticklen=0.05,xminor=10
94c4dffa   Ilyes Choubani   update + fixes fo...
2369
                    xyouts,pospltxt[0],pospltxt[1],textoidl('\tau_{QEXT}'),color=0,/normal,charsize=1.3;,charthick=2.0
bc224f3e   Ilyes Choubani   Update of plottin...
2370
2371
2372
2373
2374
                  
                endelse  
                
            
            endif else begin ;when the data is present 
18e4331f   Ilyes Choubani   general update (f...
2375
                
bc224f3e   Ilyes Choubani   Update of plottin...
2376
                if keyword_set(norm) then begin 
c8368c6e   Ilyes Choubani   updating plotting...
2377
                    
bc224f3e   Ilyes Choubani   Update of plottin...
2378
2379
                    if keyword_set(refresh) then begin ;The data points in the plot that are being refreshed 
                        
07372e26   Ilyes Choubani   Corrected huge pl...
2380
                        ;MAJOR LOOP OVER THE SIGN??? - YES BECAUSE YOU NEED TO KNOW WHICH ONE IS THE 
c8368c6e   Ilyes Choubani   updating plotting...
2381
                
18e4331f   Ilyes Choubani   general update (f...
2382
                        IF ct_spec NE 0 THEN BEGIN
f2caf3f1   Ilyes Choubani   Debugging some er...
2383
                            
0068116a   Ilyes Choubani   General update + ...
2384
                            xx=((*(*!dustem_data).qext).wav)[idx_spec]
5f04fa07   Ilyes Choubani   general update
2385
                            yy=dustem_interp[idx_spec]
0068116a   Ilyes Choubani   General update + ...
2386
                            rms=3.*((*(*!dustem_data).qext).sigma)(idx_spec)/2.
f2caf3f1   Ilyes Choubani   Debugging some er...
2387
2388
2389
2390
2391
2392
2393
2394
                            
                            ;testing so that data/yy is finite: 
                            ;avoiding zero points in yy since we divide by it
                            ;testing also if the data is full of zeros (ie: PSI=0 for U and PSI=90 for Q)
                            
                            indzero = where(yy NE 0, ct_zero)
                            if ct_zero ne 0 then begin  

0068116a   Ilyes Choubani   General update + ...
2395
2396
                                cgoplot,(1/xx)[indzero],(((*(*!dustem_data).qext).values)(idx_spec))[indzero]/yy[indzero],pos=position,psym=16,color='Powder Blue',syms=0.8,noerase=1 
                                cgerrplot,(1/((*(*!dustem_data).qext).wav)(idx_spec))[indzero],((((*(*!dustem_data).qext).values)[idx_spec])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).qext).values)[idx_spec])[indzero]+rms[indzero])/yy[indzero],color='Powder Blue'
f2caf3f1   Ilyes Choubani   Debugging some er...
2397
                            endif
18e4331f   Ilyes Choubani   general update (f...
2398
2399
                        ENDIF
                        
bc224f3e   Ilyes Choubani   Update of plottin...
2400
                        IF ct_filt NE 0 THEN BEGIN
18e4331f   Ilyes Choubani   general update (f...
2401
                            ;stop
0068116a   Ilyes Choubani   General update + ...
2402
                            xx=((*(*!dustem_data).qext).wav)[idx_filt]
5f04fa07   Ilyes Choubani   general update
2403
                            yy=dustem_interp[idx_filt]
0068116a   Ilyes Choubani   General update + ...
2404
                            rms=3.*((*(*!dustem_data).qext).sigma)(idx_filt)/2. 
f2caf3f1   Ilyes Choubani   Debugging some er...
2405
2406
                            indzero = where(yy NE 0, ct_zero)
                            IF ct_zero NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2407
2408
                                cgoplot,(1/xx)[indzero],(((*(*!dustem_data).qext).values)(idx_filt))[indzero]/yy[indzero],pos=position,psym=16,color='Dodger Blue',syms=0.8,noerase=1 
                                cgerrplot,(1/((*(*!dustem_data).qext).wav)(idx_filt))[indzero],((((*(*!dustem_data).qext).values)[idx_filt])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).qext).values)[idx_filt])[indzero]+rms[indzero])/yy[indzero],color='Dodger Blue' 
f2caf3f1   Ilyes Choubani   Debugging some er...
2409
                            ENDIF
bc224f3e   Ilyes Choubani   Update of plottin...
2410
                        ENDIF
c8368c6e   Ilyes Choubani   updating plotting...
2411
      
bc224f3e   Ilyes Choubani   Update of plottin...
2412
                        
bc224f3e   Ilyes Choubani   Update of plottin...
2413
                    endif else begin ;The data points in the plot that remain unchanged
18e4331f   Ilyes Choubani   general update (f...
2414
                        ;stop
1bc09467   Ilyes Choubani   fixed issue with ...
2415
                        
f2caf3f1   Ilyes Choubani   Debugging some er...
2416
                        xtit=textoidl('1/\lambda (\mum^{-1})')
1355825c   Ilyes Choubani   General update
2417
                        ;if !run_pol then xtit = ''
afde94a3   Ilyes Choubani   general update
2418
                        cgplot,1/vectw,vectx,/xlog,/ys,xs=1,pos=position,noerase=1,color='Black',xr=xr,xtit=xtit,yr=[0.0,2.0],yticks=2,ymino=2,xticklen=0.1,ytickformat='(F6.2)',charsize=1.0
bc224f3e   Ilyes Choubani   Update of plottin...
2419
2420
2421
2422
2423
                        xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1
                    
                    endelse
                    
                
07372e26   Ilyes Choubani   Corrected huge pl...
2424
                endif else begin ; normal plot 
c8368c6e   Ilyes Choubani   updating plotting...
2425
                              
bc224f3e   Ilyes Choubani   Update of plottin...
2426
                    if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
4b745987   Ilyes Choubani   minor update
2427
                        
18e4331f   Ilyes Choubani   general update (f...
2428
2429
                        if keyword_set(positive_only) then begin
     
2df3360b   Ilyes Choubani   Correcting error:...
2430
                            if testpstv ne 0 then begin
4b745987   Ilyes Choubani   minor update
2431
                                
18e4331f   Ilyes Choubani   general update (f...
2432
                                FOR i=0L,Ngrains-1 DO BEGIN
5f04fa07   Ilyes Choubani   general update
2433
                                    
07372e26   Ilyes Choubani   Corrected huge pl...
2434
2435
2436
                                    vecto = transpose((st.polext.(1))[i,*]+(st.polext.(2))[i,*])
                                    vecte = transpose((st.ext.(1))[i,*]+(st.ext.(2))[i,*])
                                    testneq = where( vecto ne 0,countneq)
07372e26   Ilyes Choubani   Corrected huge pl...
2437
                                    
4b745987   Ilyes Choubani   minor update
2438

5f04fa07   Ilyes Choubani   general update
2439
                                    if countneq ne 0 then begin 
07372e26   Ilyes Choubani   Corrected huge pl...
2440
                                        vecfin = vecto*0.0 ;em_tot can be used here right? 
5f04fa07   Ilyes Choubani   general update
2441
                                        ;stop
07372e26   Ilyes Choubani   Corrected huge pl...
2442
                                        vecfin[testneq] = (vecto[testneq])/vecte[testneq];extra_spec[testneq];(st.sed.em_tot)[testneq];(st.sed.(i+1))[testneq];*fact;(st.sed.(i+1))[testneq]
5f04fa07   Ilyes Choubani   general update
2443
2444
                                        ;stop
                                        ;polar_ippsi2iqu,st.sed.(i+1)*fact,specqgrain,specugrain,st.polsed.(i+1)*fact/spec,replicate(!dustem_psi,n_elements(spec)) ;temporary solution
07372e26   Ilyes Choubani   Corrected huge pl...
2445
2446
2447
                                        polar_ippsi2iqu,vecte*(*!dustem_HCD)/1.0e21,specqgrain,specugrain,vecfin,replicate(!dustem_psi_ext,n_elements(vecfin)) ;temporary solution
                                        
                                        ;if countneg ne 0 and cos(!dustem_psi_ext) gt 0 then specqgrain[testneg] = 0
5f04fa07   Ilyes Choubani   general update
2448
                                        
5f04fa07   Ilyes Choubani   general update
2449
                                        ;dustem_plot_mlog,st.polsed.wav,specqgrain,ppositions=position,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog 
1bc09467   Ilyes Choubani   fixed issue with ...
2450
                                        dustem_plot_mlog,1/st.polext.wav,specqgrain,ppositions=position,/positive_only,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
07372e26   Ilyes Choubani   Corrected huge pl...
2451
                                        
5f04fa07   Ilyes Choubani   general update
2452
                                    endif
4b745987   Ilyes Choubani   minor update
2453
2454
                                    
                                    
18e4331f   Ilyes Choubani   general update (f...
2455
2456
2457
                                ENDFOR
                                
                                for i=0L,n_plgns-1 do begin
3c479f24   Ilyes Choubani   Allowing to fix p...
2458
2459
                                    
                                    IF isa((*!dustem_plugin).(0).spec) THEN BEGIN
67bd858a   Ilyes Choubani   Replication of th...
2460
                                        IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLEXT') THEN begin
3c479f24   Ilyes Choubani   Allowing to fix p...
2461
2462
                                         
                                            ;dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i))[*,1],ppositions=position, /overplot, noerase=1, color=clrs_plgns[i], linestyle=2,xr=xr,/xlog
1bc09467   Ilyes Choubani   fixed issue with ...
2463
                                            dustem_plot_mlog,1/st.polext.wav,(*(*!dustem_plugin).(i).spec)[*,1],ppositions=position,/positive_only,/overplot,noerase=1, color=clrs_plgns[i], linestyle=2 ,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr      
3c479f24   Ilyes Choubani   Allowing to fix p...
2464
                                        ENDIF
18e4331f   Ilyes Choubani   general update (f...
2465
2466
2467
2468
                                    ENDIF
                                endfor
                                
                                IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2469
                                    xx=((*(*!dustem_data).qext).wav)[idx_spec]
5f04fa07   Ilyes Choubani   general update
2470
                                    yy=dustem_interp[idx_spec]
18e4331f   Ilyes Choubani   general update (f...
2471
                                    ;dustem_plot_mlog,xx,yy,ppositions=position,/overplot, noerase=1, color='red',psym=7,syms=2,xr=xr,/xlog
1bc09467   Ilyes Choubani   fixed issue with ...
2472
                                    dustem_plot_mlog,1/xx,yy,ppositions=position,/positive_only, /overplot, noerase=1, color='Indian Red',psym=7,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr 
18e4331f   Ilyes Choubani   general update (f...
2473
2474
2475
                                ENDIF
                                
                                IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2476
                                    xx=((*(*!dustem_data).qext).wav)[idx_filt]
5f04fa07   Ilyes Choubani   general update
2477
                                    yy=dustem_interp[idx_filt]
18e4331f   Ilyes Choubani   general update (f...
2478
                                    ;dustem_plot_mlog,xx,yy,ppositions=position, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog
1bc09467   Ilyes Choubani   fixed issue with ...
2479
                                    dustem_plot_mlog,1/xx,yy,ppositions=position,/positive_only, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
18e4331f   Ilyes Choubani   general update (f...
2480
2481
                                ENDIF
                                
1bc09467   Ilyes Choubani   fixed issue with ...
2482
                                dustem_plot_mlog,1/st.polext.wav,dustem_spec,ppositions=position,/positive_only,/overplot,noerase=1,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr                                    
07372e26   Ilyes Choubani   Corrected huge pl...
2483
                                
18e4331f   Ilyes Choubani   general update (f...
2484
2485
                            endif
                                    
bc224f3e   Ilyes Choubani   Update of plottin...
2486
                        
18e4331f   Ilyes Choubani   general update (f...
2487
                        endif
bc224f3e   Ilyes Choubani   Update of plottin...
2488
                        
5f04fa07   Ilyes Choubani   general update
2489
                        ;stop
18e4331f   Ilyes Choubani   general update (f...
2490
                        if keyword_set(negative_only) then begin
5f04fa07   Ilyes Choubani   general update
2491
                            ;stop     
2df3360b   Ilyes Choubani   Correcting error:...
2492
                            if testngtv ne 0 then begin
c8368c6e   Ilyes Choubani   updating plotting...
2493
                            
5f04fa07   Ilyes Choubani   general update
2494
                                ;stop    
18e4331f   Ilyes Choubani   general update (f...
2495
2496
                                ;Plotting of the spectra of the dust species
                                FOR i=0L,Ngrains-1 DO BEGIN
07372e26   Ilyes Choubani   Corrected huge pl...
2497
2498
2499
                                    vecto = transpose(((st.polext.(1))[i,*]+(st.polext.(2))[i,*]))
                                    vecte = transpose(((st.ext.(1))[i,*]+(st.ext.(2))[i,*]))
                                    testneq = where(vecto ne 0,countneq)
5f04fa07   Ilyes Choubani   general update
2500
2501
                                    ;stop
                                    if countneq ne 0 then begin 
07372e26   Ilyes Choubani   Corrected huge pl...
2502
                                        vecfin = vecto*0.0 ;em_tot can be used here right? 
5f04fa07   Ilyes Choubani   general update
2503
                                        ;stop
07372e26   Ilyes Choubani   Corrected huge pl...
2504
                                        vecfin[testneq] = (vecto[testneq])/vecte[testneq];extra_spec[testneq];(st.sed.em_tot)[testneq];(st.sed.(i+1))[testneq];*fact;(st.sed.(i+1))[testneq] 
5f04fa07   Ilyes Choubani   general update
2505
                                        ;stop    
07372e26   Ilyes Choubani   Corrected huge pl...
2506
                                        polar_ippsi2iqu,vecte*(*!dustem_HCD)/1.0e21,specqgrain,specugrain,vecfin,replicate(!dustem_psi_ext,n_elements(vecfin)) ;temporary solution
74103816   Ilyes Choubani   small update
2507
                                        
5f04fa07   Ilyes Choubani   general update
2508
                                        ;dustem_plot_mlog,st.polsed.wav,specqgrain,ppositions=position,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog 
1bc09467   Ilyes Choubani   fixed issue with ...
2509
                                        dustem_plot_mlog,1/st.polext.wav,specqgrain,ppositions=position,/negative_only,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
5f04fa07   Ilyes Choubani   general update
2510
                                    endif 
18e4331f   Ilyes Choubani   general update (f...
2511
2512
2513
                                ENDFOR
                                ;Plotting of the plugins
                                for i=0L,n_plgns-1 do begin
3c479f24   Ilyes Choubani   Allowing to fix p...
2514
2515
                                    IF isa((*!dustem_plugin).(0).spec) THEN BEGIN
                                    
67bd858a   Ilyes Choubani   Replication of th...
2516
                                        IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLEXT') THEN begin
3c479f24   Ilyes Choubani   Allowing to fix p...
2517
2518
     
                                            ;dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i))[*,1],ppositions=position, /overplot, noerase=1, color=clrs_plgns[i], linestyle=2,xr=xr,/xlog
1bc09467   Ilyes Choubani   fixed issue with ...
2519
                                            dustem_plot_mlog,1/st.polext.wav,(*(*!dustem_plugin).(i).spec)[*,1],ppositions=position,/negative_only,/overplot,noerase=1, color=clrs_plgns[i], linestyle=2 ,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr      
3c479f24   Ilyes Choubani   Allowing to fix p...
2520
2521
                                        ENDIF
                                        
18e4331f   Ilyes Choubani   general update (f...
2522
2523
2524
2525
                                    ENDIF
                                endfor
                                ;PLotting of the interpolates corresponding to spectrum and filter points
                                IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2526
                                    xx=((*(*!dustem_data).qext).wav)[idx_spec]
5f04fa07   Ilyes Choubani   general update
2527
                                    yy=dustem_interp[idx_spec]
18e4331f   Ilyes Choubani   general update (f...
2528
                                    ;dustem_plot_mlog,xx,yy,ppositions=position,/overplot, noerase=1, color='red',psym=7,syms=2,xr=xr,/xlog
1bc09467   Ilyes Choubani   fixed issue with ...
2529
                                    dustem_plot_mlog,1/xx,yy,ppositions=position,/negative_only, /overplot, noerase=1, color='Indian Red',psym=7,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr 
18e4331f   Ilyes Choubani   general update (f...
2530
2531
2532
                                ENDIF
                                
                                IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2533
                                    xx=((*(*!dustem_data).qext).wav)[idx_filt]
5f04fa07   Ilyes Choubani   general update
2534
                                    yy=dustem_interp[idx_filt]
18e4331f   Ilyes Choubani   general update (f...
2535
                                    ;dustem_plot_mlog,xx,yy,ppositions=position, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog
1bc09467   Ilyes Choubani   fixed issue with ...
2536
                                    dustem_plot_mlog,1/xx,yy,ppositions=position,/negative_only, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
18e4331f   Ilyes Choubani   general update (f...
2537
2538
                                ENDIF
                                ;Plotting of the total dust emission spectrum
1bc09467   Ilyes Choubani   fixed issue with ...
2539
                                dustem_plot_mlog,1/st.polext.wav,dustem_spec,ppositions=position,/negative_only,/overplot,noerase=1,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr                                    
18e4331f   Ilyes Choubani   general update (f...
2540
2541
2542
                            
                            endif
                                    
bc224f3e   Ilyes Choubani   Update of plottin...
2543
                        
18e4331f   Ilyes Choubani   general update (f...
2544
2545
2546
2547
2548
2549
                        endif
                                                   
                      ;stop             
                    endif else begin ;The data points in the plot that remain unchanged.; DO NOT USE AN ELSE HERE. 
                        ;stop
                        ;cgaxis, xaxis=1,xlog=1, xs=1,charsize=1.5,xtickformat='(A1)'
94c4dffa   Ilyes Choubani   update + fixes fo...
2550
                        xyouts,pospltxt[0],pospltxt[1],textoidl('\tau_{QEXT}'),color=0,/normal,charsize=1.3;,charthick=2.0  
2df3360b   Ilyes Choubani   Correcting error:...
2551
                        ;if ct_hdnpts ne 0 then begin ;Hidden data points are present 
18e4331f   Ilyes Choubani   general update (f...
2552
                            
2df3360b   Ilyes Choubani   Correcting error:...
2553
2554
                        ;Locating the hidden spectrum and filter data points     
                        ;SADLY I STILL DON'T HAVE A SOLUTION FOR THE PLOTTING OF NULL VALUES.                                   
0068116a   Ilyes Choubani   General update + ...
2555
2556
                        ;idx_filt_hdn = where(((*(*!dustem_show).qsed).filt_names)(idx_rmv_sed) NE 'SPECTRUM',ct_filt_hdn)
                        ;idx_spec_hdn = where(((*(*!dustem_show).qsed).filt_names)(idx_rmv_sed) EQ 'SPECTRUM',ct_spec_hdn)
9cb38725   Ilyes Choubani   Fixed tests relat...
2557
                        if ct_hdnpts then begin
0068116a   Ilyes Choubani   General update + ...
2558
2559
2560
2561
                            idx_filt_hdn_pstv = where(((*(*!dustem_show).qext).filt_names)(idx_rmv_sed) NE 'SPECTRUM' and ((*(*!dustem_show).qext).values)(idx_rmv_sed) gt 0,ct_filt_hdn_pstv)
                            idx_spec_hdn_pstv = where(((*(*!dustem_show).qext).filt_names)(idx_rmv_sed) EQ 'SPECTRUM' and ((*(*!dustem_show).qext).values)(idx_rmv_sed) gt 0,ct_spec_hdn_pstv)
                            idx_filt_hdn_ngtv = where(((*(*!dustem_show).qext).filt_names)(idx_rmv_sed) NE 'SPECTRUM' and ((*(*!dustem_show).qext).values)(idx_rmv_sed) lt 0,ct_filt_hdn_ngtv)
                            idx_spec_hdn_ngtv = where(((*(*!dustem_show).qext).filt_names)(idx_rmv_sed) EQ 'SPECTRUM' and ((*(*!dustem_show).qext).values)(idx_rmv_sed) lt 0,ct_spec_hdn_ngtv)
9cb38725   Ilyes Choubani   Fixed tests relat...
2562
                        endif
bc224f3e   Ilyes Choubani   Update of plottin...
2563
                        
c8368c6e   Ilyes Choubani   updating plotting...
2564
                        
18e4331f   Ilyes Choubani   general update (f...
2565
                        if keyword_set(positive_only) then begin
afde94a3   Ilyes Choubani   general update
2566
                            
2df3360b   Ilyes Choubani   Correcting error:...
2567
                            if testpstv ne 0 then begin
07372e26   Ilyes Choubani   Corrected huge pl...
2568
                        
74103816   Ilyes Choubani   small update
2569
2570
2571
2572
2573
                                plotsym, 0
                                
                                
                                if ct_spec ne 0 then begin
                                
0068116a   Ilyes Choubani   General update + ...
2574
2575
                                    rms=3.*((*(*!dustem_data).qext).sigma)(idx_spec)/2.
                                    ;dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),-((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
74103816   Ilyes Choubani   small update
2576
                                
0068116a   Ilyes Choubani   General update + ...
2577
                                    dustem_plot_mlog,1/((*(*!dustem_data).qext).wav)(idx_spec),((*(*!dustem_data).qext).values)(idx_spec),ppositions=position,charsize=1.15,color='Powder Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
74103816   Ilyes Choubani   small update
2578
                                    
0068116a   Ilyes Choubani   General update + ...
2579
                                    dustem_plot_mlog,1/((*(*!dustem_data).qext).wav)(idx_spec),((*(*!dustem_data).qext).values)(idx_spec),ppositions=position,color='Powder Blue',/positive_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,psym=16,syms=0.8,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)'     
74103816   Ilyes Choubani   small update
2580
2581
2582
2583
2584
                                     
                                endif
                                
                                if ct_filt ne 0 then begin
                                    
0068116a   Ilyes Choubani   General update + ...
2585
2586
2587
2588
2589
                                    rms=3.*((*(*!dustem_data).qext).sigma)(idx_filt)/2.
                                   ; dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),-1.*((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    if ct_spec ne 0 then dustem_plot_mlog,1/((*(*!dustem_data).qext).wav)(idx_filt),((*(*!dustem_data).qext).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                    if ct_spec eq 0 then dustem_plot_mlog,1/((*(*!dustem_data).qext).wav)(idx_filt),((*(*!dustem_data).qext).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    dustem_plot_mlog,1/((*(*!dustem_data).qext).wav)(idx_filt),((*(*!dustem_data).qext).values)(idx_filt),ppositions=position,color='Dodger Blue',/positive_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,psym=16,syms=0.8,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)'
74103816   Ilyes Choubani   small update
2590
2591
2592
                                        
                                endif
                                
18e4331f   Ilyes Choubani   general update (f...
2593
                                
74103816   Ilyes Choubani   small update
2594
                                if ct_hdnpts NE 0 then begin
18e4331f   Ilyes Choubani   general update (f...
2595
                                
9cb38725   Ilyes Choubani   Fixed tests relat...
2596
                                    if ct_spec_hdn_pstv ne 0 then begin
0068116a   Ilyes Choubani   General update + ...
2597
2598
2599
                                        xx = (((*(*!dustem_show).qext).wav)[idx_rmv_sed])(idx_spec_hdn_pstv)
                                        yy = (((*(*!dustem_show).qext).values)[idx_rmv_sed])(idx_spec_hdn_pstv)
                                        rms=3.*(((*(*!dustem_show).qext).sigma)[idx_rmv_sed])(idx_spec_hdn_pstv)/2.
9cb38725   Ilyes Choubani   Fixed tests relat...
2600
                                        
74103816   Ilyes Choubani   small update
2601
                                        dustem_plot_mlog,1/xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,/overplot,charsize=1.15,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr
1bc09467   Ilyes Choubani   fixed issue with ...
2602
                                        dustem_plot_mlog,1/xx,yy,ppositions=position,/positive_only,noerase=1,color='Black',/overplot,rms=rms,yr=yr,xtickformat='(A1)',xr=xr,xs=1,/xlog,/ylog;,psym=8,syms=0.8
9cb38725   Ilyes Choubani   Fixed tests relat...
2603
2604
2605
2606
2607
                                    
                                    endif 
                                    
                                    if ct_filt_hdn_pstv ne 0 then begin
                                    
0068116a   Ilyes Choubani   General update + ...
2608
2609
2610
                                        xx = (((*(*!dustem_show).qext).wav)[idx_rmv_sed])(idx_filt_hdn_pstv)
                                        yy = (((*(*!dustem_show).qext).values)[idx_rmv_sed])(idx_filt_hdn_pstv)
                                        rms=3.*(((*(*!dustem_show).qext).sigma)[idx_rmv_sed])(idx_filt_hdn_pstv)/2.
9cb38725   Ilyes Choubani   Fixed tests relat...
2611
                                        
74103816   Ilyes Choubani   small update
2612
                                        dustem_plot_mlog,1/xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,/overplot,charsize=1.15,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr   
1bc09467   Ilyes Choubani   fixed issue with ...
2613
                                        dustem_plot_mlog,1/xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,color='Black',/overplot,rms=rms,xr=xr,yr=yr,xtickformat='(A1)',/xlog,/ylog;,psym=8,syms=0.8
9cb38725   Ilyes Choubani   Fixed tests relat...
2614
2615
                                    
                                    endif
18e4331f   Ilyes Choubani   general update (f...
2616
                                    
18e4331f   Ilyes Choubani   general update (f...
2617
2618
                                endif
                                
9cb38725   Ilyes Choubani   Fixed tests relat...
2619
                                
18e4331f   Ilyes Choubani   general update (f...
2620
2621
                            endif else begin
                            
1bc09467   Ilyes Choubani   fixed issue with ...
2622
                            
0068116a   Ilyes Choubani   General update + ...
2623
                                if ct_spec ne 0 then dustem_plot_mlog,1/((*(*!dustem_data).qext).wav)(idx_spec),-((*(*!dustem_data).qext).values)(idx_spec),ppositions=position,charsize=1.15,/nodata,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
18e4331f   Ilyes Choubani   general update (f...
2624
                                    
1bc09467   Ilyes Choubani   fixed issue with ...
2625
                                
0068116a   Ilyes Choubani   General update + ...
2626
                                if ct_filt ne 0 and ct_spec eq 0 then  dustem_plot_mlog,1/((*(*!dustem_data).qext).wav)(idx_filt),-((*(*!dustem_data).qext).values)(idx_filt),/nodata,ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
1bc09467   Ilyes Choubani   fixed issue with ...
2627
                                
f2caf3f1   Ilyes Choubani   Debugging some er...
2628

18e4331f   Ilyes Choubani   general update (f...
2629
                            endelse                           
bc224f3e   Ilyes Choubani   Update of plottin...
2630
                        
18e4331f   Ilyes Choubani   general update (f...
2631
                        endif 
bc224f3e   Ilyes Choubani   Update of plottin...
2632
                        
bc224f3e   Ilyes Choubani   Update of plottin...
2633
                        
18e4331f   Ilyes Choubani   general update (f...
2634
                        if keyword_set(negative_only) then begin
bc224f3e   Ilyes Choubani   Update of plottin...
2635
                            
2df3360b   Ilyes Choubani   Correcting error:...
2636
                            if testngtv ne 0 then begin
18e4331f   Ilyes Choubani   general update (f...
2637
                                 
74103816   Ilyes Choubani   small update
2638
                                 plotsym, 0
18e4331f   Ilyes Choubani   general update (f...
2639
                                 
18e4331f   Ilyes Choubani   general update (f...
2640
                                 
18e4331f   Ilyes Choubani   general update (f...
2641
2642
                                 if ct_spec ne 0 then begin
                                 
0068116a   Ilyes Choubani   General update + ...
2643
2644
2645
2646
                                     rms=3.*((*(*!dustem_data).qext).sigma)(idx_spec)/2.
                                     ;dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),-((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    ; if ct_spec_hdn_ngtv ne 0 then dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,/overplot,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr else begin
                                     dustem_plot_mlog,1/((*(*!dustem_data).qext).wav)(idx_spec),((*(*!dustem_data).qext).values)(idx_spec),ppositions=position,charsize=1.15,color='Powder Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
1bc09467   Ilyes Choubani   fixed issue with ...
2647
                                         
9cb38725   Ilyes Choubani   Fixed tests relat...
2648
                                     ;endelse;,ytickformat='(A1)'
0068116a   Ilyes Choubani   General update + ...
2649
                                     dustem_plot_mlog,1/((*(*!dustem_data).qext).wav)(idx_spec),((*(*!dustem_data).qext).values)(idx_spec),ppositions=position,color='Powder Blue',/negative_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)';,psym=16,syms=0.8     
1bc09467   Ilyes Choubani   fixed issue with ...
2650
                                                                              
18e4331f   Ilyes Choubani   general update (f...
2651
2652
2653
2654
                                 endif
                                 
                                 if ct_filt ne 0 then begin
                                     
0068116a   Ilyes Choubani   General update + ...
2655
2656
2657
2658
2659
                                     rms=3.*((*(*!dustem_data).qext).sigma)(idx_filt)/2.
                                    ; dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),-1.*((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                     ;if ct_filt_hdn_ngtv ne 0 then  dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',/overplot,psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr else begin
                                     if ct_spec ne 0 then dustem_plot_mlog,1/((*(*!dustem_data).qext).wav)(idx_filt),((*(*!dustem_data).qext).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                     if ct_spec eq 0 then dustem_plot_mlog,1/((*(*!dustem_data).qext).wav)(idx_filt),((*(*!dustem_data).qext).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr
9cb38725   Ilyes Choubani   Fixed tests relat...
2660
                                     ;endelse ;,ytickformat='(A1)'
18e4331f   Ilyes Choubani   general update (f...
2661
                                     
0068116a   Ilyes Choubani   General update + ...
2662
                                     dustem_plot_mlog,1/((*(*!dustem_data).qext).wav)(idx_filt),((*(*!dustem_data).qext).values)(idx_filt),ppositions=position,color='Dodger Blue',/negative_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)'
18e4331f   Ilyes Choubani   general update (f...
2663
                                         
74103816   Ilyes Choubani   small update
2664
2665
2666
2667
2668
                                 endif
                                 
                                 if ct_hdnpts then begin
                                 
                                     if ct_spec_hdn_ngtv ne 0 then begin
0068116a   Ilyes Choubani   General update + ...
2669
2670
2671
                                         xx = (((*(*!dustem_show).qext).wav)[idx_rmv_sed])(idx_spec_hdn_ngtv)
                                         yy = (((*(*!dustem_show).qext).values)[idx_rmv_sed])(idx_spec_hdn_ngtv)
                                         rms=3.*(((*(*!dustem_show).qext).sigma)[idx_rmv_sed])(idx_spec_hdn_ngtv)/2.
74103816   Ilyes Choubani   small update
2672
2673
2674
2675
2676
2677
2678
2679
                                         
                                         dustem_plot_mlog,1/xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr
                                         dustem_plot_mlog,1/xx,yy,ppositions=position,/negative_only,noerase=1,color='Black',/overplot,rms=rms,yr=yr,xtickformat='(A1)',xr=xr,xs=1,/xlog,/ylog;,psym=8,syms=0.8
                                     
                                     endif 
                                     
                                     if ct_filt_hdn_ngtv ne 0 then begin
                                     
0068116a   Ilyes Choubani   General update + ...
2680
2681
2682
                                         xx = (((*(*!dustem_show).qext).wav)[idx_rmv_sed])(idx_filt_hdn_ngtv)
                                         yy = (((*(*!dustem_show).qext).values)[idx_rmv_sed])(idx_filt_hdn_ngtv)
                                         rms=3.*(((*(*!dustem_show).qext).sigma)[idx_rmv_sed])(idx_filt_hdn_ngtv)/2.
74103816   Ilyes Choubani   small update
2683
2684
2685
2686
2687
2688
                                         
                                         dustem_plot_mlog,1/xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr   
                                         dustem_plot_mlog,1/xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,color='Black',/overplot,rms=rms,xr=xr,yr=yr,xtickformat='(A1)',/xlog,/ylog;,psym=8,syms=0.8
                                     
                                     endif
                                
18e4331f   Ilyes Choubani   general update (f...
2689
                                 endif 
c8368c6e   Ilyes Choubani   updating plotting...
2690
                            
c8368c6e   Ilyes Choubani   updating plotting...
2691
                            endif else begin
1bc09467   Ilyes Choubani   fixed issue with ...
2692
                            
0068116a   Ilyes Choubani   General update + ...
2693
                                if ct_spec ne 0 then dustem_plot_mlog,((*(*!dustem_data).qext).wav)(idx_spec),-((*(*!dustem_data).qext).values)(idx_spec),ppositions=position,charsize=1.15,/nodata,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
1bc09467   Ilyes Choubani   fixed issue with ...
2694
                                    
18e4331f   Ilyes Choubani   general update (f...
2695
                                
0068116a   Ilyes Choubani   General update + ...
2696
                                if ct_filt ne 0 and ct_spec eq 0 then  dustem_plot_mlog,((*(*!dustem_data).qext).wav)(idx_filt),-((*(*!dustem_data).qext).values)(idx_filt),/nodata,ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
18e4331f   Ilyes Choubani   general update (f...
2697
                                
18e4331f   Ilyes Choubani   general update (f...
2698
                            endelse
5f04fa07   Ilyes Choubani   general update
2699
                            ;stop
18e4331f   Ilyes Choubani   general update (f...
2700
2701
2702
2703
2704
2705
2706
2707
2708
                        endif
                        
                    
                    endelse 
                
                
                
                endelse 
            
67bd858a   Ilyes Choubani   Replication of th...
2709
            endelse ; 
18e4331f   Ilyes Choubani   general update (f...
2710
        
67bd858a   Ilyes Choubani   Replication of th...
2711
        end
18e4331f   Ilyes Choubani   general update (f...
2712
        
67bd858a   Ilyes Choubani   Replication of th...
2713
        'UEXT': begin
4b745987   Ilyes Choubani   minor update
2714
2715
2716
2717
2718
2719
2720
            IF ct_x NE 0 then begin
            
                xr=xr_x
                yr=yr_x
                
            ENDIF
                
1bc09467   Ilyes Choubani   fixed issue with ...
2721
2722
2723
2724
            vectw=DINDGEN(1001)*(alog10(1E7) - alog10(1E5))/(1000 - 1L) + alog10(1E5)
            vectw=10^vectw[1:*]
            vectw=[wavs,vectw]
            vectx=vectw*0+1
67bd858a   Ilyes Choubani   Replication of th...
2725
        
0068116a   Ilyes Choubani   General update + ...
2726
2727
            varvar=where((*(*!dustem_data).uext).values GT 0, testpstv)
            varvar=where((*(*!dustem_data).uext).values LT 0, testngtv)
67bd858a   Ilyes Choubani   Replication of th...
2728
            
18e4331f   Ilyes Choubani   general update (f...
2729
            ;stop
0068116a   Ilyes Choubani   General update + ...
2730
2731
            idx_filt=where((*(*!dustem_data).uext).filt_names NE 'SPECTRUM', ct_filt)
            idx_spec=where((*(*!dustem_data).uext).filt_names EQ 'SPECTRUM' , ct_spec)
f2caf3f1   Ilyes Choubani   Debugging some er...
2732
            
18e4331f   Ilyes Choubani   general update (f...
2733
2734
2735
2736
2737
            ;Plotting of frequency axis
            ;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)') 
            
            ;stop
            ;Locating all the hidden data points (spectrum+filter)
0068116a   Ilyes Choubani   General update + ...
2738
            match2,((*(*!dustem_data).uext).wav),((*(*!dustem_show).uext).wav),show_sedpts,fit_sedpts ;only show_sedpts is needed
74103816   Ilyes Choubani   small update
2739
            idx_rmv_sed=where(fit_sedpts eq -1, ct_hdnpts) ; indices of the points to hide
18e4331f   Ilyes Choubani   general update (f...
2740
            
67bd858a   Ilyes Choubani   Replication of th...
2741
            
18e4331f   Ilyes Choubani   general update (f...
2742
2743
2744
            ;#1) get the plotting keywords (pertaining to each data set) @here when the _extra structure is ready
            
            if keyword_set(nodata) then begin ;when the data is not present
f2caf3f1   Ilyes Choubani   Debugging some er...
2745
                
18e4331f   Ilyes Choubani   general update (f...
2746
2747
                if keyword_set(norm) then begin ;normalized plot
                    
f2caf3f1   Ilyes Choubani   Debugging some er...
2748
                    xtit=textoidl('1/\lambda (\mum^{-1})')
18e4331f   Ilyes Choubani   general update (f...
2749
                    if !run_pol then xtit = ''
1bc09467   Ilyes Choubani   fixed issue with ...
2750
                    cgplot,1/vectw,vectx,/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
18e4331f   Ilyes Choubani   general update (f...
2751
2752
2753
2754
2755
2756
                    xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1                        
                
                endif else begin ;normal plot
                    
                    cgplot,wavs,wavs,/nodata,/ylog,/xlog,/ys,xs=1,pos=position,noerase=1,charsize=1.15,xtickformat='(A1)',color='Powder Blue',xr=xr,xtit='',yr=yr,psym=8,syms=0.8  
                    ;cgaxis, xaxis=1 ,xlog=1 ,xrange=((!const.c*1E6/xr)*1E-9),charsize=1.15,title=textoidl('\nu (GHz)'),xticklen=0.05,xminor=10
94c4dffa   Ilyes Choubani   update + fixes fo...
2757
                    xyouts,pospltxt[0],pospltxt[1],textoidl('\tau_{UEXT}'),color=0,/normal,charsize=1.3;,charthick=2.0
18e4331f   Ilyes Choubani   general update (f...
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
                  
                endelse  
                
            
            endif else begin ;when the data is present 
                
                if keyword_set(norm) then begin 
                    
                    if keyword_set(refresh) then begin ;The data points in the plot that are being refreshed 
                        
                        ;MAJOR LOOP OVER THE SING??? - YES BECAUSE YOU NEED TO KNOW WHICH ONE IS THE 
                
                        IF ct_spec NE 0 THEN BEGIN
f2caf3f1   Ilyes Choubani   Debugging some er...
2771
                            
0068116a   Ilyes Choubani   General update + ...
2772
                            xx=((*(*!dustem_data).uext).wav)[idx_spec]
5f04fa07   Ilyes Choubani   general update
2773
                            yy=dustem_interp[idx_spec]
0068116a   Ilyes Choubani   General update + ...
2774
                            rms=3.*((*(*!dustem_data).uext).sigma)(idx_spec)/2.
f2caf3f1   Ilyes Choubani   Debugging some er...
2775
2776
2777
                            
                            indzero = where(yy NE 0, ct_zero)
                            If ct_zero NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2778
2779
                                cgoplot,(1/xx)[indzero],(((*(*!dustem_data).uext).values)(idx_spec))[indzero]/yy[indzero],pos=position,psym=16,color='Powder Blue',syms=0.8,noerase=1 
                                cgerrplot,(1/((*(*!dustem_data).uext).wav)(idx_spec))[indzero],((((*(*!dustem_data).uext).values)[idx_spec])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).uext).values)[idx_spec])[indzero]+rms[indzero])/yy[indzero],color='Powder Blue'
f2caf3f1   Ilyes Choubani   Debugging some er...
2780
                            ENDIF
18e4331f   Ilyes Choubani   general update (f...
2781
2782
2783
2784
                        ENDIF
                        
                        IF ct_filt NE 0 THEN BEGIN
                            ;stop
0068116a   Ilyes Choubani   General update + ...
2785
                            xx=((*(*!dustem_data).uext).wav)[idx_filt]
5f04fa07   Ilyes Choubani   general update
2786
                            yy=dustem_interp[idx_filt]
0068116a   Ilyes Choubani   General update + ...
2787
                            rms=3.*((*(*!dustem_data).uext).sigma)(idx_filt)/2. 
f2caf3f1   Ilyes Choubani   Debugging some er...
2788
2789
                            indzero = where(yy NE 0, ct_zero)
                            IF ct_zero NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2790
2791
                                cgoplot,(1/xx)[indzero],(((*(*!dustem_data).uext).values)(idx_filt))[indzero]/yy[indzero],pos=position,psym=16,color='Dodger Blue',syms=0.8,noerase=1 
                                cgerrplot,(1/((*(*!dustem_data).uext).wav)(idx_filt))[indzero],((((*(*!dustem_data).uext).values)[idx_filt])[indzero]-rms[indzero])/yy[indzero],((((*(*!dustem_data).uext).values)[idx_filt])[indzero]+rms[indzero])/yy[indzero],color='Dodger Blue' 
f2caf3f1   Ilyes Choubani   Debugging some er...
2792
                            ENDIF
18e4331f   Ilyes Choubani   general update (f...
2793
2794
2795
2796
2797
                        ENDIF
      
                        
                    endif else begin ;The data points in the plot that remain unchanged
                        ;stop
1bc09467   Ilyes Choubani   fixed issue with ...
2798
                        
f2caf3f1   Ilyes Choubani   Debugging some er...
2799
                        xtit=textoidl('1/\lambda (\mum^{-1})')
1355825c   Ilyes Choubani   General update
2800
                        ;if !run_pol then xtit = ''
afde94a3   Ilyes Choubani   general update
2801
                        cgplot,1/vectw,vectx,/xlog,/ys,xs=1,pos=position,noerase=1,color='Black',xr=xr,xtit=xtit,yr=[0.0,2.0],yticks=2,ymino=2,xticklen=0.1,ytickformat='(F6.2)',charsize=1.0
67bd858a   Ilyes Choubani   Replication of th...
2802
                        xyouts,pospltxt[0],pospltxt[1],textoidl('norm'),color=0,/normal,charsize=1.1
18e4331f   Ilyes Choubani   general update (f...
2803
2804
2805
2806
                    
                    endelse
                    
                
67bd858a   Ilyes Choubani   Replication of th...
2807
                endif else begin ; normal plot - STOPPED HERE FOR QSED
18e4331f   Ilyes Choubani   general update (f...
2808
2809
                              
                    if keyword_set(refresh) then begin ;The data points in the plot are being refreshed
53548c91   Ilyes Choubani   Display of frozen...
2810
                        
18e4331f   Ilyes Choubani   general update (f...
2811
2812
                        if keyword_set(positive_only) then begin
     
2df3360b   Ilyes Choubani   Correcting error:...
2813
                            if testpstv ne 0 then begin
f2caf3f1   Ilyes Choubani   Debugging some er...
2814
                                
18e4331f   Ilyes Choubani   general update (f...
2815
                                FOR i=0L,Ngrains-1 DO BEGIN
07372e26   Ilyes Choubani   Corrected huge pl...
2816
2817
2818
                                
                                    vecto = transpose(((st.polext.(1))[i,*]+(st.polext.(2))[i,*]))
                                    vecte = transpose(((st.ext.(1))[i,*]+(st.ext.(2))[i,*]))
5f04fa07   Ilyes Choubani   general update
2819
                                    
07372e26   Ilyes Choubani   Corrected huge pl...
2820
                                    testneq = where( vecto ne 0,countneq)
67bd858a   Ilyes Choubani   Replication of th...
2821
                                    ;stop
5f04fa07   Ilyes Choubani   general update
2822
                                    if countneq ne 0 then begin 
07372e26   Ilyes Choubani   Corrected huge pl...
2823
                                        vecfin = vecto*0.0 ;em_tot can be used here right? 
67bd858a   Ilyes Choubani   Replication of th...
2824
                                        ;stop
07372e26   Ilyes Choubani   Corrected huge pl...
2825
                                        vecfin[testneq] = (vecto[testneq])/vecte[testneq];extra_spec[testneq];(st.sed.em_tot)[testneq];(st.sed.(i+1))[testneq];*fact;(st.sed.(i+1))[testneq]
67bd858a   Ilyes Choubani   Replication of th...
2826
2827
                                        ;stop
                                        ;polar_ippsi2iqu,st.sed.(i+1)*fact,specqgrain,specugrain,st.polsed.(i+1)*fact/spec,replicate(!dustem_psi,n_elements(spec)) ;temporary solution
07372e26   Ilyes Choubani   Corrected huge pl...
2828
                                        polar_ippsi2iqu,vecte*(*!dustem_HCD)/1.0e21,specqgrain,specugrain,vecfin,replicate(!dustem_psi_ext,n_elements(vecfin)) ;temporary solution
5f04fa07   Ilyes Choubani   general update
2829
                                        
67bd858a   Ilyes Choubani   Replication of th...
2830
                                        ;stop
5f04fa07   Ilyes Choubani   general update
2831
                                        ;dustem_plot_mlog,st.polsed.wav,specqgrain,ppositions=position,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog 
1bc09467   Ilyes Choubani   fixed issue with ...
2832
                                        dustem_plot_mlog,1/st.polext.wav,specugrain,ppositions=position,/positive_only,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
67bd858a   Ilyes Choubani   Replication of th...
2833
2834
                                        ;stop
                                    endif
5f04fa07   Ilyes Choubani   general update
2835
                                    ;stop
18e4331f   Ilyes Choubani   general update (f...
2836
                                ENDFOR
67bd858a   Ilyes Choubani   Replication of th...
2837
                                
18e4331f   Ilyes Choubani   general update (f...
2838
                                for i=0L,n_plgns-1 do begin
3c479f24   Ilyes Choubani   Allowing to fix p...
2839
2840
                                    
                                    IF isa((*!dustem_plugin).(0).spec) THEN BEGIN
67bd858a   Ilyes Choubani   Replication of th...
2841
2842
                                        IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLEXT') THEN begin
                                         
3c479f24   Ilyes Choubani   Allowing to fix p...
2843
                                            ;dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i))[*,1],ppositions=position, /overplot, noerase=1, color=clrs_plgns[i], linestyle=2,xr=xr,/xlog
1bc09467   Ilyes Choubani   fixed issue with ...
2844
                                            dustem_plot_mlog,1/st.polext.wav,(*(*!dustem_plugin).(i).spec)[*,2],ppositions=position,/positive_only,/overplot,noerase=1, color=clrs_plgns[i], linestyle=2 ,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr      
3c479f24   Ilyes Choubani   Allowing to fix p...
2845
                                        ENDIF
18e4331f   Ilyes Choubani   general update (f...
2846
                                    ENDIF
18e4331f   Ilyes Choubani   general update (f...
2847
2848
2849
                                endfor
                                
                                IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2850
                                    xx=((*(*!dustem_data).uext).wav)[idx_spec]
5f04fa07   Ilyes Choubani   general update
2851
                                    yy=dustem_interp[idx_spec]
18e4331f   Ilyes Choubani   general update (f...
2852
                                    ;dustem_plot_mlog,xx,yy,ppositions=position,/overplot, noerase=1, color='red',psym=7,syms=2,xr=xr,/xlog
1bc09467   Ilyes Choubani   fixed issue with ...
2853
                                    dustem_plot_mlog,1/xx,yy,ppositions=position,/positive_only, /overplot, noerase=1, color='Indian Red',psym=7,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr 
18e4331f   Ilyes Choubani   general update (f...
2854
2855
2856
                                ENDIF
                                
                                IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2857
                                    xx=((*(*!dustem_data).uext).wav)[idx_filt]
5f04fa07   Ilyes Choubani   general update
2858
                                    yy=dustem_interp[idx_filt]
18e4331f   Ilyes Choubani   general update (f...
2859
                                    ;dustem_plot_mlog,xx,yy,ppositions=position, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog
1bc09467   Ilyes Choubani   fixed issue with ...
2860
                                    dustem_plot_mlog,1/xx,yy,ppositions=position,/positive_only, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
18e4331f   Ilyes Choubani   general update (f...
2861
2862
                                ENDIF
                                
1bc09467   Ilyes Choubani   fixed issue with ...
2863
                                dustem_plot_mlog,1/st.polext.wav,dustem_spec,ppositions=position,/positive_only,/overplot,noerase=1,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr                                    
18e4331f   Ilyes Choubani   general update (f...
2864
2865
2866
2867
2868
2869
                            
                            endif
                                    
                        
                        endif
                        
67bd858a   Ilyes Choubani   Replication of th...
2870
                        ;stop
18e4331f   Ilyes Choubani   general update (f...
2871
                        if keyword_set(negative_only) then begin
67bd858a   Ilyes Choubani   Replication of th...
2872
                            ;stop     
2df3360b   Ilyes Choubani   Correcting error:...
2873
                            if testngtv ne 0 then begin
c8368c6e   Ilyes Choubani   updating plotting...
2874
                            
f2caf3f1   Ilyes Choubani   Debugging some er...
2875
                                    
18e4331f   Ilyes Choubani   general update (f...
2876
2877
                                ;Plotting of the spectra of the dust species
                                FOR i=0L,Ngrains-1 DO BEGIN
07372e26   Ilyes Choubani   Corrected huge pl...
2878
2879
2880
                                    vecto = transpose(((st.polext.(1))[i,*]+(st.polext.(2))[i,*]))
                                    vecte = transpose(((st.ext.(1))[i,*]+(st.ext.(2))[i,*]))
                                    testneq = where( vecto ne 0,countneq)
67bd858a   Ilyes Choubani   Replication of th...
2881
2882
                                    ;stop
                                    if countneq ne 0 then begin 
07372e26   Ilyes Choubani   Corrected huge pl...
2883
                                        vecfin = vecto*0.0 ;em_tot can be used here right? 
67bd858a   Ilyes Choubani   Replication of th...
2884
                                        ;stop
07372e26   Ilyes Choubani   Corrected huge pl...
2885
                                        vecfin[testneq] = vecto[testneq]/vecte[testneq];extra_spec[testneq];(st.sed.em_tot)[testneq];(st.sed.(i+1))[testneq];*fact;(st.sed.(i+1))[testneq] 
67bd858a   Ilyes Choubani   Replication of th...
2886
                                        ;stop    
07372e26   Ilyes Choubani   Corrected huge pl...
2887
                                        polar_ippsi2iqu,vecte*(*!dustem_HCD)/1.0e21,specqgrain,specugrain,vecfin,replicate(!dustem_psi_ext,n_elements(vecfin)) ;temporary solution
67bd858a   Ilyes Choubani   Replication of th...
2888
                                        ;stop
5f04fa07   Ilyes Choubani   general update
2889
                                        ;dustem_plot_mlog,st.polsed.wav,specqgrain,ppositions=position,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog 
1bc09467   Ilyes Choubani   fixed issue with ...
2890
                                        dustem_plot_mlog,1/st.polext.wav,specugrain,ppositions=position,/negative_only,/overplot,noerase=1,color=use_cols[i],xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
67bd858a   Ilyes Choubani   Replication of th...
2891
                                    endif 
18e4331f   Ilyes Choubani   general update (f...
2892
2893
                                ENDFOR
                                ;Plotting of the plugins
67bd858a   Ilyes Choubani   Replication of th...
2894
                                for i=0L,n_plgns-1 do begin
3c479f24   Ilyes Choubani   Allowing to fix p...
2895
2896
                                    IF isa((*!dustem_plugin).(0).spec) THEN BEGIN
                                    
67bd858a   Ilyes Choubani   Replication of th...
2897
2898
                                        IF total(strsplit((*(*!dustem_plugin).(i).scope),'+',/extract) EQ 'ADD_POLEXT') THEN begin
     
3c479f24   Ilyes Choubani   Allowing to fix p...
2899
                                            ;dustem_plot_mlog,st.polsed.wav,(*(*!dustem_plugin).(i))[*,1],ppositions=position, /overplot, noerase=1, color=clrs_plgns[i], linestyle=2,xr=xr,/xlog
1bc09467   Ilyes Choubani   fixed issue with ...
2900
                                            dustem_plot_mlog,1/st.polext.wav,(*(*!dustem_plugin).(i).spec)[*,2],ppositions=position,/negative_only,/overplot,noerase=1, color=clrs_plgns[i], linestyle=2 ,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr      
3c479f24   Ilyes Choubani   Allowing to fix p...
2901
                                        ENDIF
67bd858a   Ilyes Choubani   Replication of th...
2902
                                        
18e4331f   Ilyes Choubani   general update (f...
2903
                                    ENDIF
67bd858a   Ilyes Choubani   Replication of th...
2904
                                endfor
18e4331f   Ilyes Choubani   general update (f...
2905
2906
                                ;PLotting of the interpolates corresponding to spectrum and filter points
                                IF ct_spec NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2907
                                    xx=((*(*!dustem_data).uext).wav)[idx_spec]
5f04fa07   Ilyes Choubani   general update
2908
                                    yy=dustem_interp[idx_spec]
18e4331f   Ilyes Choubani   general update (f...
2909
                                    ;dustem_plot_mlog,xx,yy,ppositions=position,/overplot, noerase=1, color='red',psym=7,syms=2,xr=xr,/xlog
1bc09467   Ilyes Choubani   fixed issue with ...
2910
                                    dustem_plot_mlog,1/xx,yy,ppositions=position,/negative_only, /overplot, noerase=1, color='Indian Red',psym=7,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr 
18e4331f   Ilyes Choubani   general update (f...
2911
2912
2913
                                ENDIF
                                
                                IF ct_filt NE 0 THEN BEGIN
0068116a   Ilyes Choubani   General update + ...
2914
                                    xx=((*(*!dustem_data).uext).wav)[idx_filt]
5f04fa07   Ilyes Choubani   general update
2915
                                    yy=dustem_interp[idx_filt]
18e4331f   Ilyes Choubani   general update (f...
2916
                                    ;dustem_plot_mlog,xx,yy,ppositions=position, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog
1bc09467   Ilyes Choubani   fixed issue with ...
2917
                                    dustem_plot_mlog,1/xx,yy,ppositions=position,/negative_only, /overplot, noerase=1, color='red',psym=6,syms=2,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr
18e4331f   Ilyes Choubani   general update (f...
2918
                                ENDIF
18e4331f   Ilyes Choubani   general update (f...
2919
                                ;Plotting of the total dust emission spectrum
1bc09467   Ilyes Choubani   fixed issue with ...
2920
                                dustem_plot_mlog,1/st.polext.wav,dustem_spec,ppositions=position,/negative_only,/overplot,noerase=1,xr=xr,/xlog,/ylog,ytickformat='(A1)',yr=yr                                    
bc224f3e   Ilyes Choubani   Update of plottin...
2921
                            
18e4331f   Ilyes Choubani   general update (f...
2922
2923
                            endif
                                    
bc224f3e   Ilyes Choubani   Update of plottin...
2924
2925
                        
                        endif
18e4331f   Ilyes Choubani   general update (f...
2926
2927
                                                   
                      ;stop             
67bd858a   Ilyes Choubani   Replication of th...
2928
                    endif else begin ;The data points in the plot that remain unchanged.; DO NOT USE AN ELSE HERE. 
bc224f3e   Ilyes Choubani   Update of plottin...
2929
                        ;stop
18e4331f   Ilyes Choubani   general update (f...
2930
                        ;cgaxis, xaxis=1,xlog=1, xs=1,charsize=1.5,xtickformat='(A1)'
94c4dffa   Ilyes Choubani   update + fixes fo...
2931
                        xyouts,pospltxt[0],pospltxt[1],textoidl('\tau_{UEXT}'),color=0,/normal,charsize=1.3;,charthick=2.0  
2df3360b   Ilyes Choubani   Correcting error:...
2932
                        ;if ct_hdnpts ne 0 then begin ;Hidden data points are present 
67bd858a   Ilyes Choubani   Replication of th...
2933
                            
2df3360b   Ilyes Choubani   Correcting error:...
2934
2935
                        ;Locating the hidden spectrum and filter data points     
                        ;SADLY I STILL DON'T HAVE A SOLUTION FOR THE PLOTTING OF NULL VALUES.                                   
0068116a   Ilyes Choubani   General update + ...
2936
2937
                        ;idx_filt_hdn = where(((*(*!dustem_show).qsed).filt_names)(idx_rmv_sed) NE 'SPECTRUM',ct_filt_hdn)
                        ;idx_spec_hdn = where(((*(*!dustem_show).qsed).filt_names)(idx_rmv_sed) EQ 'SPECTRUM',ct_spec_hdn)
9cb38725   Ilyes Choubani   Fixed tests relat...
2938
                        if ct_hdnpts then begin
0068116a   Ilyes Choubani   General update + ...
2939
2940
2941
2942
                            idx_filt_hdn_pstv = where(((*(*!dustem_show).uext).filt_names)(idx_rmv_sed) NE 'SPECTRUM' and ((*(*!dustem_show).uext).values)(idx_rmv_sed) gt 0,ct_filt_hdn_pstv)
                            idx_spec_hdn_pstv = where(((*(*!dustem_show).uext).filt_names)(idx_rmv_sed) EQ 'SPECTRUM' and ((*(*!dustem_show).uext).values)(idx_rmv_sed) gt 0,ct_spec_hdn_pstv)
                            idx_filt_hdn_ngtv = where(((*(*!dustem_show).uext).filt_names)(idx_rmv_sed) NE 'SPECTRUM' and ((*(*!dustem_show).uext).values)(idx_rmv_sed) lt 0,ct_filt_hdn_ngtv)
                            idx_spec_hdn_ngtv = where(((*(*!dustem_show).uext).filt_names)(idx_rmv_sed) EQ 'SPECTRUM' and ((*(*!dustem_show).uext).values)(idx_rmv_sed) lt 0,ct_spec_hdn_ngtv)
9cb38725   Ilyes Choubani   Fixed tests relat...
2943
                        endif
67bd858a   Ilyes Choubani   Replication of th...
2944
                        
18e4331f   Ilyes Choubani   general update (f...
2945
2946
                        
                        if keyword_set(positive_only) then begin
f2caf3f1   Ilyes Choubani   Debugging some er...
2947
                            
67bd858a   Ilyes Choubani   Replication of th...
2948
2949
2950
2951
                                
                                
                                if ct_spec ne 0 then begin
                                
0068116a   Ilyes Choubani   General update + ...
2952
2953
2954
2955
                                    rms=3.*((*(*!dustem_data).uext).sigma)(idx_spec)/2.
                                    ;dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),-((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_spec),((*(*!dustem_data).uext).values)(idx_spec),ppositions=position,charsize=1.15,color='Powder Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_spec),((*(*!dustem_data).uext).values)(idx_spec),ppositions=position,color='Powder Blue',/positive_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,psym=16,syms=0.8,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)'     
67bd858a   Ilyes Choubani   Replication of th...
2956
2957
2958
2959
2960
                                 
                                endif
                                
                                if ct_filt ne 0 then begin
                                    
0068116a   Ilyes Choubani   General update + ...
2961
2962
2963
2964
2965
                                    rms=3.*((*(*!dustem_data).uext).sigma)(idx_filt)/2.
                                   ; dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),-1.*((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    if ct_spec ne 0 then dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_filt),((*(*!dustem_data).uext).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                    if ct_spec eq 0 then dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_filt),((*(*!dustem_data).uext).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_filt),((*(*!dustem_data).uext).values)(idx_filt),ppositions=position,color='Dodger Blue',/positive_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,psym=16,syms=0.8,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)'
67bd858a   Ilyes Choubani   Replication of th...
2966
2967
                                        
                                endif
74103816   Ilyes Choubani   small update
2968
2969
2970
2971
2972
2973
2974
2975
2976
                                
                                
                                if testpstv ne 0 then begin
                                
                                    plotsym, 0
                                    
                                    if ct_hdnpts NE 0 then begin
                                    
                                        if ct_spec_hdn_pstv ne 0 then begin
0068116a   Ilyes Choubani   General update + ...
2977
2978
2979
                                            xx = (((*(*!dustem_show).uext).wav)[idx_rmv_sed])(idx_spec_hdn_pstv)
                                            yy = (((*(*!dustem_show).uext).values)[idx_rmv_sed])(idx_spec_hdn_pstv)
                                            rms=3.*(((*(*!dustem_show).uext).sigma)[idx_rmv_sed])(idx_spec_hdn_pstv)/2.
74103816   Ilyes Choubani   small update
2980
2981
2982
2983
2984
2985
2986
2987
                                            
                                            dustem_plot_mlog,1/xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr
                                            dustem_plot_mlog,1/xx,yy,ppositions=position,/positive_only,noerase=1,color='Black',/overplot,rms=rms,yr=yr,xtickformat='(A1)',xr=xr,xs=1,/xlog,/ylog;,psym=8,syms=0.8
                                        
                                        endif 
                                        
                                        if ct_filt_hdn_pstv ne 0 then begin
                                        
0068116a   Ilyes Choubani   General update + ...
2988
2989
2990
                                            xx = (((*(*!dustem_show).uext).wav)[idx_rmv_sed])(idx_filt_hdn_pstv)
                                            yy = (((*(*!dustem_show).uext).values)[idx_rmv_sed])(idx_filt_hdn_pstv)
                                            rms=3.*(((*(*!dustem_show).uext).sigma)[idx_rmv_sed])(idx_filt_hdn_pstv)/2.
74103816   Ilyes Choubani   small update
2991
2992
2993
2994
2995
2996
2997
                                            
                                            dustem_plot_mlog,1/xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr   
                                            dustem_plot_mlog,1/xx,yy,ppositions=position,/positive_only,xs=1,noerase=1,color='Black',/overplot,rms=rms,xr=xr,yr=yr,xtickformat='(A1)',/xlog,/ylog;,psym=8,syms=0.8
                                        
                                        endif
                                        
                                    endif
2df3360b   Ilyes Choubani   Correcting error:...
2998
                            endif else begin
f2caf3f1   Ilyes Choubani   Debugging some er...
2999
                                
0068116a   Ilyes Choubani   General update + ...
3000
                                if ct_spec ne 0 then dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_spec),((*(*!dustem_data).uext).values)(idx_spec),ppositions=position,charsize=1.15,/nodata,color='Powder Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
18e4331f   Ilyes Choubani   general update (f...
3001
                                    
1bc09467   Ilyes Choubani   fixed issue with ...
3002
                                
0068116a   Ilyes Choubani   General update + ...
3003
                                if ct_filt ne 0 and ct_spec eq 0 then  dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_filt),-((*(*!dustem_data).uext).values)(idx_filt),/nodata,ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/positive_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
f2caf3f1   Ilyes Choubani   Debugging some er...
3004
                                   
07372e26   Ilyes Choubani   Corrected huge pl...
3005
                                
67bd858a   Ilyes Choubani   Replication of th...
3006
                            endelse                           
18e4331f   Ilyes Choubani   general update (f...
3007
                        
f2caf3f1   Ilyes Choubani   Debugging some er...
3008
                        
18e4331f   Ilyes Choubani   general update (f...
3009
3010
                        endif 
                        
67bd858a   Ilyes Choubani   Replication of th...
3011
                        
18e4331f   Ilyes Choubani   general update (f...
3012
                        if keyword_set(negative_only) then begin
67bd858a   Ilyes Choubani   Replication of th...
3013
                            
2df3360b   Ilyes Choubani   Correcting error:...
3014
                            if testngtv ne 0 then begin
18e4331f   Ilyes Choubani   general update (f...
3015
                                 
74103816   Ilyes Choubani   small update
3016
                                 plotsym, 0
18e4331f   Ilyes Choubani   general update (f...
3017
                                 
18e4331f   Ilyes Choubani   general update (f...
3018
                                 
67bd858a   Ilyes Choubani   Replication of th...
3019
                                 if ct_spec ne 0 then begin
f2caf3f1   Ilyes Choubani   Debugging some er...
3020
                                     
0068116a   Ilyes Choubani   General update + ...
3021
3022
3023
3024
                                     rms=3.*((*(*!dustem_data).uext).sigma)(idx_spec)/2.
                                     ;dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),-((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                    ; if ct_spec_hdn_ngtv ne 0 then dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_spec),((*(*!dustem_data).qsed).values)(idx_spec),ppositions=position,/overplot,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr else begin
                                     dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_spec),((*(*!dustem_data).uext).values)(idx_spec),ppositions=position,charsize=1.15,color='Powder Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
67bd858a   Ilyes Choubani   Replication of th...
3025
                                     ;endelse;,ytickformat='(A1)'
0068116a   Ilyes Choubani   General update + ...
3026
                                     dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_spec),((*(*!dustem_data).uext).values)(idx_spec),ppositions=position,color='Powder Blue',/negative_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)';,psym=16,syms=0.8     
67bd858a   Ilyes Choubani   Replication of th...
3027
3028
3029
3030
3031
                                  
                                 endif
                                 
                                 if ct_filt ne 0 then begin
                                     
0068116a   Ilyes Choubani   General update + ...
3032
3033
3034
3035
3036
                                     rms=3.*((*(*!dustem_data).uext).sigma)(idx_filt)/2.
                                    ; dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),-1.*((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,/nodata,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
                                     ;if ct_filt_hdn_ngtv ne 0 then  dustem_plot_mlog,((*(*!dustem_data).qsed).wav)(idx_filt),((*(*!dustem_data).qsed).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',/overplot,psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr else begin
                                     if ct_spec ne 0 then dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_filt),((*(*!dustem_data).uext).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr,ytickformat='(A1)'
                                     if ct_spec eq 0 then dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_filt),((*(*!dustem_data).uext).values)(idx_filt),ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
67bd858a   Ilyes Choubani   Replication of th...
3037
3038
                                     ;endelse ;,ytickformat='(A1)'
                                     
0068116a   Ilyes Choubani   General update + ...
3039
                                     dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_filt),((*(*!dustem_data).uext).values)(idx_filt),ppositions=position,color='Dodger Blue',/negative_only,noerase=1,/overplot,rms=rms,xtit='',charsize=1.15,xtickformat='(A1)',xs=1,xr=xr,/xlog,/ylog,yr=yr,ytickformat='(A1)'
67bd858a   Ilyes Choubani   Replication of th...
3040
                                         
9cb38725   Ilyes Choubani   Fixed tests relat...
3041
                                 endif 
74103816   Ilyes Choubani   small update
3042
3043
3044
3045
                                 
                                 if ct_hdnpts NE 0 then begin
                                 
                                     if ct_spec_hdn_ngtv ne 0 then begin
0068116a   Ilyes Choubani   General update + ...
3046
3047
3048
                                         xx = (((*(*!dustem_show).uext).wav)[idx_rmv_sed])(idx_spec_hdn_ngtv)
                                         yy = (((*(*!dustem_show).uext).values)[idx_rmv_sed])(idx_spec_hdn_ngtv)
                                         rms=3.*(((*(*!dustem_show).uext).sigma)[idx_rmv_sed])(idx_spec_hdn_ngtv)/2.
74103816   Ilyes Choubani   small update
3049
3050
3051
3052
3053
3054
3055
3056
                                         
                                         dustem_plot_mlog,1/xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr
                                         dustem_plot_mlog,1/xx,yy,ppositions=position,/negative_only,noerase=1,color='Black',/overplot,rms=rms,yr=yr,xtickformat='(A1)',xr=xr,xs=1,/xlog,/ylog;,psym=8,syms=0.8
                                     
                                     endif 
                                     
                                     if ct_filt_hdn_ngtv ne 0 then begin
                                     
0068116a   Ilyes Choubani   General update + ...
3057
3058
3059
                                         xx = (((*(*!dustem_show).uext).wav)[idx_rmv_sed])(idx_filt_hdn_ngtv)
                                         yy = (((*(*!dustem_show).uext).values)[idx_rmv_sed])(idx_filt_hdn_ngtv)
                                         rms=3.*(((*(*!dustem_show).uext).sigma)[idx_rmv_sed])(idx_filt_hdn_ngtv)/2.
74103816   Ilyes Choubani   small update
3060
3061
3062
3063
3064
3065
3066
                                         
                                         dustem_plot_mlog,1/xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,charsize=1.15,/overplot,xtickformat='(A1)',xr=xr,color='Black',psym=16,syms=0.8,/xlog,/ylog,yr=yr   
                                         dustem_plot_mlog,1/xx,yy,ppositions=position,/negative_only,xs=1,noerase=1,color='Black',/overplot,rms=rms,xr=xr,yr=yr,xtickformat='(A1)',/xlog,/ylog;,psym=8,syms=0.8
                                     
                                     endif
                                
                                 endif
bc224f3e   Ilyes Choubani   Update of plottin...
3067
                            
2df3360b   Ilyes Choubani   Correcting error:...
3068
                            endif else begin
f2caf3f1   Ilyes Choubani   Debugging some er...
3069
                                
0068116a   Ilyes Choubani   General update + ...
3070
                                if ct_spec ne 0 then dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_spec),-((*(*!dustem_data).uext).values)(idx_spec),ppositions=position,charsize=1.15,/nodata,color='Powder Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
1bc09467   Ilyes Choubani   fixed issue with ...
3071
                                    
18e4331f   Ilyes Choubani   general update (f...
3072
                                
0068116a   Ilyes Choubani   General update + ...
3073
                                if ct_filt ne 0 and ct_spec eq 0 then  dustem_plot_mlog,1/((*(*!dustem_data).uext).wav)(idx_filt),-((*(*!dustem_data).uext).values)(idx_filt),/nodata,ppositions=position,charsize=1.15,color='Dodger Blue',psym=16,syms=0.8,xs=1,xr=xr,noerase=1,/negative_only,xtickformat='(A1)',xtit='',/xlog,/ylog,yr=yr;,ytickformat='(A1)'
07372e26   Ilyes Choubani   Corrected huge pl...
3074
                                
f2caf3f1   Ilyes Choubani   Debugging some er...
3075
                        
2df3360b   Ilyes Choubani   Correcting error:...
3076
                            endelse
5f04fa07   Ilyes Choubani   general update
3077
                            ;stop
18e4331f   Ilyes Choubani   general update (f...
3078
                        endif
bc224f3e   Ilyes Choubani   Update of plottin...
3079
3080
3081
3082
                        
                    
                    endelse 
                
bc224f3e   Ilyes Choubani   Update of plottin...
3083
3084
                endelse 
            
67bd858a   Ilyes Choubani   Replication of th...
3085
            endelse 
b5314324   Ilyes Choubani   updating the plot...
3086
3087
        
        end
5f04fa07   Ilyes Choubani   general update
3088
3089
        
        'PARAMETERS':begin ;needs the followingd data (errors+res+formats)
e9bb0ce2   Ilyes Choubani   Correcting small ...
3090
         
5f04fa07   Ilyes Choubani   general update
3091
3092
3093
3094
3095
            p_dim = extra_spec
            ;stop
            Npar=n_elements(p_dim)
            
            if keyword_set(refresh) then begin ;data in the parameter window that is being refreshed
53548c91   Ilyes Choubani   Display of frozen...
3096
    
5f04fa07   Ilyes Choubani   general update
3097
                k=0    
5f04fa07   Ilyes Choubani   general update
3098
                
53548c91   Ilyes Choubani   Display of frozen...
3099
3100
3101
3102
3103
3104
3105
                    
                IF isa((*!dustem_fit).fixed_param_descs) THEN BEGIN
                    
                    Nfpar = n_elements((*(*!dustem_fit).fixed_param_descs))
                    res = (*(*!dustem_fit).fixed_param_init_values)
                    
                    FOR i=0L,Nfpar-1 DO BEGIN
5f04fa07   Ilyes Choubani   general update
3106
                        
53548c91   Ilyes Choubani   Display of frozen...
3107
3108
3109
3110
3111
3112
3113
                        parameter_description = (*(*!dustem_fit).fixed_param_descs)[i]     
                        parameter_type = dustem_parameter_description2type(parameter_description,string_name=string_name)
                        ;Not sure about the wrapper data type that is mentioned in this procedure
                        IF parameter_type NE 'PLUGIN' THEN BEGIN                       
                            yypos = 0.8 - k*0.09
                            k+=1
                        ENDIF 
5f04fa07   Ilyes Choubani   general update
3114
                        
53548c91   Ilyes Choubani   Display of frozen...
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
                    ENDFOR  
                                
                     
                ENDIF
                
                
                prms_dscs = (*(*!dustem_fit).param_descs)
                prms_tps = strarr(n_elements(prms_dscs))
                
                for i=0L,n_elements(prms_dscs)-1 do begin
                    prms_tps[i] = dustem_parameter_description2type(prms_dscs[i])
                endfor
                
                testprms = where(prms_tps ne 'PLUGIN', ct_data)
                if ct_data ne 0 then begin
                
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
3131
                    if ~isa(yypos) then yypos = 0.8 else yypos-=0.22 ;not sure about this
fcb6eade   Ilyes Choubani   general update - ...
3132
3133
                    
                    
53548c91   Ilyes Choubani   Display of frozen...
3134
3135
3136
3137
3138
                    res = dustem_interp
                    errors = dustem_spec
                    yypostmp = yypos
                    k=0
                    FOR i=0L,Npar-1 DO BEGIN   
fcb6eade   Ilyes Choubani   general update - ...
3139
                      
53548c91   Ilyes Choubani   Display of frozen...
3140
3141
3142
3143
3144
                      parameter_description = (*(*!dustem_fit).param_descs)[i]
                      parameter_type = dustem_parameter_description2type(parameter_description,string_name=string_name)
                      testpop = STRUPCASE(strmid(strtrim(parameter_description,2),3,1,/reverse_offset)) EQ 'O'
                          
                        IF parameter_type EQ 'FORTRAN' and  testpop then begin
fcb6eade   Ilyes Choubani   general update - ...
3145
                          
53548c91   Ilyes Choubani   Display of frozen...
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
                            indpop=fix(STRUPCASE(strmid(strtrim(parameter_description,2),12,1,/reverse_offset)))
                            string_name=(((*!dustem_params). GRAINS).grain_type)[indpop]
                            
                            ;choosing a step of 0.03 in norm coordinates 
                            yypos = yypostmp - k*0.09 
                            xxpos = 0.0
                            
                            ;original line
                            ;str=string(string_name+' = ',format=frmt0)+string(res[i],format=frmt1)
                            
                            str = strtrim(string(string_name+' = ',format=frmt0),2)+ string(res[i],format=frmt1) + textoidl(' \pm ') +string(errors(i),format=frmt1)
                            ;will this work? 
                            cgtext, xxpos, yypos, str, charsize=-1, width=thiswidth, /normal
                            xxpos = (1-thiswidth)/2
                            str = strtrim(string(string_name+' = ',format=frmt0),2)
                            cgtext, xxpos, yypos, str, charsize=-1, width=thiswidth, /normal
                            xxpos+= thiswidth 
                            
                            str= string(res[i],format=frmt1) + textoidl(' \pm ') + string(errors(i),format=frmt1)
                            ;stop
                            xyouts,xxpos,yypos,str,color=0,/normal,charsize=1.
                            k+=1            
                            
                        ENDIF
e9bb0ce2   Ilyes Choubani   Correcting small ...
3170
                        
fcb6eade   Ilyes Choubani   general update - ...
3171
                        
53548c91   Ilyes Choubani   Display of frozen...
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
                        IF parameter_type EQ 'FORTRAN' and ~testpop then begin
                          
                            ;indpop=fix(STRUPCASE(strmid(strtrim(parameter_description,2),12,1,/reverse_offset)))
                            ;string_name=(((*!dustem_params). GRAINS).grain_type)[indpop]
                              
                            
                            yypos = yypostmp - k*0.09 
                            xxpos = 0.0
                            
                            ;original line
                            ;str=string(string_name+' = ',format=frmt0)+string(res[i],format=frmt1)
                            
                            str = strtrim(string(string_name+' = ',format=frmt0),2)+ string(res[i],format=frmt1) + textoidl(' \pm ') +string(errors(i),format=frmt1)
                            ;will this work? 
                            cgtext, xxpos, yypos, str, charsize=-1, width=thiswidth, /normal
                            xxpos = (1-thiswidth)/2
                            str = strtrim(string(string_name+' = ',format=frmt0),2)
                            cgtext, xxpos, yypos, str, charsize=-1, width=thiswidth, /normal
                            xxpos+= thiswidth 
                            
                            str= string(res[i],format=frmt1) + textoidl(' \pm ') + string(errors(i),format=frmt1)
                            ;stop
                            xyouts,xxpos,yypos,str,color=0,/normal,charsize=1.
                            k+=1            
                            
                        ENDIF
fcb6eade   Ilyes Choubani   general update - ...
3198
                        
fcb6eade   Ilyes Choubani   general update - ...
3199
                        
53548c91   Ilyes Choubani   Display of frozen...
3200
                    ENDFOR        
fcb6eade   Ilyes Choubani   general update - ...
3201
                    
53548c91   Ilyes Choubani   Display of frozen...
3202
                ENDIF                        
5f04fa07   Ilyes Choubani   general update
3203
3204
                
            endif else begin ;data in the parameter window that is unchanged 
e9bb0ce2   Ilyes Choubani   Correcting small ...
3205
                
e9bb0ce2   Ilyes Choubani   Correcting small ...
3206
3207
3208
                ;Trying to gather information on the fixed parameters
                ;Two pointers assuming one is sufficient for the following condition (unless dustem_init_fixed_parameters)
                ;WILL THIS WORK?
53548c91   Ilyes Choubani   Display of frozen...
3209
                
e9bb0ce2   Ilyes Choubani   Correcting small ...
3210
3211
3212
3213
3214
                IF isa((*!dustem_fit).fixed_param_descs) THEN BEGIN
                    
                    Nfpar = n_elements((*(*!dustem_fit).fixed_param_descs))
                    res = (*(*!dustem_fit).fixed_param_init_values)
                    k = 0
53548c91   Ilyes Choubani   Display of frozen...
3215
3216
3217
3218
3219
                    xxpos = 0.0
                    yypos = 0.9
                    ;xxpos = 0.0 ;might need to be modified
                    cgtext, xxpos, yypos, '-FROZEN-', charsize=-1, width=thiswidth, /normal  
                    xxpos=(1-thiswidth)/2
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
3220
                    xyouts, xxpos, yypos, '-FROZEN-', charsize=1.2, /normal, color=0
e9bb0ce2   Ilyes Choubani   Correcting small ...
3221
3222
3223
3224
3225
                    
                    FOR i=0L,Nfpar-1 DO BEGIN
                        
                        parameter_description = (*(*!dustem_fit).fixed_param_descs)[i]     
                        parameter_type = dustem_parameter_description2type(parameter_description,string_name=string_name)
53548c91   Ilyes Choubani   Display of frozen...
3226
3227
3228
3229
3230
3231
3232
3233
3234
                        testpop = STRUPCASE(strmid(strtrim(parameter_description,2),3,1,/reverse_offset)) EQ 'O'
                        IF parameter_type NE 'PLUGIN' THEN BEGIN
                        
                            IF  parameter_type EQ 'FORTRAN' and  testpop then begin
                                 
                                indpop=fix(STRUPCASE(strmid(strtrim(parameter_description,2),12,1,/reverse_offset)))
                                string_name=(((*!dustem_params). GRAINS).grain_type)[indpop]
                                
                            ENDIF
e9bb0ce2   Ilyes Choubani   Correcting small ...
3235
                            
53548c91   Ilyes Choubani   Display of frozen...
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
                            yypos = 0.8 - k*0.09
                            xxpos = 0.0  
                            
                            str=strtrim(string(string_name+' = ',format=frmt0),2)
                            str1=str+string(res[i],format=frmt1)
                            cgtext, xxpos, yypos, str1, charsize=-1, width=thiswidth, /normal
                            xxpos=(1-thiswidth)/2 
                            ;stop
                            xyouts,xxpos,yypos,str1,color=0,/normal,charsize=1.
                            k+=1
e9bb0ce2   Ilyes Choubani   Correcting small ...
3246
                        
53548c91   Ilyes Choubani   Display of frozen...
3247
                        ENDIF    
e9bb0ce2   Ilyes Choubani   Correcting small ...
3248
                         
53548c91   Ilyes Choubani   Display of frozen...
3249
                    ENDFOR  
e9bb0ce2   Ilyes Choubani   Correcting small ...
3250
3251
3252
3253
                     
                ENDIF
                
                
e9bb0ce2   Ilyes Choubani   Correcting small ...
3254
                
5f04fa07   Ilyes Choubani   general update
3255
                ;stop
0c487640   Ilyes Choubani   corrected missing...
3256
                xxpos = 0.0;might need to be modified
53548c91   Ilyes Choubani   Display of frozen...
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
                
                ;test so that this string isn't displayed when there are no free parameters: 
                
                prms_dscs = (*(*!dustem_fit).param_descs)
                prms_tps = strarr(n_elements(prms_dscs))
                
                for i=0L,n_elements(prms_dscs)-1 do begin
                    prms_tps[i] = dustem_parameter_description2type(prms_dscs[i])
                endfor
                
                testprms = where(prms_tps ne 'PLUGIN', ct_data)
                
                IF ct_data ne 0 then begin
                
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
3271
                    if ~isa(yypos) then yypos = 0.9 else yypos-=0.1*1.2 ;not sure about this
53548c91   Ilyes Choubani   Display of frozen...
3272
3273
3274
3275
                
                    cgtext, xxpos, yypos, '-FREE-', charsize=-1,width=thiswidth, /normal

                    xxpos=(1-thiswidth)/2
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
3276
                    xyouts, xxpos, yypos, '-FREE-', charsize=1.2, /normal,color=0
53548c91   Ilyes Choubani   Display of frozen...
3277
3278
3279
3280
3281
                
                    ;stop
                    k=0   
                    res = dustem_interp
                    errors = dustem_spec
5f04fa07   Ilyes Choubani   general update
3282
                ;stop
53548c91   Ilyes Choubani   Display of frozen...
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
                
                    yypos-=0.1
                    yypostmp = yypos
                    FOR i=0L,Npar-1 DO BEGIN  
                      
                      parameter_description = (*(*!dustem_fit).param_descs)[i]
                      parameter_type = dustem_parameter_description2type(parameter_description,string_name=string_name)
                      testpop = STRUPCASE(strmid(strtrim(parameter_description,2),3,1,/reverse_offset)) EQ 'O'
                      ;stop  
                      ;STRUPCASE(strmid(strtrim(parameter_description,2),0,18)) eq '(*!DUSTEM_PARAMS).'  
e9bb0ce2   Ilyes Choubani   Correcting small ...
3293
                        
53548c91   Ilyes Choubani   Display of frozen...
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
                      IF  parameter_type EQ 'FORTRAN' and testpop then begin
                             
                            indpop=fix(STRUPCASE(strmid(strtrim(parameter_description,2),12,1,/reverse_offset)))
                            string_name=(((*!dustem_params). GRAINS).grain_type)[indpop]
                            
                            
                            yypos = yypostmp -  k*0.09
                            xxpos = 0.0    
                                                        
                            str=strtrim(string(string_name+' = ',format=frmt0),2)
                            ;stop    
                            str1=str+string(res[i],format=frmt1)+textoidl(' \pm ')+string(errors(i),format=frmt1)
                            ;stop
                            cgtext, xxpos, yypos, str1, charsize=-1, width=thiswidth, /normal
                            xxpos=(1-thiswidth)/2 
                            ;stop
                            xyouts,xxpos,yypos,str,color=0,/normal,charsize=1.
                            
                            k+=1            
                            ;stop
                      ENDIF
                      
                      ;STRUPCASE(strmid(strtrim(parameter_description,2),0,18)) eq '(*!DUSTEM_PARAMS).'
                      IF  parameter_type EQ 'FORTRAN' and ~testpop then begin
5f04fa07   Ilyes Choubani   general update
3318
                        
53548c91   Ilyes Choubani   Display of frozen...
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
                          ;indpop=fix(STRUPCASE(strmid(strtrim(parameter_description,2),12,1,/reverse_offset)))
                          ;string_name=(((*!dustem_params). GRAINS).grain_type)[indpop]
                          ;stop
                          ;choosing a step of 0.03 in norm coordinates
                           
                          yypos = yypostmp - k*0.09
                          xxpos = 0.0    
                                                      
                          str=strtrim(string(string_name+' = ',format=frmt0),2)
                          ;stop    
                          str1=str+string(res[i],format=frmt1)+textoidl(' \pm ')+string(errors(i),format=frmt1)
                          ;stop
                          cgtext, xxpos, yypos, str1, charsize=-1, width=thiswidth, /normal
                          xxpos=(1-thiswidth)/2 
                          ;stop
                          xyouts,xxpos,yypos,str,color=0,/normal,charsize=1.
                          
                          k+=1            
                          ;stop
                    ENDIF
                    
                    ENDFOR
fcb6eade   Ilyes Choubani   general update - ...
3341
                    
fcb6eade   Ilyes Choubani   general update - ...
3342
                ENDIF
53548c91   Ilyes Choubani   Display of frozen...
3343
                    
5f04fa07   Ilyes Choubani   general update
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
                
            endelse
        
        end
        
        'PLUGINS':begin ;NOT SO SURE ABOUT THIS BLOCK . TEST IT WHEN YOU GET HOME
           
            p_dim = extra_spec
        
            Npar=n_elements(p_dim)
        
            if keyword_set(refresh) then begin ;(REFRESHED RUN) 
                
53548c91   Ilyes Choubani   Display of frozen...
3357
3358
3359
3360
3361
3362
                IF isa((*!dustem_fit).fixed_param_descs) THEN BEGIN
                    
                    Nfpar = n_elements((*(*!dustem_fit).fixed_param_descs))
                    res = (*(*!dustem_fit).fixed_param_init_values)
                    k=0
                    FOR i=0L,Nfpar-1 DO BEGIN
5f04fa07   Ilyes Choubani   general update
3363
                        
53548c91   Ilyes Choubani   Display of frozen...
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
                        parameter_description = (*(*!dustem_fit).fixed_param_descs)[i]     
                        parameter_type = dustem_parameter_description2type(parameter_description,string_name=string_name)
                        ;Not sure about the wrapper data type that is mentioned in this procedure
                        IF parameter_type EQ 'PLUGIN' THEN BEGIN                       
                            yypos = 0.8 - k*0.09
                            k+=1
                        ENDIF 
                        
                    ENDFOR  
                                
                     
                ENDIF
                
                
                prms_dscs = (*(*!dustem_fit).param_descs)
                prms_tps = strarr(n_elements(prms_dscs))
                
                for i=0L,n_elements(prms_dscs)-1 do begin
                    prms_tps[i] = dustem_parameter_description2type(prms_dscs[i])
                endfor
                
                testprms = where(prms_tps EQ 'PLUGIN', ct_data)
                
                if ct_data ne 0 then begin
                
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
3389
                    if ~isa(yypos) then yypos = 0.8 else yypos-=0.22 ;not sure about this
53548c91   Ilyes Choubani   Display of frozen...
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
                    
                    
                    k=0
                    res = dustem_interp
                    errors = dustem_spec
                    yypostmp = yypos
                    
                    FOR i=0L,Npar-1 DO BEGIN  
                      ;stop
                        parameter_description = (*(*!dustem_fit).param_descs)[i]
                        parameter_type = dustem_parameter_description2type(parameter_description,string_name=string_name)
                      
                        IF parameter_type EQ 'PLUGIN' THEN BEGIN
                            
                            ii = strsplit(string_name,'_',count=countx) & ii = ii(countx-1)-1 ; Locating the last underscore to automate the extraction of the plugin's keyword 
                            mm = where(tag_names(*!dustem_plugin) eq strupcase(strmid(string_name,7,ii-7))) ;,coun) ; Selecting a plugin through matching the string name of the plugin form the scope system variable with the one read from the parameter description vector
                            prmtg = (*(*!dustem_plugin).(mm).paramtag)
                            indtg = (strmid(string_name,ii+1)) & indtg = strmid(indtg,0,/reverse_offset)     
                            indtg = fix(indtg)
                            prmtg = prmtg[indtg-1] 
                            yypos = yypostmp - k*0.09
                            xxpos = 0.0 
                            
                            str = strtrim(string(strmid(string_name,7,ii-7)+' ['+strmid(string_name,ii+1)+']: '+prmtg+' = ',format=frmt0),2)
                            str1 = str+string(res[i],format=frmt1)+textoidl(' \pm ')+string(errors(i),format=frmt1)
                            cgtext, xxpos, yypos, str1, charsize=-1, width=thiswidth, /normal
                            xxpos=(1-thiswidth)/2
                            cgtext, xxpos, yypos, str, charsize=-1, width=thiswidth, /normal
                            xxpos+=thiswidth;(1-thiswidth)/2
                            str = string(res[i],format=frmt1)+textoidl(' \pm ')+string(errors(i),format=frmt1)
    
                            xyouts,xxpos,yypos,str,color=0,/normal,charsize=1.
                            k+=1
5f04fa07   Ilyes Choubani   general update
3423
                            
53548c91   Ilyes Choubani   Display of frozen...
3424
3425
3426
3427
3428
3429
                        ENDIF          
                                
                    
                    ENDFOR
                
             ENDIF
5f04fa07   Ilyes Choubani   general update
3430
                
e9bb0ce2   Ilyes Choubani   Correcting small ...
3431
            endif else begin ;(FROZEN RUN = title strings + fixed plugins (TBDONE))
5f04fa07   Ilyes Choubani   general update
3432
                
53548c91   Ilyes Choubani   Display of frozen...
3433
3434
3435
                
                
                IF isa((*!dustem_fit).fixed_param_descs) THEN BEGIN
5f04fa07   Ilyes Choubani   general update
3436
                    
53548c91   Ilyes Choubani   Display of frozen...
3437
3438
                    Nfpar = n_elements((*(*!dustem_fit).fixed_param_descs))
                    res = (*(*!dustem_fit).fixed_param_init_values)
5f04fa07   Ilyes Choubani   general update
3439
                    
0068116a   Ilyes Choubani   General update + ...
3440
                    iii=0
74103816   Ilyes Choubani   small update
3441
3442
3443
3444
                    FOR i=0L,Nfpar-1 DO BEGIN
                        
                        parameter_description = (*(*!dustem_fit).fixed_param_descs)[i]     
                        parameter_type = dustem_parameter_description2type(parameter_description,string_name=string_name)
0068116a   Ilyes Choubani   General update + ...
3445
                        if parameter_type EQ 'PLUGIN' then iii+=1 
74103816   Ilyes Choubani   small update
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
                        
                    ENDFOR
                    k = 0
                    if iii ne 0 then begin
                        xxpos = 0.0
                        yypos = 0.9
                        ;xxpos = 0.0 ;might need to be modified
                        cgtext, xxpos, yypos, '-FROZEN-', charsize=-1, width=thiswidth, /normal  
                        xxpos=(1-thiswidth)/2
                        xyouts, xxpos, yypos, '-FROZEN-', charsize=1.2, /normal, color=0
                    endif
53548c91   Ilyes Choubani   Display of frozen...
3457
3458
3459
3460
3461
3462
3463
                    FOR i=0L,Nfpar-1 DO BEGIN
                        
                        parameter_description = (*(*!dustem_fit).fixed_param_descs)[i]     
                        parameter_type = dustem_parameter_description2type(parameter_description,string_name=string_name)
                        testpop = STRUPCASE(strmid(strtrim(parameter_description,2),3,1,/reverse_offset)) EQ 'O'
                        
                        IF parameter_type EQ 'PLUGIN' THEN BEGIN
5f04fa07   Ilyes Choubani   general update
3464
                        
53548c91   Ilyes Choubani   Display of frozen...
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
                            
                            ii = strsplit(string_name,'_',count=countx) & ii = ii(countx-1)-1 ; Locating the last underscore to automate the extraction of the plugin's keyword 
                            mm = where(tag_names(*!dustem_plugin) eq strupcase(strmid(string_name,7,ii-7))) ;,coun) ; Selecting a plugin through matching the string name of the plugin form the scope system variable with the one read from the parameter description vector
                            prmtg = (*(*!dustem_plugin).(mm).paramtag)
                            indtg = (strmid(string_name,ii+1)) & indtg = strmid(indtg,0,/reverse_offset)     
                            indtg = fix(indtg)
                            prmtg = prmtg[indtg-1] 
                            
                            yypos = 0.8 - k*0.09
                            xxpos = 0.0  
                            
                            str = string(strmid(string_name,7,ii-7)+' ['+strmid(string_name,ii+1)+']: '+prmtg+' = ',format=frmt0)
                            str=strtrim(str,2)
                            str1=str+string(res[i],format=frmt1)
                            cgtext, xxpos, yypos, str1, charsize=-1, width=thiswidth, /normal
                            xxpos=(1-thiswidth)/2 
                            ;stop
                            xyouts,xxpos,yypos,str1,color=0,/normal,charsize=1.
                            k+=1
                        
                        ENDIF    
5f04fa07   Ilyes Choubani   general update
3486
                         
53548c91   Ilyes Choubani   Display of frozen...
3487
3488
3489
3490
                    ENDFOR  
                     
                ENDIF
                
0c487640   Ilyes Choubani   corrected missing...
3491
                xxpos = 0
53548c91   Ilyes Choubani   Display of frozen...
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
                
                prms_dscs = (*(*!dustem_fit).param_descs)
                prms_tps = strarr(n_elements(prms_dscs))
                 
                for i=0L,n_elements(prms_dscs)-1 do begin
                    prms_tps[i] = dustem_parameter_description2type(prms_dscs[i])
                endfor
                
                testprms = where(prms_tps EQ 'PLUGIN', ct_data)
                
                IF ct_data ne 0 then begin
                
                
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
3505
                    if ~isa(yypos) then yypos = 0.9 else yypos-=0.1*1.2 ;not sure about this
53548c91   Ilyes Choubani   Display of frozen...
3506
3507
3508
3509
3510
                     ;stop
                     ;xxpos = 0.0;might need to be modified
                    cgtext, xxpos, yypos, '-FREE-', charsize=-1,width=thiswidth, /normal
    
                    xxpos=(1-thiswidth)/2
8fbdb4c3   Ilyes Choubani   Fixed minor 0/0 e...
3511
                    xyouts, xxpos, yypos, '-FREE-', charsize=1.2, /normal,color=0
53548c91   Ilyes Choubani   Display of frozen...
3512
3513
3514
3515
3516
3517
3518
                    
                    
                    k=0
                    res = dustem_interp
                    errors = dustem_spec
                    yypos-=0.1
                    yypostmp = yypos
5f04fa07   Ilyes Choubani   general update
3519
                        
53548c91   Ilyes Choubani   Display of frozen...
3520
3521
3522
3523
                    FOR i=0L,Npar-1 DO BEGIN  
                      ;stop
                        parameter_description = (*(*!dustem_fit).param_descs)[i]
                        parameter_type = dustem_parameter_description2type(parameter_description,string_name=string_name)
5f04fa07   Ilyes Choubani   general update
3524
                        
5f04fa07   Ilyes Choubani   general update
3525
                        
53548c91   Ilyes Choubani   Display of frozen...
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
                        IF parameter_type EQ 'PLUGIN' THEN BEGIN
                            
                            ii = strsplit(string_name,'_',count=countx) & ii = ii(countx-1)-1 ; Locating the last underscore to automate the extraction of the plugin's keyword 
                            mm = where(tag_names(*!dustem_plugin) eq strupcase(strmid(string_name,7,ii-7))) ;,coun) ; Selecting a plugin through matching the string name of the plugin form the scope system variable with the one read from the parameter description vector
                            prmtg = (*(*!dustem_plugin).(mm).paramtag)
                            indtg = (strmid(string_name,ii+1)) & indtg = strmid(indtg,0,/reverse_offset)     
                            indtg = fix(indtg)
                            prmtg = prmtg[indtg-1] 
                             
                            yypos = yypostmp - k*0.09
                            xxpos = 0.0;15 
                            
                            str = string(strmid(string_name,7,ii-7)+' ['+strmid(string_name,ii+1)+']: '+prmtg+' = ',format=frmt0)
                            str=strtrim(str,2)
                            str1 = str+string(res[i],format=frmt1)+textoidl(' \pm ')+string(errors(i),format=frmt1)           
                            ;getting the width of the total string: string title +values +errors so we can place it the right way and not have to worry about its position
                            
                            cgtext, xxpos, yypos, str1, charsize=-1, width=thiswidth, /normal
                            xxpos=(1-thiswidth)/2 
                           
                            xyouts,xxpos,yypos,str,color=0,/normal,charsize=1.
                            k+=1
                            
                        ENDIF
                          
                        
5f04fa07   Ilyes Choubani   general update
3552
                    
53548c91   Ilyes Choubani   Display of frozen...
3553
3554
                    ENDFOR
                ENDIF
5f04fa07   Ilyes Choubani   general update
3555
3556
3557
3558
            endelse
         
        
        
5f04fa07   Ilyes Choubani   general update
3559
3560
        end
        
b5314324   Ilyes Choubani   updating the plot...
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
    
    endcase


endif










b5314324   Ilyes Choubani   updating the plot...
3576
END