Viewing contents of file '../idllib/ghrs/pro/calfos_ccs3.pro'
pro calfos_ccs3,name,config,h,widths
;+
; CALFOS_ccs3
;
; Read filter width table
;
; CALLING SEQUENCE:
; calfos_ccs3,name,config,h,widths
;
; INPUTS:
; name - ccs3 table name
; config - configuration vector (from CALFOS_RD)
;
; INPUT/OUTPUTS:
; h - FITS header for the observation
; widths - 4 element array. On input it contains the strin
; keyword parameter values. On output it contains
; 4 integers widths with missing values filled in.
;
; HISTORY:
; version 1.0 D. Lindler Jan 1990
;-
;---------------------------------------------------------------------------
;
; determine what values were supplied
;
fw = intarr(4)
present = intarr(4)
for i=0,3 do begin
if strtrim(widths(i)) ne '' then begin
present(i) = 1
fw(i) = widths(i)
endif
endfor
widths = fw
if total(present) eq 4 then return ;do we need to read table?
;
; read table
;
fname = strtrim(name)
if fname eq '' then return ;Do we need the widths?
tab_read,fname,tcb,tab
;
; add history
;
hist = 'Filter width table: '+fname
sxaddhist,hist,h
if !dump gt 0 then print,hist
;
; extract columns to be searched
;
detector = strtrim(config(0))
det = tab_val(tcb,tab,'DETECTOR')
nrows = n_elements(det)
;
; search table for correct detector
;
for i=0,nrows-1 do if strtrim(det(i)) eq detector then goto,found
print,'CALFOS_CCS3 -- no row for '+detector+' found in '+fname
retall
found:
if not present(0) then widths(0) = tab_val(tcb,tab,'BCK_MD',i)
if not present(1) then widths(1) = tab_val(tcb,tab,'BCK_MN',i)
if not present(2) then widths(2) = tab_val(tcb,tab,'SKY_MD',i)
if not present(3) then widths(3) = tab_val(tcb,tab,'SKY_MN',i)
return
end