-
Notifications
You must be signed in to change notification settings - Fork 1
/
type.pro
526 lines (379 loc) · 13.1 KB
/
type.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
pro type, Input_file,file=file
; NAME:
; TYPE
;
; PURPOSE:
; This procedure uses flags set in the input file to create postscript
; figures of the spectra plotted between spectral standards.
;
; CALLING SEQUENCE:
;
; TYPE, Input_file
;
; INPUTS:
; Input_file: Two column ascii file that contains the file names of
; ascii spectra and a type flag.
;
; OUTPUTS:
; Creates 2-page postscript figures for each object listed in the Input_file.
;
; PROCEDURE:
; Normalizes L dwarfs at 8250 A, Ms at 8100 A, and Carbon stars at 7500 A.
; The file name listed in the Input_file is used as the object name.
;
; ROUTINES CALLED:
; avg_flux.pro
; Also uses standards.dat and stan_giants.dat
;
; TO DO:
; Add young comparison (0141, giants?)
;
;
; MODIFICATION HISTORY:
; Written by: Kelle Cruz, July 2002
;-
if N_params() lt 1 then begin
print,"Syntax - type, 'file'"
print, ''
print,'The input file consists of two columns, the file name and the'
print,'number giving the rough initial spectral type according to the'
print,'following key:'
print, ''
; print,' young'
print,'-4 WD'
print,'-3 not typed'
print,'-2 carbon'
print,'-10 early giant'
print,'-11 mid giant'
print,'-12 late giant'
print,'0 M1.5 - M5.5'
print,'1 M4.5 - M7'
print,'2 M6 - M8'
print,'3 M7 - M9'
print,'4 M8 - L1'
print,'5 L0 - L3'
print,'6 L2 - L5'
print,'7 L4 - L7'
print,'8 L5 - L8'
return
endif
;root='/data/hillary/1/kelle/idl/kellepro/'
root='/Users/kelle/Library/IDL/kellepro/'
EG_f=root + 'EG274.dat'
restore, EG_f
restore, root + 'standards.dat'
restore, root + 'stan_giants.dat'
one_line = dblarr(2)
file_line = ''
openr, unit, Input_file,/get_lun
WHILE NOT EOF(unit) DO BEGIN
;print, ''
READF, unit, file_line
info=strsplit(file_line,/extract)
data_file=info(0)
early=fix(info(1))
;print, data_file,early
;print, file, early
IF early ne -3 THEN BEGIN
;-4 plotted next to WD
;-3 is not typed
;-2 is carbon
;-10 is early giant
;-11 is mid giant
;-12 is late giant
;0 M1.5 - M5.5
;1 M4.5 - M7
;2 M6 - M8
;3 M7 - M9
;4 M8 - L1
;5 L0 - L3
;6 L2 - L5
;7 L4 - L7
;8 L5 - L8
;obj_pos=strpos(data_file,'.txt')
;object=strmid(data_file,0,obj_pos))[0]
IF STRMATCH(data_file, '*.fit*', /FOLD_CASE) eq 1 then extn='fits' ELSE ext = 'txt'
;extn=(strsplit(data_file,'.',/extract))[1]
file_name=file_basename(data_file,'.'+extn)
;file_name=(strsplit(data_file,'.',/extract))[0]
IF extn EQ 'txt' THEN BEGIN
;object=(strsplit(data_file,'.txt',/extract,/regex))[0]
object=file_name
data=READSPEC_TXT(data_file)
telescope = ''
date_obs= ''
flux_unit='?'
ENDIF ;if file type .txt
IF extn EQ 'fits' THEN BEGIN
data=KREADSPEC(data_file,h,/silent)
;file=SXPAR(h,'FILE')
pix_scale=SXPAR(h,'CD1_1',scalecount)
object = STRCOMPRESS(strtrim(sxpar(h,'OBJECT'),2),/remove_all)
IF keyword_set(file) then object_file = file_name else $
object_file = object
IF object eq '0' then object = file_name
telescope = sxpar(h,'TELESCOP')
date_obs = sxpar(h,'DATE-OBS',count=datecount,/silent)
;print, date_obs, datecount
;IF datecount EQ 0 THEN date_obs = sxpar(h,'DATE',count=datecount)
;IF datecount EQ 0 THEN date_obs = sxpar(h,'DATE-OBS',count=datecount)
;print, date_obs
flux_unit=SXPAR(h,'BUNIT', count=fluxcount)
if fluxcount eq 0 then flux_unit='?'
;print, flux_unit
ENDIF ;if file type .fits
print, object
;stop
flux=data[1,*]
w=data[0,*]
;IF n_elements(pix_scale) EQ 0 THEN pix_scale=w[1]-w[0]
IF max(w) le 9000 then xtop=max(w) ELSE xtop=10000.
xr=[6000,xtop]
if xtop gt 9000 THEN es=1 ELSE es=0
;NORMALIZE
IF early eq 4 THEN BEGIN
startw = 8080. & endw = 8155.
;a = where(w ge startw-pix_scale/2 AND w le endw+pix_scale/2)
;num = avgflux(startw,endw, w, flux)
;nf1=flux/num
nf1=NORM_SPEC(w, flux, startw, endw)
startw = 8240. & endw = 8260.
;a = where(w ge startw-pix_scale/2 AND w le endw+pix_scale/2)
;num = avgflux(startw,endw, w ,flux)
;nf2=flux/num
nf2=NORM_SPEC(w, flux, startw, endw)
ENDIF
;carbon
;change to 7500
IF early eq -2 THEN BEGIN & startw = 7490. & endw = 7510.
ENDIF
;Ms (dwarfs and giants)
IF (early lt 4 AND early ge 0) OR (early le -10) THEN BEGIN & startw = 8080. & endw = 8155.
ENDIF
;Ls
IF early gt 4 THEN BEGIN & startw = 8240. & endw = 8260.
ENDIF
;wd
IF early eq -4 THEN BEGIN & startw = 7000. & endw = 7200.
ENDIF
;a = where(w ge startw-pix_scale/2 AND w le endw+pix_scale/2)
;num = avgflux(startw, endw, w, flux)
;nf=flux/num
nf=NORM_SPEC(w, flux, startw, endw)
!p.font=0
set_plot, 'ps'
device, filename=object_file+'.ps', encapsulated=0, /helvetica,/isolatin1,/landscape, $
xsize=10.5, ysize=8.0,/inches, xoffset=0.3, yoffset=10.7
angstrom=STRING(197B)
!x.title='Wavelength '+'('+angstrom+')'
!y.title='Flux ('+flux_unit+')'
;CARBON
IF early eq -2 then begin
plot, w, nf
feat,/lowg
xyouts, 6100, 1.0, object, charsize=2
;plot,c6_w,c6_fn,xr=xr, yr=[0,4]
;oplot, w, nf+1.5
;xyouts,6100, 1.5, 'C6 HD 92055', charsize=1.5
;xyouts, 6100, 3.5, object, charsize=2
ENDIF
;WHITE DWAARF
IF early eq -4 THEN BEGIN
plot, w, nf,yr=[0,4],xr=xr,xstyle=1
oplot, eg274_w,eg274_fn+2
;Halpha
oplot, [6563,6563],[1.0,0.8], linestyle=1
xyouts, 6100, 3.5, 'EG 274', charsize=1.5
xyouts, 6100, 2, object, charsize=2
ENDIF
;---------------
; GIANTS
;---------------
;K5 III HD 133774
;M2 HD 120052
;M4 HD 80431
;M0 III HD 95578
IF early eq -10 OR early eq -1 THEN BEGIN
w1=m0_w & f1=m0_fn
l1='M0 III HD 95578'
w2=k5_w & f2=k5_fn
l2='K5 III HD 133774'
w3=m2_w & f3=m2_fn
l3= 'M2 III HD 120052'
w4=m0_w & f4=m0_fn
l4= 'M0 III HD 95578'
ENDIF
IF early eq -11 THEN BEGIN
w1=m4_w & f1=m4_fn
l1='M4 III HD 80431'
w2=m2_w & f2=m2_fn
l2='M2 III HD 120052'
w3=m7_w & f3=m7_fn
l3='M7 III VY Peg'
w4=m4_w & f4=m4_fn
l4='M4 III HD 80431'
ENDIF
IF early eq -12 THEN BEGIN
w1=m8_w & f1=m8_fn
l1='M8 III BR 0954-0947'
w2=m7_w & f2=m7_fn
l2='M7 III VY Peg'
w3=m9_w & f3=m9_fn
l3= 'M9 III BR 1219-1336'
w4= m8_w & f4=m8_fn
l4='M8 III BR 0954-0947'
ENDIF
IF early LE -10 THEN BEGIN
plot, w1,f1,xr=xr, yr=[0,3], xstyle=1
oplot, w, nf+0.85
oplot, w2,f2+1.75
feat,/lowg
xyouts,6100, 0.8, l1, charsize=1.5
xyouts, 6100, 1.9, object, charsize=2
xyouts, 6100, 2.7, l2, charsize=1.5
plot, w3,f3,xr=xr, yr=[0,3], xstyle=1
oplot, w, nf+0.85
oplot, w4,f4+1.75
feat,/lowg
xyouts,6100, 0.5, l3, charsize=1.5
xyouts, 6100, 1.8, object, charsize=2
xyouts, 6100, 2.6, l4, charsize=1.5
ENDIF
;----------
;EARLY Ms
;---------
IF early eq 0 then begin
plot, m25_w,m25_fn, xr=xr, yr=[0,3], xstyle=1
oplot, w, nf+0.85
oplot, m15_w,m15_fn+1.75
feat,/lowg
xyouts,6100, 0.6, 'M2.5 Gl 250 B', charsize=1.5
xyouts, 6100, 1.6, object, charsize=2
xyouts, 6100, 2.6, 'M1.5 Gl 205', charsize=1.5
XYOUTS, 0.75,0.92, telescope,/NORMAL
XYOUTS, 0.75,0.89, date_obs, /NORMAL
ENDIF
IF early eq 1 OR early eq 0 then begin
plot, m55_w,m55_flux_n, xr=xr, yr=[0,3], xstyle=1
oplot, w, nf+0.85
oplot, m45_w,m45_flux_n+1.75
feat, /lowg
xyouts,6100, 0.6, 'M5.5 Gl 65', charsize=1.5
xyouts, 6100, 1.6, object, charsize=2
xyouts, 6100, 2.6, 'M4.5 Gl 83.1', charsize=1.5
XYOUTS, 0.75,0.92, telescope,/NORMAL
XYOUTS, 0.75,0.89, date_obs, /NORMAL
ENDIF
IF early eq 1 OR early eq 2 THEN BEGIN
plot, m7_lambda,m7_flux_n, xr=xr, yr=[0,3], xstyle=1
oplot, w, nf+0.75
oplot, m6_lambda,m6_flux_n+1.75
feat
xyouts,6100, 0.3, 'M7 VB 8', charsize=1.5
xyouts, 6100, 1.3, object, charsize=2
xyouts, 6100, 2.2, 'M6 LHS 1326', charsize=1.5
XYOUTS, 0.75,0.92, telescope,/NORMAL
XYOUTS, 0.75,0.89, date_obs, /NORMAL
ENDIF
IF early eq 2 OR early eq 3 then begin
if es eq 0 then ym=3 else ym=4
plot, m8_lambda,m8_flux_n, xr=xr, yr=[0,ym], xstyle=1
oplot, w, nf+0.75+0.3*es
oplot, m7_lambda,m7_flux_n+1.75+0.5*es
feat
xyouts,6100, 0.3, 'M8 VB 10', charsize=1.5
xyouts, 6100, 1.3+0.3*es, object, charsize=2
xyouts, 6100, 2.2+0.5*es, 'M7 VB8', charsize=1.5
XYOUTS, 0.75,0.92, telescope,/NORMAL
XYOUTS, 0.75,0.89, date_obs, /NORMAL
ENDIF
IF early eq 3 OR early eq 4 THEN BEGIN
if es eq 0 then ym=3 else ym=5
plot, m9_lambda,m9_flux_n, xr=xr, yr=[0,ym], xstyle=1
IF early eq 4 then oplot, w, nf1+0.85+1.1*es else oplot, w, nf+0.85+1.1*es
oplot, m8_lambda,m8_flux_n+1.75+1.5*es
feat,1.
xyouts,6100, 0.4, 'M9 LHS 2065', charsize=1.5
xyouts, 6100, 1.3+1.1*es, object, charsize=2
xyouts, 6100, 2.2+1.5*es, 'M8 VB 10', charsize=1.5
XYOUTS, 0.75,0.92, telescope,/NORMAL
XYOUTS, 0.75,0.89, date_obs, /NORMAL
ENDIF
IF early eq 4 OR early eq 5 THEN BEGIN
if es eq 0 then ym=2.5 else ym=4
plot, L1_w,L1_fn, xr=xr, yr=[0,ym], xstyle=1
IF early eq 4 then oplot, w, nf2+0.5+0.5*es else oplot, w, nf+0.5+0.5*es
oplot, L0_w,L0_fn+1.2+0.5*es
feat
xyouts,6100, 0.2, 'L1 2M1439', charsize=1.5
xyouts, 6100, 0.9+0.5*es, object, charsize=2
xyouts, 6100, 1.5+0.5*es, 'L0 2M0345', charsize=1.5
XYOUTS, 0.75,0.92, telescope,/NORMAL
XYOUTS, 0.75,0.89, date_obs, /NORMAL
ENDIF
IF early eq 5 OR early eq 6 THEN BEGIN
if es eq 0 then ym=2.5 else ym=4.5
plot, L3_w,L3_fn, xr=xr, yr=[0,ym], xstyle=1
oplot, w, nf+0.6+0.4*es
oplot, L2_w,L2_fn+1.3+0.8*es
feat
xyouts,6100, 0.2, 'L3 DENIS 1058', charsize=1.5
xyouts, 6100, 0.9+0.6*es, object, charsize=2
xyouts, 6100, 1.6+0.8*es, 'L2 Kelu 1', charsize=1.5
XYOUTS, 0.75,0.92, telescope,/NORMAL
XYOUTS, 0.75,0.89, date_obs, /NORMAL
ENDIF
IF early eq 6 OR early eq 7 THEN BEGIN
if es eq 0 then ym=4 else ym=6
plot, L5_D1228_w,L5_D1228_fn+0.1, xr=xr, yr=[0,ym], xstyle=1
oplot, w, nf+1.1+0.3*es
oplot, L4_w,L4_fn+2.4+0.3*es
feat
xyouts,6100, 0.4, 'L5 DENIS 1228', charsize=1.5
xyouts, 6100, 1.5+0.3*es, object, charsize=2
xyouts, 6100, 2.8+0.3*es, 'L4 2M1155', charsize=1.5
XYOUTS, 0.75,0.92, telescope,/NORMAL
XYOUTS, 0.75,0.89, date_obs, /NORMAL
ENDIF
IF early eq 7 THEN BEGIN
if es eq 0 then ym=5 else ym=7
plot, L7_D0205_w,L7_D0205_fn+0.25, xr=xr, yr=[0,ym], xstyle=1
oplot, w, nf+1.7+0.7*es
oplot, L6_w,L6_fn+3.0+1.3*es
feat
xyouts,6100, 0.7, 'L7 DENIS 0205', charsize=1.5
xyouts, 6100, 2.4+0.7*es, object, charsize=2
xyouts, 6100, 3.4+1.3*es, 'L6 2M0850', charsize=1.5
ENDIF
IF early eq 8 THEN BEGIN
if es eq 0 then ym=5 else ym=8
plot, L6_w,L6_fn+0.10, xr=xr, yr=[0,ym], xstyle=1
oplot, w, nf+1.4+0.7*es
oplot, L5_D1228_w,L5_D1228_fn+3.2+0.7*es
feat
xyouts,6100, 0.4, 'L6 2M0850', charsize=1.5
xyouts, 6100, 2.2+0.7*es, object, charsize=2
xyouts, 6100, 3.5+0.7*es, 'L5 DENIS 1228', charsize=1.5
XYOUTS, 0.75,0.92, telescope,/NORMAL
XYOUTS, 0.75,0.89, date_obs, /NORMAL
plot, L8_w,L8_fn+0.1, xr=xr, yr=[0,ym], xstyle=1
oplot, w, nf+1.8+0.3*es
oplot, L7_D0205_w,L7_D0205_fn+3.6+0.1*es
feat
xyouts,6100, 0.75, 'L8 2M1632', charsize=1.5
xyouts, 6100, 2.75+0.3*es, object, charsize=2
xyouts, 6100, 4.5+0.1*es, 'L7 DENIS 0205', charsize=1.5
ENDIF
;On second page
XYOUTS, 0.80,0.92, telescope,/NORMAL
XYOUTS, 0.80,0.89, date_obs, /NORMAL
device, /close
ENDIF ;early ne -3
ENDWHILE
close, unit
free_lun,unit
set_plot, 'x'
!x.title=0
!y.title=0
;stop
END