Blame view

src/idl/dustem_check_data.pro 18.3 KB
266ae799   Ilyes Choubani   General update
1
FUNCTION dustem_check_data, sed=sed,ext=ext,fpol=fpol,ist=ist,pst=pst,fpst=fpst,qst=qst,ust=ust,exst=exst,pexst=pexst,qexst=qexst,uexst=uexst
09e61d64   Ilyes Choubani   cleaned set_data ...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25


;THIS PROCEDURE CHECKS THE DATA PROVIDED BY THE USER AND RETURNS DIFFERENT STRUCTURES TO DEFINE (SET) THE COMPOSITE DATA FITTING STRUCTURE (!dustem_data)


;write help section here
;I don't think this function should return anything 
;This replaces a big portion of dustem_set_data, JP was right.


;CHECKING THE FORMAT OF THE SED STRUCTURE
IF KEYWORD_SET(sed) THEN BEGIN
    ans=''
    wavs=sed.wave
    ;=== Impose central wavelengths for photometric channels
    ind=where(sed.filter NE 'SPECTRUM',count)
    IF count NE 0 THEN BEGIN
        wavs(ind)=dustem_filter2wav(sed(ind).filter)
    ENDIF
    ;=== define observations structure 
    obs_st={instru_names:sed.instru,filt_names:sed.filter,wav:wavs, values:sed.StokesI,sigma:sqrt(abs(sed.sigmaII))} 
    ;INITIALIZING OUTPUT STRUCTURES
    ist = obs_st
    pst = ist
266ae799   Ilyes Choubani   General update
26
    fpst = ist
09e61d64   Ilyes Choubani   cleaned set_data ...
27
28
29
30
    qst = ist
    ust = ist
    ;This allows the user to fit polsed, qsed and used individually.
    ;Test if there is StokesI data. If not move to polsed testing.
d012e324   Ilyes Choubani   FIX to the use of...
31
    ind = where(sed.StokesI NE la_undef() and finite(sed.StokesI) EQ 1 and sed.sigmaII NE la_undef() and finite(sed.sigmaII) EQ 1,N_sed) ;Testing if the data and errors are set
09e61d64   Ilyes Choubani   cleaned set_data ...
32
33
34
35
36
37
38
39
40
41
42
    IF N_sed EQ 0 THEN BEGIN
        ist = ptr_new()
        goto, pzone
    ENDIF ELSE BEGIN 
    ind = where(finite(sed.StokesI) EQ 0 or finite(sed.sigmaII) EQ 0, countnoki) ;Format is not okay if there are nan values but the wrapper recognizes the la_undef() value 
    IF countnoki NE 0 THEN BEGIN 
        message, "SED format isn't met. NaN value(s) detected in StokesI data.",/continue
        message, 'Without automatic format fitering you cannot proceed.',/continue
        read, ans, prompt='Would you like automatic format filtering? (Y/N):'
        IF strupcase(ans) EQ 'N' THEN BEGIN
            message,'You have chosen not to use automatic filtering. Please adjust the SED format.',/continue
266ae799   Ilyes Choubani   General update
43
            message, 'Aborting ...'
09e61d64   Ilyes Choubani   cleaned set_data ...
44
45
46
47
        ENDIF
    ENDIF 
    IF strupcase(ans) EQ 'Y' THEN message, 'You have chosen automatic format filtering. Removal of undefined data points...',/continue $
    ELSE message, 'Data format is met. Removal of undefined data points...',/continue
d012e324   Ilyes Choubani   FIX to the use of...
48
    testi=where(sed.sigmaII NE 0. and finite(sed.sigmaII) EQ 1 and sed.sigmaII NE la_undef() and sed.StokesI NE la_undef() and finite(sed.StokesI) EQ 1,ctesti)                
09e61d64   Ilyes Choubani   cleaned set_data ...
49
50
51
52
53
54
55
56
57
58
59
60
61
    IF ctesti NE 0 THEN BEGIN 
        instru_names = ist.instru_names(testi)
        filt_names = ist.filt_names(testi)
        wav = ist.wav(testi)
        values = ist.values(testi)
        sigma = ist.sigma(testi)
        ist={instru_names:instru_names,filt_names:filt_names,wav:wav,values:values,sigma:sigma}
    ENDIF    
    ENDELSE
    pzone:
    ans=''
    pst.values=sed.largeP
    pst.sigma=sqrt(abs(sed.sigma_largeP))
266ae799   Ilyes Choubani   General update
62
    ;Testig if there is LargeP data. If not move to polfrac data (fpol)
d012e324   Ilyes Choubani   FIX to the use of...
63
    ind = where(sed.largeP NE la_undef() and finite(sed.largeP) EQ 1 and sed.sigma_largeP NE la_undef() and finite(sed.sigma_largeP) EQ 1,NP) ;Testing on the nan values is needed to move to testing the other data fields (because if the dataset is full of Nans but not la_undef(), the code will think it's valid dta)
09e61d64   Ilyes Choubani   cleaned set_data ...
64
65
    IF NP EQ 0 THEN BEGIN
        pst = ptr_new()
266ae799   Ilyes Choubani   General update
66
        goto, fpzone
09e61d64   Ilyes Choubani   cleaned set_data ...
67
68
69
70
71
72
73
74
    ENDIF ELSE BEGIN
    ind = where(finite(sed.largeP) EQ 0 or finite(sed.sigma_largeP) EQ 0, countnokp) ;Format is not okay if there are nan values but the wrapper recognizes the la_undef() value 
    IF countnokp NE 0 THEN BEGIN 
        message, "SED format isn't met. NaN value(s) detected in LargeP data.",/continue
        message, 'Without automatic format fitering you cannot proceed.',/continue
        read, ans, prompt='Would you like automatic format filtering? (Y/N):' 
        IF strupcase(ans) EQ 'N' THEN BEGIN
            message,'You have chosen not to use automatic filtering. Please adjust the SED format.',/continue
266ae799   Ilyes Choubani   General update
75
            message, 'Aborting ...'
09e61d64   Ilyes Choubani   cleaned set_data ...
76
77
78
79
        ENDIF
    ENDIF
    IF strupcase(ans) EQ 'Y' THEN message, 'You have chosen automatic format filtering. Removal of undefined data points...',/continue $
    ELSE message, 'Data format is met. Removal of undefined data points...',/continue
d012e324   Ilyes Choubani   FIX to the use of...
80
    testp=where(sed.sigma_largeP NE 0. and finite(sed.sigma_largeP) EQ 1 and sed.sigma_largeP NE la_undef() and sed.largeP NE la_undef() and finite(sed.largeP) EQ 1,ctestp)                
09e61d64   Ilyes Choubani   cleaned set_data ...
81
82
83
84
85
86
87
    IF ctestp NE 0 THEN BEGIN 
        instru_names = pst.instru_names(testp)
        filt_names = pst.filt_names(testp)
        wav = pst.wav(testp)
        values = pst.values(testp)
        sigma = pst.sigma(testp)
        pst={instru_names:instru_names,filt_names:filt_names,wav:wav,values:values,sigma:sigma}
266ae799   Ilyes Choubani   General update
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
    ENDIF
    ENDELSE 
    fpzone:
    ans=''
    fpst.values=sed.smallp
    fpst.sigma=sqrt(abs(sed.sigma_smallp))
    ;Testig if there is smallp data. If not move to qsed data
    ind = where(sed.smallP NE la_undef() and finite(sed.smallP) EQ 1 and sed.sigma_smallP NE la_undef() and finite(sed.sigma_smallP) EQ 1,NSP) ;Testing on the nan values is needed to move to testing the other data fields (because if the dataset is full of Nans but not la_undef(), the code will think it's valid dta)
    IF NSP EQ 0 THEN BEGIN
        fpst = ptr_new()
        ;goto, qzone
        goto, qzone
    ENDIF ELSE BEGIN
    ind = where(finite(sed.smallP) EQ 0 or finite(sed.sigma_smallP) EQ 0, countnoksp) ;Format is not okay if there are nan values but the wrapper recognizes the la_undef() value 
    IF countnoksp NE 0 THEN BEGIN 
        message, "SED format isn't met. NaN value(s) detected in SmallP data.",/continue
        message, 'Without automatic format fitering you cannot proceed.',/continue
        read, ans, prompt='Would you like automatic format filtering? (Y/N):' 
        IF strupcase(ans) EQ 'N' THEN BEGIN
            message,'You have chosen not to use automatic filtering. Please adjust the SED format.',/continue
            message, 'Aborting ...'
        ENDIF
    ENDIF
    IF strupcase(ans) EQ 'Y' THEN message, 'You have chosen automatic format filtering. Removal of undefined data points...',/continue $
    ELSE message, 'Data format is met. Removal of undefined data points...',/continue
    testsp=where(sed.sigma_smallP NE 0. and finite(sed.sigma_smallP) EQ 1 and sed.sigma_smallP NE la_undef() and sed.smallP NE la_undef() and finite(sed.smallP) EQ 1,ctestsp)                
    IF ctestsp NE 0 THEN BEGIN 
        instru_names = fpst.instru_names(testsp)
        filt_names = fpst.filt_names(testsp)
        wav = fpst.wav(testsp)
        values = fpst.values(testsp)
        sigma = fpst.sigma(testsp)
        fpst={instru_names:instru_names,filt_names:filt_names,wav:wav,values:values,sigma:sigma}
    ENDIF
    ENDELSE
09e61d64   Ilyes Choubani   cleaned set_data ...
123
124
125
126
127
    qzone:
    ans=''
    qst.values=sed.StokesQ
    qst.sigma=sqrt(abs(sed.sigmaQQ))
    ;Testig if there is StokesQ data. If not move to used data
d012e324   Ilyes Choubani   FIX to the use of...
128
    ind = where(sed.StokesQ NE la_undef() and finite(sed.StokesQ) EQ 1 and sed.sigmaQQ NE la_undef() and finite(sed.sigmaQQ) EQ 1,NQ)
09e61d64   Ilyes Choubani   cleaned set_data ...
129
130
131
132
133
134
135
136
137
138
139
    IF NQ EQ 0 THEN BEGIN
        qst = ptr_new()
        goto, uzone
    ENDIF ELSE BEGIN
    ind = where(finite(sed.StokesQ) EQ 0 or finite(sed.sigmaQQ) EQ 0, countnokq) ;Format is not okay if there are nan values but the wrapper recognizes the la_undef() value 
    IF countnokq NE 0 THEN BEGIN 
        message, "SED format isn't met. NaN value(s) detected in StokesQ data.",/continue
        message, 'Without automatic format fitering you cannot proceed.',/continue
        read, ans, prompt='Would you like automatic format filtering? (Y/N):' 
        IF strupcase(ans) EQ 'N' THEN BEGIN
            message,'You have chosen not to use automatic filtering. Please adjust the SED format.',/continue
266ae799   Ilyes Choubani   General update
140
            message, 'Aborting ...'
09e61d64   Ilyes Choubani   cleaned set_data ...
141
142
143
144
        ENDIF
    ENDIF
    IF strupcase(ans) EQ 'Y' THEN message, 'You have chosen automatic format filtering. Removal of undefined data points...',/continue $
    ELSE message, 'Data format is met. Removal of undefined data points...',/continue
d012e324   Ilyes Choubani   FIX to the use of...
145
    testq=where(sed.sigmaQQ NE 0. and finite(sed.sigmaQQ) EQ 1 and sed.sigmaQQ NE la_undef() and sed.StokesQ NE la_undef() and finite(sed.StokesQ) EQ 1,ctestq)                
09e61d64   Ilyes Choubani   cleaned set_data ...
146
147
148
149
150
151
152
153
154
155
156
157
158
159
    IF ctestq NE 0 THEN BEGIN 
        instru_names = qst.instru_names(testq)
        filt_names = qst.filt_names(testq)
        wav = qst.wav(testq)
        values = qst.values(testq)
        sigma = qst.sigma(testq)
        qst={instru_names:instru_names,filt_names:filt_names,wav:wav,values:values,sigma:sigma}
    ENDIF
    ENDELSE
    uzone:
    ans=''
    ust.values=sed.StokesU
    ust.sigma=sqrt(abs(sed.sigmaUU))
    ;Testig if there is StokesU data. If not return empty value and end loop.
d012e324   Ilyes Choubani   FIX to the use of...
160
    ind = where(sed.StokesU NE la_undef() and finite(sed.StokesU) EQ 1 and sed.sigmaUU NE la_undef() and finite(sed.sigmaUU) EQ 1,NU)
09e61d64   Ilyes Choubani   cleaned set_data ...
161
162
163
164
165
166
167
168
169
170
171
    IF NU EQ 0 THEN BEGIN
        ust = ptr_new()
        goto, end_sed
    ENDIF ELSE BEGIN
    ind = where(finite(sed.StokesU) EQ 0 or finite(sed.sigmaUU) EQ 0, countnoku) ;Format is not okay if there are nan values but the wrapper recognizes the la_undef() value 
    IF countnoku NE 0 THEN BEGIN 
        message, "SED format isn't met. NaN value(s) detected in StokesU data.",/continue
        message, 'Without automatic format fitering you cannot proceed.',/continue
        read, ans, prompt='Would you like automatic format filtering? (Y/N):' 
        IF strupcase(ans) EQ 'N' THEN BEGIN
            message,'You have chosen not to use automatic filtering. Please adjust the SED format.',/continue
266ae799   Ilyes Choubani   General update
172
            message, 'Aborting ...'
09e61d64   Ilyes Choubani   cleaned set_data ...
173
174
175
176
        ENDIF
    ENDIF  
    IF strupcase(ans) EQ 'Y' THEN message, 'You have chosen automatic format filtering. Removal of undefined data points...',/continue $
    ELSE message, 'Data format is met. Removal of undefined data points...',/continue
d012e324   Ilyes Choubani   FIX to the use of...
177
    testu=where(sed.sigmaUU NE 0. and finite(sed.sigmaUU) EQ 1 and sed.sigmaUU NE la_undef() and sed.StokesU NE la_undef() and finite(sed.StokesU) EQ 1,ctestu)                
09e61d64   Ilyes Choubani   cleaned set_data ...
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
    IF ctestu NE 0 THEN BEGIN 
        instru_names = ust.instru_names(testu)
        filt_names = ust.filt_names(testu)
        wav = ust.wav(testu)
        values = ust.values(testu)
        sigma = ust.sigma(testu)
        ust={instru_names:instru_names,filt_names:filt_names,wav:wav,values:values,sigma:sigma}
    ENDIF
    ENDELSE
    end_sed:
ENDIF



;CHECKING THE FORMAT OF THE EXT STRUCTURE 
IF KEYWORD_SET(ext) THEN begin
    ans=''
    wavs=ext.wave
    ;=== Impose central wavelengths for photometric channels
    ind=where(ext.filter NE 'SPECTRUM',count)
    IF count NE 0 THEN BEGIN
        wavs(ind)=dustem_filter2wav(ext(ind).filter)
    ENDIF
    ;=== define observations structure 
    obs_st={instru_names:ext.instru,filt_names:ext.filter,wav:wavs, values:ext.EXT_I,sigma:sqrt(abs(ext.sigextII))} 
    ;INITIALIZING OUTPUT STRUCTURES
    exst = obs_st
    pexst = exst
    qexst = exst
    uexst = exst
    ;This allows the user to fit polext, qext and uext individually.
    ;Test if there is extinction data. If not move to polext testing.
759a527d   Ilyes Choubani   general update
210
    ;this condition was updated because you cannot have data without errors and errors without data
d012e324   Ilyes Choubani   FIX to the use of...
211
    ind = where(ext.EXT_I NE la_undef() and finite(ext.EXT_I) EQ 1 and ext.sigextII NE la_undef() and finite(ext.sigextII) EQ 1,N_ext) ;Testing if the data and errors are set
09e61d64   Ilyes Choubani   cleaned set_data ...
212
    IF N_ext EQ 0 THEN BEGIN
759a527d   Ilyes Choubani   general update
213
        exst = ptr_new()
09e61d64   Ilyes Choubani   cleaned set_data ...
214
215
216
217
218
219
220
221
222
223
        goto, pexzone
    ENDIF ELSE BEGIN
    ind = where(finite(ext.EXT_I) EQ 0 or finite(ext.sigextII) EQ 0, countnokex) ;Format is not okay if there are nan values but the wrapper recognizes the la_undef() value 
    IF countnokex NE 0 THEN BEGIN 
        message, "SED format isn't met. NaN value(s) detected in EXT_I data.",/continue
        message, 'Without automatic format fitering you cannot proceed.',/continue
        ans=''
        read, ans, prompt='Would you like automatic format filtering? (Y/N):' 
        IF strupcase(ans) EQ 'N' THEN BEGIN
            message,'You have chosen not to use automatic filtering. Please adjust the SED format.',/continue
266ae799   Ilyes Choubani   General update
224
            message, 'Aborting ...'
09e61d64   Ilyes Choubani   cleaned set_data ...
225
226
227
228
        ENDIF
    ENDIF      
    IF strupcase(ans) EQ 'Y' THEN message, 'You have chosen automatic format filtering. Removal of undefined data points...',/continue $ 
    ELSE message, 'Data format is met. Removal of undefined data points...',/continue
d012e324   Ilyes Choubani   FIX to the use of...
229
    testex=where(ext.sigextII NE 0. and finite(ext.sigextII) EQ 1 and ext.sigextII NE la_undef() and ext.EXT_I NE la_undef() and finite(ext.EXT_I) EQ 1,ctestex)                
09e61d64   Ilyes Choubani   cleaned set_data ...
230
231
232
233
234
235
236
237
238
239
240
241
242
243
    IF ctestex NE 0 THEN BEGIN 
        instru_names = exst.instru_names(testex)
        filt_names = exst.filt_names(testex)
        wav = exst.wav(testex)
        values = exst.values(testex)
        sigma = exst.sigma(testex)
        exst={instru_names:instru_names,filt_names:filt_names,wav:wav,values:values,sigma:sigma}
    ENDIF 
    ENDELSE
    pexzone:
    ans=''
    pexst.values=ext.EXT_P
    pexst.sigma=sqrt(abs(ext.sigextP))
    ;Testig if there is EXT_P data. If not move to EXT_Q testing
d012e324   Ilyes Choubani   FIX to the use of...
244
    ind = where(ext.EXT_P NE la_undef() and finite(ext.EXT_P) EQ 1 and ext.sigextP NE la_undef() and finite(ext.sigextII) EQ 1,NP_ext) ;Testing if the data and errors are set
09e61d64   Ilyes Choubani   cleaned set_data ...
245
246
247
248
249
250
251
252
253
254
255
256
    IF NP_ext EQ 0 THEN BEGIN
        pexst = ptr_new()
        goto, qexzone
    ENDIF ELSE BEGIN
    ind = where(finite(ext.EXT_P) EQ 0 or finite(ext.sigextP) EQ 0, countnokpex) ;Format is not okay if there are nan values but the wrapper recognizes the la_undef() value 
    IF countnokpex NE 0 THEN BEGIN 
        message, "SED format isn't met. NaN value(s) detected in EXT_I data.",/continue
        message, 'Without automatic format fitering you cannot proceed.',/continue
        ans=''
        read, ans, prompt='Would you like automatic format filtering? (Y/N):' 
        IF strupcase(ans) EQ 'N' THEN BEGIN
            message,'You have chosen not to use automatic filtering. Please adjust the SED format.',/continue
266ae799   Ilyes Choubani   General update
257
            message, 'Aborting ...'
09e61d64   Ilyes Choubani   cleaned set_data ...
258
259
260
261
        ENDIF
    ENDIF
    IF strupcase(ans) EQ 'Y' THEN message, 'You have chosen automatic format filtering. Removal of undefined data points...',/continue $ 
    ELSE message, 'Data format is met. Removal of undefined data points...',/continue
d012e324   Ilyes Choubani   FIX to the use of...
262
    testpex=where(ext.sigextP NE 0. and finite(ext.sigextP) EQ 1 and ext.sigextP NE la_undef() and ext.EXT_P NE la_undef() and finite(ext.EXT_P) EQ 1,ctestpex)                
09e61d64   Ilyes Choubani   cleaned set_data ...
263
264
265
266
267
268
269
270
271
272
273
274
275
276
    IF ctestpex NE 0 THEN BEGIN 
        instru_names = pexst.instru_names(testpex)
        filt_names = pexst.filt_names(testpex)
        wav = pexst.wav(testpex)
        values = pexst.values(testpex)
        sigma = pexst.sigma(testpex)
        pexst={instru_names:instru_names,filt_names:filt_names,wav:wav,values:values,sigma:sigma}
    ENDIF 
    ENDELSE
    qexzone:
    ans=''
    qexst.values=ext.EXT_Q
    qexst.sigma=sqrt(abs(ext.sigextQQ))
    ;Testig if there is EXT_P data. If not move to EXT_U testing
d012e324   Ilyes Choubani   FIX to the use of...
277
    ind = where(ext.EXT_Q NE la_undef() and finite(ext.EXT_Q) EQ 1 and ext.sigextQQ NE la_undef() and finite(ext.sigextQQ) EQ 1,NQ_ext) ;Testing if the data and errors are set
9ee42e40   Ilyes Choubani   fixed small bugs
278
    ;dustem_set_data.prostop   
09e61d64   Ilyes Choubani   cleaned set_data ...
279
280
281
282
283
284
285
286
287
288
289
290
    IF NQ_ext EQ 0 THEN BEGIN
        qexst = ptr_new()
        goto, uexzone
    ENDIF ELSE BEGIN
    ind = where(finite(ext.EXT_Q) EQ 0 or finite(ext.sigextQQ) EQ 0, countnokqex) ;Format is not okay if there are nan values but the wrapper recognizes the la_undef() value 
    IF countnokqex NE 0 THEN BEGIN 
        message, "SED format isn't met. NaN value(s) detected in EXT_I data.",/continue
        message, 'Without automatic format fitering you cannot proceed.',/continue
        ans=''
        read, ans, prompt='Would you like automatic format filtering? (Y/N):' 
        IF strupcase(ans) EQ 'N' THEN BEGIN
            message,'You have chosen not to use automatic filtering. Please adjust the SED format.',/continue
266ae799   Ilyes Choubani   General update
291
            message, 'Aborting ...'
09e61d64   Ilyes Choubani   cleaned set_data ...
292
293
294
295
        ENDIF
    ENDIF
    IF strupcase(ans) EQ 'Y' THEN message, 'You have chosen automatic format filtering. Removal of undefined data points...',/continue $
    ELSE message, 'Data format is met. Removal of undefined data points...',/continue
d012e324   Ilyes Choubani   FIX to the use of...
296
    testqex=where(ext.sigextQQ NE 0. and finite(ext.sigextQQ) EQ 1 and ext.sigextQQ NE la_undef() and ext.EXT_Q NE la_undef() and finite(ext.EXT_Q) EQ 1,ctestqex)                
09e61d64   Ilyes Choubani   cleaned set_data ...
297
298
299
300
301
302
303
304
305
306
307
308
309
310
    IF ctestqex NE 0 THEN BEGIN 
        instru_names = qexst.instru_names(testqex)
        filt_names = qexst.filt_names(testqex)
        wav = qexst.wav(testqex)
        values = qexst.values(testqex)
        sigma = qexst.sigma(testqex)
        qexst={instru_names:instru_names,filt_names:filt_names,wav:wav,values:values,sigma:sigma}
    ENDIF 
    ENDELSE
    uexzone:
    ans=''
    uexst.values=ext.EXT_U
    uexst.sigma=sqrt(abs(ext.sigextUU))
    ;Testig if there is EXT_P data. If not return empty value and end loop.
d012e324   Ilyes Choubani   FIX to the use of...
311
    ind = where(ext.EXT_U NE la_undef() and finite(ext.EXT_U) EQ 1 and ext.sigextUU NE la_undef() and finite(ext.sigextUU) EQ 1,NU_ext) ;Testing if the data and errors are set
09e61d64   Ilyes Choubani   cleaned set_data ...
312
313
314
315
316
317
318
319
320
321
322
323
    IF NU_ext EQ 0 THEN BEGIN
        uexst = ptr_new()
        goto, end_ext
    ENDIF ELSE BEGIN
    ind = where(finite(ext.EXT_U) EQ 0 or finite(ext.sigextUU) EQ 0, countnokuex) ;Format is not okay if there are nan values but the wrapper recognizes the la_undef() value 
    IF countnokuex NE 0 THEN BEGIN 
        message, "SED format isn't met. NaN value(s) detected in EXT_I data.",/continue
        message, 'Without automatic format fitering you cannot proceed.',/continue
        ans=''
        read, ans, prompt='Would you like automatic format filtering? (Y/N):' 
        IF strupcase(ans) EQ 'N' THEN BEGIN
            message,'You have chosen not to use automatic filtering. Please adjust the SED format.',/continue
266ae799   Ilyes Choubani   General update
324
            message, 'Aborting ...'
09e61d64   Ilyes Choubani   cleaned set_data ...
325
326
327
328
        ENDIF
    ENDIF
    IF strupcase(ans) EQ 'Y' THEN message, 'You have chosen automatic format filtering. Removal of undefined data points...',/continue $
    ELSE message, 'Data format is met. Removal of undefined data points...',/continue
d012e324   Ilyes Choubani   FIX to the use of...
329
    testuex=where(ext.sigextUU NE 0. and finite(ext.sigextUU) EQ 1 and ext.sigextUU NE la_undef() and ext.EXT_U NE la_undef() and finite(ext.EXT_U) EQ 1,ctestuex)                
09e61d64   Ilyes Choubani   cleaned set_data ...
330
331
332
333
334
335
336
337
338
339
340
341
342
343
    IF ctestuex NE 0 THEN BEGIN 
        instru_names = uexst.instru_names(testuex)
        filt_names = uexst.filt_names(testuex)
        wav = uexst.wav(testuex)
        values = uexst.values(testuex)
        sigma = uexst.sigma(testuex)
        uexst={instru_names:instru_names,filt_names:filt_names,wav:wav,values:values,sigma:sigma}
    ENDIF 
    ENDELSE
    end_ext:
ENDIF


RETURN, 0.
9ee42e40   Ilyes Choubani   fixed small bugs
344
;stop
09e61d64   Ilyes Choubani   cleaned set_data ...
345
346

END