-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhql.pro
111 lines (87 loc) · 2.39 KB
/
hql.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
pro hql,im,x,y,palette=palette,chaindir=chaindir
;+
; HORuS quick-look extraction
;
;
;-
if n_params() lt 1 then begin
print,'% HQL: use -- hql,image[,palette=palette]'
return
endif
if not keyword_set(palette) then palette=12
;basic dir/files
home=getenv('HOME')
if not keyword_set(chaindir) then chaindir=home+'/idl/chain'
;read image, convert to e-, and compute variance
d=readfits(im,hd)
n=sxpar(hd,'NAXIS')
n1=sxpar(hd,'NAXIS1')
n2=sxpar(hd,'NAXIS2')
if n ne 2 then begin
print,'%HQG: -- ERROR -- the input HORuS image must be 2D (NAXIS=2)'
return
endif
if n1 eq 514 and n2 eq 2048 then begin
bin=1
endif else begin
if n1 eq 514*8 and n2 eq 2048*2 then begin
bin=0
endif else begin
print,'%HQG: -- ERROR -- the input HORuS image is neither in 1x1 nor in 8x2 binning'
return
endelse
endelse
hbias,d,bin=bin
gain=sxpar(hd,'GAIN')
rdnoise=sxpar(hd,'RDNOISE')
d=d*gain
vd=d+rdnoise^2
;default apertures
idisp=2
ap1=readfits(chaindir+'/rap1.fits',0,hd)
if bin eq 1 then ap1=ap1/3. else ap1=ap1/3./8.
;extract spectrum
collapse1,d,idisp,ap1, xd, vf=vd, vs=xvd
;read reference wavelength solution
norder=27
npix=4096
if bin then npix=npix/2
w=dblarr(norder,npix)
openr,11,chaindir+'/hors_thar.dat'
for i=0,26 do begin
readf,11,i2,nlines,order
coef=dblarr(order+1)
readf,11,coef
xx=poly(dindgen(4088),coef)
xx=interpol(xx,npix)
for j=0,nlines-1 do begin
readf,11,i2,j2,pix,l0
endfor
w[i,*]=xx
endfor
close,11
order=1
step_1=median(w[*,0]-shift(w[*,0],1))
wobject=where(strpos(hd,'OBJECT') gt -1)
if min(wobject) gt -1 then wobject=min(wobject) else wobject=6
window,0,xsize=700,ysize=500
plot,findgen(npix),xd[order-1,*]/mean(xd[order-1,*])+order-1,$
yrange=[0,norder+1],$
ytitle='Aperture',title=hd(wobject),$
charsize=1.2,xcharsize=.01,xrange=[-npix*0.2,npix*1.2],$
xstyle=1,ystyle=1,col=0,back=255,position=[0.2,0.2,0.8,0.8]
loadct,palette
display,transpose(xd/sqrt(xvd)),/noerase,position=[0.15,0.1,0.8,0.8]
colorbar,col=10,charsi=1.5
xyouts,0.4,0.05,'Wavelength (nm)',/normal,charsize=1.5,col=0
xyouts,-npix*0.28,order-1,w[order-1,0],charsi=1.3,col=0
xyouts,npix,order-1,w[order-1,npix-1],charsize=1.3,col=0
for order=1,norder do begin
oplot,findgen(npix),xd[order-1,*]/mean(xd[order-1,*])+order-1,$
col=0
xyouts,-npix*0.28,order-1,w[order-1,0],charsi=1.3,col=0
xyouts,npix,order-1,w[order-1,npix-1],charsize=1.3,col=0
endfor
x=w
y=xd
end