Viewing contents of file '../idllib/ghrs/pro/calfos_ccs6.pro'
pro calfos_ccs6,name,config,h,coef
;+
; CALFOS_ccs6
;
; Read dispersion coef. table
;
; CALLING SEQUENCE:
; calfos_ccs6,name,config,h,coef
;
; INPUTS:
; name - ccs6 table name
; config - configuration vector (from CALFOS_RD)
;
; INPUT/OUTPUTS:
; h - FITS header for the observation
; OUTPUTS:
; coef - dispersion coefficients (6 x 2 array)
; coef(*,0) - upper or single aperture or pass_dir=1
; coef(*,1) - lower aperture or pass_dir=2
; coef(N,*) - COEFF_N (N=0,4)
; coef(5,*) - XZERO
;
; HISTORY:
; version 1.0 D. Lindler Jan 1990
;-
;---------------------------------------------------------------------------
;
; read table
;
fname = strtrim(name)
if fname eq '' then return ;Do we need the values?
tab_read,fname,tcb,tab
;
; add history
;
hist = 'Dispersion coefficient table: '+fname
sxaddhist,hist,h
if !dump gt 0 then print,hist
;
; extract columns to be searched
;
detector = strtrim(config(0))
fgwa_id = strtrim(config(3))
aper_id = strtrim(config(1))
polar_id = strtrim(config(2))
fgwa = tab_val(tcb,tab,'FGWA_ID')
aper = tab_val(tcb,tab,'APER_ID')
det = tab_val(tcb,tab,'DETECTOR')
polar = tab_val(tcb,tab,'POLAR_ID')
if polar_id eq 'C' then aper_pos = tab_val(tcb,tab,'APER_POS') $
else pass_dir = tab_val(tcb,tab,'PASS_DIR')
nrows = n_elements(polar)
;
; search table for correct configuration
;
coef = replicate (1.0d38,6,2)
for i=0,nrows-1 do begin
if (strtrim(fgwa(i)) eq fgwa_id) then $
if (strtrim(det(i)) eq detector) then $
if (strtrim(aper(i)) eq aper_id) then $
if (strtrim(polar(i)) eq polar_id) then begin
c = dblarr(6)
for k=0,4 do c(k)=tab_val(tcb,tab,'COEFF_'+strtrim(k,2),i)
if fgwa_id eq 'PRI' then c(5)=tab_val(tcb,tab,'XZERO',i)
if polar_id eq 'C' then begin
case strtrim(aper_pos(i)) of
'UPPER': coef(0,0) = c
'LOWER': coef(0,1) = c
'SINGLE':coef(0,0) = c
else:
endcase
end else begin
case pass_dir(i) of
1 : coef(0,0) = c
2 : coef(0,1) = c
else:
endcase
end
endif
endfor
return
end