Commit aace5af0978df538240ad0cc5d87499ce90f011a
1 parent
bffa7018
Exists in
master
forgotten procedure
Showing
1 changed file
with
695 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,695 @@ |
1 | +PRO dustem_set_plot_range ,test_m,test_x, _extra=_extra ,help=help | |
2 | + | |
3 | +;+ | |
4 | +; NAME: | |
5 | +; dustem_set_plot_range | |
6 | +; PURPOSE: | |
7 | +; Sets the X and Y plotting ranges for the different datasets in emission and extinction when in polarization mode and not (using the _extra structure). | |
8 | +; CATEGORY: | |
9 | +; DustEMWrap | |
10 | +; CALLING SEQUENCE: | |
11 | +; dustem_set_plot_range,test_m,test_x,_extra=_extra | |
12 | +; INPUTS: | |
13 | +; test_m : (Boolean) signaling emission mode | |
14 | +; test_x : (Boolean) signaling extinction mode | |
15 | +; OPTIONAL INPUT PARAMETERS: | |
16 | +; _extra structure containing the plotting keywords | |
17 | +; OUTPUTS: | |
18 | +; NONE | |
19 | +; OPTIONAL OUTPUT PARAMETERS: | |
20 | +; | |
21 | +; ACCEPTED KEY-WORDS: | |
22 | +; help | |
23 | +; COMMON BLOCKS: | |
24 | +; None | |
25 | +; SIDE EFFECTS: | |
26 | +; Changes the default plotting parameters in the !dustem_plot_range pointer. | |
27 | +; The procedure only works with the presence of the _extra structure | |
28 | +; RESTRICTIONS: | |
29 | +; The DustEM fortran code must be installed | |
30 | +; The DustEMWrap IDL code must be installed | |
31 | +; PROCEDURES AND SUBROUTINES USED: | |
32 | +; | |
33 | +; EXAMPLES | |
34 | +; dustem_set_plot_range ,test_m,test_x, _extra=_extra | |
35 | +; MODIFICATION HISTORY: | |
36 | +; Written by Ilyes Choubani | |
37 | +; Evolution details on the DustEMWrap gitlab. | |
38 | +;- | |
39 | + | |
40 | +IF keyword_set(help) THEN BEGIN | |
41 | + doc_library,'dustemw_set_plot_range' | |
42 | + goto,the_end | |
43 | +END | |
44 | + | |
45 | +IF keyword_set(_extra) THEN BEGIN | |
46 | + | |
47 | + tgnms_extra = tag_names(_extra) | |
48 | + | |
49 | + ; ;Now testing on what is in the _extra structure. | |
50 | + IF test_m and ~test_x THEN BEGIN ;EMISSION ALONE | |
51 | + | |
52 | + IF !run_pol THEN BEGIN ;SEVERAL DATA SETS: THE DASHBOARD | |
53 | + | |
54 | + ;Setting of tHE X-RANGE | |
55 | + ;taking into account as many entries as possible | |
56 | + tsxr = strmid(strupcase(tgnms_extra),0,2) EQ 'XR' or $ | |
57 | + strupcase(tgnms_extra) EQ 'XRANGE' or $ | |
58 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
59 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_M') or $ | |
60 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
61 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) EQ '_EMISSION') | |
62 | + | |
63 | + idxr = where(tsxr,ctestxr) | |
64 | + | |
65 | + ;There is no error testing on X ranges because there is only one X range | |
66 | + | |
67 | + ;THIS WILL ONLY CONCERN THE Y RANGES | |
68 | + | |
69 | + tst = STRUPCASE(strmid(tgnms_extra,2,/reverse_offset)) NE 'SED' and $ | |
70 | + STRUPCASE(strmid(tgnms_extra,2,/reverse_offset)) NE '_EM' and $ | |
71 | + STRUPCASE(strmid(tgnms_extra,2,/reverse_offset)) NE 'RAC' | |
72 | + | |
73 | + idyr = where((strmid(strupcase(tgnms_extra),0,2) EQ 'YR'and tst) or $ | |
74 | + strupcase(tgnms_extra) EQ 'YRANGE' or $ | |
75 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'YR' and tst and $ | |
76 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_M') or $ | |
77 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'YR' and tst and $ | |
78 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) NE '_EMISSION'),ctestyr) ;(strsplit(tgnms_extra,'_')) NE [0],ctestyr) | |
79 | + | |
80 | + | |
81 | + if ctestyr ne 0 then message, 'You have provided one Y-range when multiple ones have to be provided.', /continue | |
82 | + | |
83 | + idyr_polsed = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
84 | + STRUPCASE(strmid(tgnms_extra,5,/reverse_offset)) EQ 'POLSED',ctyr_polsed) | |
85 | + | |
86 | + idyr_psi_em = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
87 | + STRUPCASE(strmid(tgnms_extra,5,/reverse_offset)) EQ 'PSI_EM',ctyr_psi_em) | |
88 | + | |
89 | + idyr_used = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
90 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) EQ 'USED',ctyr_used) | |
91 | + | |
92 | + idyr_sed = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
93 | + STRUPCASE(strmid(tgnms_extra,5,/reverse_offset)) NE 'POLSED' and $ | |
94 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) NE 'QSED' and $ | |
95 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) NE 'USED' and $ | |
96 | + STRUPCASE(strmid(tgnms_extra,2,/reverse_offset)) EQ 'SED',ctyr_sed) | |
97 | + | |
98 | + idyr_polfrac = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
99 | + STRUPCASE(strmid(tgnms_extra,5,/reverse_offset)) EQ 'OLFRAC',ctyr_polfrac) | |
100 | + | |
101 | + idyr_qsed = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
102 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) EQ 'QSED',ctyr_qsed) | |
103 | + | |
104 | + | |
105 | + ;SETTING THE TITLE | |
106 | + | |
107 | + idtit = where(strmid(strupcase(tgnms_extra),0,3) EQ 'TIT' or $ | |
108 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
109 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_M') or $ | |
110 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
111 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) EQ '_EMISSION') , ctestit) | |
112 | + | |
113 | + | |
114 | + | |
115 | + | |
116 | + ;FILLING UP X ranges (same xrange) | |
117 | + | |
118 | + IF ctestxr ne 0 THEN BEGIN | |
119 | + | |
120 | + FOR i=0L,(n_tags(!dustem_plot_range)-3)/2 DO BEGIN ; THIS IS EMISSION , extinction will have to from (n_tags(!dustem_plot_range)-2)/2+1 to (n_tags(!dustem_plot_range)-2) | |
121 | + | |
122 | + !dustem_plot_range.(i).xr=_extra.(idxr) | |
123 | + | |
124 | + ENDFOR | |
125 | + | |
126 | + | |
127 | + ENDIF ;else the default xr is kept | |
128 | + | |
129 | + ;FILLING UP Y RANGES | |
130 | + | |
131 | + | |
132 | + if ctyr_polsed ne 0 then !dustem_plot_range.(3).yr = _extra.(idyr_polsed) | |
133 | + | |
134 | + | |
135 | + if ctyr_psi_em ne 0 then !dustem_plot_range.(5).yr = _extra.(idyr_psi_em) | |
136 | + | |
137 | + | |
138 | + if ctyr_used ne 0 then !dustem_plot_range.(2).yr = _extra.(idyr_used) | |
139 | + | |
140 | + | |
141 | + if ctyr_sed ne 0 then !dustem_plot_range.(0).yr = _extra.(idyr_sed) | |
142 | + | |
143 | + | |
144 | + if ctyr_polfrac ne 0 then !dustem_plot_range.(4).yr = _extra.(idyr_polfrac) | |
145 | + | |
146 | + | |
147 | + if ctyr_qsed ne 0 then !dustem_plot_range.(1).yr = _extra.(idyr_qsed) | |
148 | + | |
149 | + | |
150 | + if ctestit ne 0 then !dustem_plot_range.(12) = _extra.(idtit) | |
151 | + stop | |
152 | + | |
153 | + ENDIF ELSE BEGIN ;ONE DATA SET : SED - - - - | |
154 | + | |
155 | + tsxr = strmid(strupcase(tgnms_extra),0,2) EQ 'XR' or $ | |
156 | + strupcase(tgnms_extra) EQ 'XRANGE' or $ | |
157 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
158 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_M') or $ | |
159 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
160 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) EQ '_EMISSION') | |
161 | + | |
162 | + idxr = where(tsxr,ctestxr) | |
163 | + ;FILLING UP X ranges (same xrange) | |
164 | + | |
165 | + IF ctestxr ne 0 THEN !dustem_plot_range.(0).xr=_extra.(idxr) | |
166 | + | |
167 | + idyr = where(strmid(strupcase(tgnms_extra),0,2) EQ 'YR' or $ | |
168 | + strupcase(tgnms_extra) EQ 'YRANGE' or $ | |
169 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
170 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_M') or $ | |
171 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
172 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) EQ '_EMISSION'),ctestyr) | |
173 | + | |
174 | + ;Filling up the Y range | |
175 | + if ctestyr ne 0 then !dustem_plot_range.(0).yr = _extra.(idyr) | |
176 | + | |
177 | + ;SETTING THE TITLE | |
178 | + | |
179 | + idtit = where(strmid(strupcase(tgnms_extra),0,3) EQ 'TIT' or $ | |
180 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
181 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_M') or $ | |
182 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
183 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) EQ '_EMISSION') , ctestit) | |
184 | + | |
185 | + if ctestit ne 0 then !dustem_plot_range.(12) = _extra.(idtit) | |
186 | + | |
187 | + ENDELSE | |
188 | + | |
189 | + | |
190 | + ENDIF | |
191 | + | |
192 | + | |
193 | + IF test_x and ~test_m THEN BEGIN ;EXTINCTION ALONE | |
194 | + | |
195 | + | |
196 | + | |
197 | + IF !run_pol THEN BEGIN ;SEVERAL DATA SETS: THE DASHBOARD | |
198 | + | |
199 | + | |
200 | + ;Setting of tHE X-RANGE | |
201 | + ;taking into account as many entries as possible | |
202 | + tsxr = strmid(strupcase(tgnms_extra),0,2) EQ 'XR' or $ | |
203 | + strupcase(tgnms_extra) EQ 'XRANGE' or $ | |
204 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
205 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_X') or $ | |
206 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
207 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) EQ '_EXTINCTION') | |
208 | + | |
209 | + idxr = where(tsxr,ctestxr) | |
210 | + | |
211 | + | |
212 | + tst = STRUPCASE(strmid(tgnms_extra,2,/reverse_offset)) NE 'EXT' | |
213 | + | |
214 | + idyr = where((strmid(strupcase(tgnms_extra),0,2) EQ 'YR'and tst) or $ | |
215 | + strupcase(tgnms_extra) EQ 'YRANGE' or $ | |
216 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'YR' and tst and $ | |
217 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_X') or $ | |
218 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'YR' and tst and $ | |
219 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) NE '_EXTINCTION'),ctestyr) ; | |
220 | + | |
221 | + | |
222 | + if ctestyr ne 0 then message, 'You have provided one Y-range when multiple Y-ranges have to be provided.',/continue | |
223 | + | |
224 | + | |
225 | + idyr_polext = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
226 | + STRUPCASE(strmid(tgnms_extra,6,/reverse_offset)) EQ '_POLEXT',ctyr_polext) | |
227 | + | |
228 | + idyr_psi_ext = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
229 | + STRUPCASE(strmid(tgnms_extra,6,/reverse_offset)) EQ 'PSI_EXT',ctyr_psi_ext) | |
230 | + | |
231 | + idyr_uext = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
232 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) EQ 'UEXT',ctyr_uext) | |
233 | + | |
234 | + idyr_fpolext = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
235 | + STRUPCASE(strmid(tgnms_extra,6,/reverse_offset)) EQ 'FPLOEXT',ctyr_fpolext) | |
236 | + | |
237 | + idyr_qext = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
238 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) EQ 'QEXT',ctyr_qext) | |
239 | + | |
240 | + testext = strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
241 | + STRUPCASE(strmid(tgnms_extra,2,/reverse_offset)) EQ 'EXT' and $ | |
242 | + STRUPCASE(strmid(tgnms_extra,6,/reverse_offset)) NE '_POLEXT' and $ | |
243 | + STRUPCASE(strmid(tgnms_extra,6,/reverse_offset)) NE 'FPOLEXT' and $ | |
244 | + STRUPCASE(strmid(tgnms_extra,6,/reverse_offset)) NE 'PSI_EXT' and $ | |
245 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) NE 'UEXT' and $ | |
246 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) NE 'QEXT' | |
247 | + | |
248 | + idyr_ext = where(testex,ctyr_ext) | |
249 | + | |
250 | + | |
251 | + ;SETTING THE TITLE | |
252 | + | |
253 | + idtit = where(strmid(strupcase(tgnms_extra),0,3) EQ 'TIT' or $ | |
254 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
255 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_X') or $ | |
256 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
257 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) EQ '_EXTINCTION') , ctestit) | |
258 | + | |
259 | + | |
260 | + ;FILLING UP Xranges (same xrange) | |
261 | + | |
262 | + IF ctestxr ne 0 THEN BEGIN | |
263 | + | |
264 | + FOR i=(n_tags(!dustem_plot_range)-2)/2+1,(n_tags(!dustem_plot_range)-2) DO BEGIN ; THIS IS EMISSION , extinction will have to from (n_tags(!dustem_plot_range)-2)/2+1 to (n_tags(!dustem_plot_range)-2) | |
265 | + | |
266 | + !dustem_plot_range.(i).xr=_extra.(idxr) | |
267 | + | |
268 | + ENDFOR | |
269 | + | |
270 | + | |
271 | + ENDIF ;else the default xr is kept | |
272 | + | |
273 | + | |
274 | + ;FILLING UP Y RANGES | |
275 | + | |
276 | + | |
277 | + if ctyr_polext ne 0 then !dustem_plot_range.(9).yr = _extra.(idyr_polext) | |
278 | + | |
279 | + | |
280 | + if ctyr_psi_ext ne 0 then !dustem_plot_range.(11).yr = _extra.(idyr_psi_ext) | |
281 | + | |
282 | + | |
283 | + if ctyr_uext ne 0 then !dustem_plot_range.(8).yr = _extra.(idyr_uext) | |
284 | + | |
285 | + | |
286 | + if ctyr_ext ne 0 then !dustem_plot_range.(6).yr = _extra.(idyr_ext) | |
287 | + | |
288 | + | |
289 | + if ctyr_fpolext ne 0 then !dustem_plot_range.(10).yr = _extra.(idyr_fpolext) | |
290 | + | |
291 | + | |
292 | + if ctyr_qext ne 0 then !dustem_plot_range.(7).yr = _extra.(idyr_qext) | |
293 | + | |
294 | + | |
295 | + if ctestit ne 0 then !dustem_plot_range.(13) = _extra.(idtit) | |
296 | + | |
297 | + | |
298 | + ENDIF ELSE BEGIN ;ONE DATA SET : EXT | |
299 | + | |
300 | + | |
301 | + tsxr = strmid(strupcase(tgnms_extra),0,2) EQ 'XR' or $ | |
302 | + strupcase(tgnms_extra) EQ 'XRANGE' or $ | |
303 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
304 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_X') or $ | |
305 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
306 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) EQ '_EXTINCTION') | |
307 | + | |
308 | + idxr = where(tsxr,ctestxr) | |
309 | + | |
310 | + ;FILLING UP X ranges (same xrange) | |
311 | + | |
312 | + IF ctestxr ne 0 THEN !dustem_plot_range.(6).xr=_extra.(idxr) | |
313 | + | |
314 | + | |
315 | + | |
316 | + ;NB: Counters in this loop and in the loop above do not necessarily serve the same function | |
317 | + idyr = where(strmid(strupcase(tgnms_extra),0,2) EQ 'YR' or $ | |
318 | + strupcase(tgnms_extra) EQ 'YRANGE' or $ | |
319 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
320 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_X') or $ | |
321 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
322 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) EQ '_EXTINCTION'),ctestyr) ; | |
323 | + | |
324 | + if ctestyr ne 0 then !dustem_plot_range.(6).yr = _extra.(idyr) | |
325 | + | |
326 | + ;SETTING THE TITLE | |
327 | + | |
328 | + idtit = where(strmid(strupcase(tgnms_extra),0,3) EQ 'TIT' or $ | |
329 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
330 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_X') or $ | |
331 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
332 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) EQ '_EXTINCTION') , ctestit) | |
333 | + | |
334 | + | |
335 | + if ctestit ne 0 then !dustem_plot_range.(13) = _extra.(idtit) | |
336 | + | |
337 | + | |
338 | + ENDELSE | |
339 | + | |
340 | + ENDIF | |
341 | + | |
342 | + | |
343 | + | |
344 | + IF test_m and test_x THEN BEGIN ;EMISSION and EXTINCTION | |
345 | + | |
346 | + | |
347 | + IF !run_pol THEN BEGIN ;SEVERAL DATA SETS: THE SED DASHBOARD & EXT DASHBOARD | |
348 | + | |
349 | + | |
350 | + tstxr = strupcase(tgnms_extra) EQ 'XRANGE' or $ | |
351 | + strupcase(tgnms_extra) EQ 'XR' or $ | |
352 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'XR' and $ | |
353 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_M') or $ | |
354 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'XR' and $ | |
355 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_X') or $ | |
356 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'XR' and $ | |
357 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) NE '_EMISSION') or $ | |
358 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'XR' and $ | |
359 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) NE '_EXTINCTION') | |
360 | + | |
361 | + idxr = where(tstxr,ctestxr) | |
362 | + | |
363 | + if ctestxr ne 0 then message, 'You have provided one X-range when multiple ones are needed',/continue | |
364 | + | |
365 | + t_m = (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
366 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_M') or $ | |
367 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
368 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) EQ '_EMISSION') | |
369 | + | |
370 | + indxr_m = where(t_m,ctestxr_m) | |
371 | + | |
372 | + | |
373 | + | |
374 | + t_x = (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
375 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_X') or $ | |
376 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
377 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) EQ '_EXTINCTION') | |
378 | + | |
379 | + | |
380 | + idxr_x = where(t_x,ctestxr_x) | |
381 | + | |
382 | + | |
383 | + ;SETTING Y RANGE | |
384 | + | |
385 | + tst = STRUPCASE(strmid(tgnms_extra,2,/reverse_offset)) NE 'SED' and $ | |
386 | + STRUPCASE(strmid(tgnms_extra,2,/reverse_offset)) NE '_EM' and $ | |
387 | + STRUPCASE(strmid(tgnms_extra,2,/reverse_offset)) NE 'RAC'and $ | |
388 | + STRUPCASE(strmid(tgnms_extra,2,/reverse_offset)) NE 'EXT' | |
389 | + | |
390 | + idyr = where((strmid(strupcase(tgnms_extra),0,2) EQ 'YR'and tst) or $ | |
391 | + strupcase(tgnms_extra) EQ 'YR' or $ | |
392 | + strupcase(tgnms_extra) EQ 'YRANGE' or $ | |
393 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'YR' and tst and $ | |
394 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_M') or $ | |
395 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'YR' and tst and $ | |
396 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) NE '_EMISSION') or $ | |
397 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'YR' and tst and $ | |
398 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_X') or $ | |
399 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'YR' and tst and $ | |
400 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) NE '_EXTINCTION'),ctestyr) ; | |
401 | + | |
402 | + if ctestyr ne 0 then message, 'You have provided one Y-range when multiple ones are needed.',/continue | |
403 | + | |
404 | + ;EMISSION | |
405 | + idyr_polsed = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
406 | + STRUPCASE(strmid(tgnms_extra,5,/reverse_offset)) EQ 'POLSED',ctyr_polsed) | |
407 | + | |
408 | + idyr_psi_em = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
409 | + STRUPCASE(strmid(tgnms_extra,5,/reverse_offset)) EQ 'PSI_EM',ctyr_psi_em) | |
410 | + | |
411 | + idyr_used = where(strmid(strupcase(tgnms_extra),0,1) EQ 'YR' and $ | |
412 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) EQ 'USED',ctyr_used) | |
413 | + | |
414 | + idyr_sed = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
415 | + STRUPCASE(strmid(tgnms_extra,5,/reverse_offset)) NE 'POLSED' and $ | |
416 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) NE 'QSED' and $ | |
417 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) NE 'USED' and $ | |
418 | + STRUPCASE(strmid(tgnms_extra,2,/reverse_offset)) EQ 'SED',ctyr_sed) | |
419 | + | |
420 | + idyr_polfrac = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
421 | + STRUPCASE(strmid(tgnms_extra,5,/reverse_offset)) EQ 'OLFRAC',ctyr_polfrac) | |
422 | + | |
423 | + idyr_qsed = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
424 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) EQ 'QSED',ctyr_qsed) | |
425 | + | |
426 | + ;EXTINCTION | |
427 | + idyr_polext = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
428 | + STRUPCASE(strmid(tgnms_extra,6,/reverse_offset)) EQ '_POLEXT',ctyr_polext) | |
429 | + | |
430 | + idyr_psi_ext = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
431 | + STRUPCASE(strmid(tgnms_extra,6,/reverse_offset)) EQ 'PSI_EXT',ctyr_psi_ext) | |
432 | + | |
433 | + idyr_uext = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
434 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) EQ 'UEXT',ctyr_uext) | |
435 | + | |
436 | + idyr_fpolext = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
437 | + STRUPCASE(strmid(tgnms_extra,6,/reverse_offset)) EQ 'FPLOEXT',ctyr_fpolext) | |
438 | + | |
439 | + idyr_qext = where(strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
440 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) EQ 'QEXT',ctyr_qext) | |
441 | + | |
442 | + testext = strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
443 | + STRUPCASE(strmid(tgnms_extra,2,/reverse_offset)) EQ 'EXT' and $ | |
444 | + STRUPCASE(strmid(tgnms_extra,6,/reverse_offset)) NE '_POLEXT' and $ | |
445 | + STRUPCASE(strmid(tgnms_extra,6,/reverse_offset)) NE 'FPOLEXT' and $ | |
446 | + STRUPCASE(strmid(tgnms_extra,6,/reverse_offset)) NE 'PSI_EXT' and $ | |
447 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) NE 'UEXT' and $ | |
448 | + STRUPCASE(strmid(tgnms_extra,3,/reverse_offset)) NE 'QEXT' | |
449 | + | |
450 | + idyr_ext = where(testex,ctyr_ext) | |
451 | + | |
452 | + testit = strupcase(tgnms_extra) EQ 'TIT' or $ | |
453 | + strupcase(tgnms_extra) EQ 'TITLE' or $ | |
454 | + (strmid(strupcase(tgnms_extra),0,3) EQ 'TIT' and $ | |
455 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_M') or $ | |
456 | + (strmid(strupcase(tgnms_extra),0,3) EQ 'TIT' and $ | |
457 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) NE '_EMISSION') or $ | |
458 | + (strmid(strupcase(tgnms_extra),0,3) EQ 'TIT' and $ | |
459 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_X') or $ | |
460 | + (strmid(strupcase(tgnms_extra),0,3) EQ 'TIT' and $ | |
461 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) NE '_EXTINCTION') | |
462 | + | |
463 | + idtit = where(testit, ctit) | |
464 | + | |
465 | + if ctit ne 0 then message, 'You have provivded one title when two (emission + extinctino are needed).', /continue | |
466 | + | |
467 | + idtit_m = where((strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
468 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_M') or $ | |
469 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
470 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) EQ '_EMISSION'),ctit_m) | |
471 | + | |
472 | + | |
473 | + idtit_x = where((strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
474 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_X') or $ | |
475 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
476 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) EQ '_EXTINCTION'),ctit_x) | |
477 | + | |
478 | + | |
479 | + ;FILLING UP X ranges (same xrange): EMISSION | |
480 | + | |
481 | + IF ctestxr_m ne 0 THEN BEGIN | |
482 | + | |
483 | + FOR i=0L,(n_tags(!dustem_plot_range)-2)/2 DO BEGIN ; THIS IS EMISSION , extinction will have to from (n_tags(!dustem_plot_range)-2)/2+1 to (n_tags(!dustem_plot_range)-2) | |
484 | + | |
485 | + !dustem_plot_range.(i).xr=_extra.(idxr_m) | |
486 | + | |
487 | + | |
488 | + ENDFOR | |
489 | + | |
490 | + | |
491 | + ENDIF ;else the default xr is kept | |
492 | + | |
493 | + | |
494 | + ;FILLING UP X ranges (same xrange) - EXTINCTION | |
495 | + | |
496 | + IF ctestxr_x ne 0 THEN BEGIN | |
497 | + | |
498 | + FOR i=(n_tags(!dustem_plot_range)-2)/2+1,(n_tags(!dustem_plot_range)-2) DO BEGIN ; THIS IS EMISSION , extinction will have to from (n_tags(!dustem_plot_range)-2)/2+1 to (n_tags(!dustem_plot_range)-2) | |
499 | + | |
500 | + !dustem_plot_range.(i).xr=_extra.(idxr_x) | |
501 | + | |
502 | + ENDFOR | |
503 | + | |
504 | + | |
505 | + ENDIF ;else the default xr is kept | |
506 | + | |
507 | + | |
508 | + ;FILLING UP Y RANGES - EMISSION | |
509 | + | |
510 | + | |
511 | + if ctyr_polsed ne 0 then !dustem_plot_range.(3).yr = _extra.(idyr_polsed) | |
512 | + | |
513 | + | |
514 | + if ctyr_psi_em ne 0 then !dustem_plot_range.(5).yr = _extra.(idyr_psi_em) | |
515 | + | |
516 | + | |
517 | + if ctyr_used ne 0 then !dustem_plot_range.(2).yr = _extra.(idyr_used) | |
518 | + | |
519 | + | |
520 | + if ctyr_sed ne 0 then !dustem_plot_range.(0).yr = _extra.(idyr_sed) | |
521 | + | |
522 | + | |
523 | + if ctyr_polfrac ne 0 then !dustem_plot_range.(4).yr = _extra.(idyr_polfrac) | |
524 | + | |
525 | + | |
526 | + if ctyr_qsed ne 0 then !dustem_plot_range.(1).yr = _extra.(idyr_qsed) | |
527 | + | |
528 | + ;FILLING UP Y RANGES - EXTINCTION | |
529 | + | |
530 | + | |
531 | + if ctyr_polext ne 0 then !dustem_plot_range.(9).yr = _extra.(idyr_polext) | |
532 | + | |
533 | + | |
534 | + if ctyr_psi_ext ne 0 then !dustem_plot_range.(11).yr = _extra.(idyr_psi_ext) | |
535 | + | |
536 | + | |
537 | + if ctyr_uext ne 0 then !dustem_plot_range.(8).yr = _extra.(idyr_uext) | |
538 | + | |
539 | + | |
540 | + if ctyr_ext ne 0 then !dustem_plot_range.(6).yr = _extra.(idyr_ext) | |
541 | + | |
542 | + | |
543 | + if ctyr_fpolext ne 0 then !dustem_plot_range.(10).yr = _extra.(idyr_fpolext) | |
544 | + | |
545 | + | |
546 | + if ctyr_qext ne 0 then !dustem_plot_range.(7).yr = _extra.(idyr_qext) | |
547 | + | |
548 | + ;SETTING THE TITLE | |
549 | + | |
550 | + ;EXTINCTION | |
551 | + if ctit_x ne 0 then !dustem_plot_range.(13)=_extra.(idtit_x) | |
552 | + | |
553 | + | |
554 | + ;EMISSION | |
555 | + if ctit_m ne 0 then !dustem_plot_range.(12)=_extra.(idtit_m) | |
556 | + | |
557 | + | |
558 | + ENDIF ELSE BEGIN ;TWO DATA SETS : EXT AND SED | |
559 | + | |
560 | + tstxr = strupcase(tgnms_extra) EQ 'XRANGE' or $ | |
561 | + strupcase(tgnms_extra) EQ 'XR' or $ | |
562 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'XR' and $ | |
563 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_M') or $ | |
564 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'XR' and $ | |
565 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_X') or $ | |
566 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'XR' and $ | |
567 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) NE '_EMISSION') or $ | |
568 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'XR' and $ | |
569 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) NE '_EXTINCTION') | |
570 | + | |
571 | + idxr = where(tstxr,ctestxr) | |
572 | + | |
573 | + if ctestxr ne 0 then message, 'You have provided one X-range when multiple ones are needed',/continue | |
574 | + | |
575 | + t_m = (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
576 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_M') or $ | |
577 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
578 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) EQ '_EMISSION') | |
579 | + | |
580 | + indxr_m = where(t_m,ctestxr_m) | |
581 | + | |
582 | + | |
583 | + | |
584 | + t_x = (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
585 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_X') or $ | |
586 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'X' and $ | |
587 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) EQ '_EXTINCTION') | |
588 | + | |
589 | + | |
590 | + idxr_x = where(t_x,ctestxr_x) | |
591 | + | |
592 | + | |
593 | + idyr = where(strupcase(tgnms_extra) EQ 'YR' or $ | |
594 | + strupcase(tgnms_extra) EQ 'YRANGE' or $ | |
595 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'YR' and $ | |
596 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_M') or $ | |
597 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'YR' and $ | |
598 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) NE '_EMISSION') or $ | |
599 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'YR' and $ | |
600 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_X') or $ | |
601 | + (strmid(strupcase(tgnms_extra),0,2) EQ 'YR' and $ | |
602 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) NE '_EXTINCTION'),ctestyr) ; | |
603 | + | |
604 | + if ctestyr ne 0 then message, 'You have provided one Y-range when multiple ones are needed.',/continue | |
605 | + | |
606 | + | |
607 | + | |
608 | + t_m = (strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
609 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_M') or $ | |
610 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
611 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) EQ '_EMISSION') | |
612 | + | |
613 | + indyr_m = where(t_m,ctestxr_m) | |
614 | + | |
615 | + t_x = (strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
616 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_X') or $ | |
617 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'Y' and $ | |
618 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) EQ '_EXTINCTION') | |
619 | + | |
620 | + | |
621 | + idyr_x = where(t_x,ctestyr_x) | |
622 | + | |
623 | + | |
624 | + testit = strupcase(tgnms_extra) EQ 'TIT' or $ | |
625 | + strupcase(tgnms_extra) EQ 'TITLE' or $ | |
626 | + (strmid(strupcase(tgnms_extra),0,3) EQ 'TIT' and $ | |
627 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_M') or $ | |
628 | + (strmid(strupcase(tgnms_extra),0,3) EQ 'TIT' and $ | |
629 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) NE '_EMISSION') or $ | |
630 | + (strmid(strupcase(tgnms_extra),0,3) EQ 'TIT' and $ | |
631 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) NE '_X') or $ | |
632 | + (strmid(strupcase(tgnms_extra),0,3) EQ 'TIT' and $ | |
633 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) NE '_EXTINCTION') | |
634 | + | |
635 | + idtit = where(testit, ctit) | |
636 | + | |
637 | + if ctit ne 0 then message, 'You have provivded one title when two (emission + extinctino are needed).', /continue | |
638 | + | |
639 | + idtit_m = where((strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
640 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_M') or $ | |
641 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
642 | + STRUPCASE(strmid(tgnms_extra,8,/reverse_offset)) EQ '_EMISSION') ,ctit_m) | |
643 | + | |
644 | + | |
645 | + idtit_x = where((strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
646 | + STRUPCASE(strmid(tgnms_extra,1,/reverse_offset)) EQ '_X') or $ | |
647 | + (strmid(strupcase(tgnms_extra),0,1) EQ 'T' and $ | |
648 | + STRUPCASE(strmid(tgnms_extra,10,/reverse_offset)) EQ '_EXTINCTION'),ctit_x) | |
649 | + | |
650 | + | |
651 | + | |
652 | + ;FILLING UP X ranges (same xrange): EMISSION | |
653 | + | |
654 | + IF ctestxr_m ne 0 THEN !dustem_plot_range.(0).xr=_extra.(idxr_m) | |
655 | + | |
656 | + | |
657 | + ;FILLING UP X ranges (same xrange) - EXTINCTION | |
658 | + | |
659 | + IF ctestxr_x ne 0 THEN !dustem_plot_range.(6).xr=_extra.(idxr_x) | |
660 | + | |
661 | + ;FILLING UP X ranges (same xrange): EMISSION | |
662 | + | |
663 | + IF ctestyr_m ne 0 THEN !dustem_plot_range.(0).yr=_extra.(idyr_m) | |
664 | + | |
665 | + | |
666 | + ;FILLING UP X ranges (same xrange) - EXTINCTION | |
667 | + | |
668 | + IF ctestxr_x ne 0 THEN !dustem_plot_range.(6).xr=_extra.(idxr_x) | |
669 | + | |
670 | + | |
671 | + ;SETTING THE TITLE | |
672 | + | |
673 | + ;EXTINCTION | |
674 | + if ctit_x ne 0 then !dustem_plot_range.(13)=_extra.(idtit_x) | |
675 | + | |
676 | + | |
677 | + ;EMISSION | |
678 | + if ctit_m ne 0 then !dustem_plot_range.(12)=_extra.(idtit_m) | |
679 | + | |
680 | + | |
681 | + | |
682 | + ENDELSE | |
683 | + | |
684 | + | |
685 | +ENDIF | |
686 | + | |
687 | +ENDIF | |
688 | + | |
689 | + | |
690 | +the_end: | |
691 | + | |
692 | + | |
693 | +END | |
694 | + | |
695 | + | ... | ... |