Viewing contents of file '../idllib/ghrs/pro/calfos_ccs1.pro'
pro calfos_ccs1,name,config,pattern,h,gpar,ypos
;+
; CALFOS_ccs1
;
; Read aperture position table
;
; CALLING SEQUENCE:
; calfos_ccs1,name,config,h,ypos
;
; INPUTS:
; name - ccs1 table name
; config - configuration vector (from CALFOS_RD)
; pattern - pattern vector (from calfos_rd)
;
; INPUT/OUTPUTS:
; h - FITS header for the observation
; gpar - group parameter blocks
;
; OUTPUTS:
; ypos - vector of ybase positions
; ypos(0) = upper
; ypos(1) = lower
;
; 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 = 'Aperture ybase 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))
det = tab_val(tcb,tab,'DETECTOR')
fgwa = tab_val(tcb,tab,'FGWA_ID')
nrows = n_elements(det)
;
; search table for correct detector and aper_id
;
for i=0,nrows-1 do begin
if (strtrim(fgwa(i)) eq fgwa_id) and $
(strtrim(det(i)) eq detector) then goto,found
endfor
print,'CALFOS_CCS1- no row found in ccs1 for '+detector+' '+fgwa_id
retall
;
; read values
;
found:
ypos = fltarr(2)
ypos(0) = tab_val(tcb,tab,'YUPPER',i)
ypos(1) = tab_val(tcb,tab,'YLOWER',i)
;
; update aper_pos in the group parameters
;
v = sxgpar(h,gpar(*,0,0),'APER_POS',dtype,sbyte)
nframes = pattern(9)*pattern(10)
ysteps = pattern(6)
y = pattern(5)*32.0/ysteps*findgen(ysteps)+pattern(4)
upper = abs(ypos(0)-y) lt abs(ypos(1)-y)
positions = byte(['LOWER ','UPPER '])
for i=0,nframes-1 do for ystep = 0,ysteps-1 do $
gpar(sbyte,ystep,i) = positions(*,upper(ystep))
return
end