Viewing contents of file '../idllib/ghrs/pro/calhrs_blem.pro'
pro calhrs_blem,table,ih,epsilon,log
;+
; calhrs_blem
;
; Subroutine of CALHRS which flags photocathode blemishes
;
; CALLING SEQUENCE:
; calhrs_blem,table,ih,epsilon,log
;
; INPUTS:
; table - name of blemish table containing the following columns
; DETECTOR - detector number
; LINE1 - starting line of the blemish
; LINE2 - ending line of the blemish
; SAMPLE1 - starting sample of the blemish
; SAMPLE2 - ending sample of the blemish
; EPSILON - epsilon flag for the blemish
; ih - header array 128 x n
; INPUT/OUTPUT:
; epsilon - epsilon vectors
; log - history log
;
; HISTORY:
; version 1 D. Lindler May 1992
; 17-jun-1992 JKF/ACC - fixed problem with subscripts.
;-
;--------------------------------------------------------------------------
VERSION = 2.0
;
; read input table
;
table = strtrim(table,2)
table_ext,table,'DETECTOR,LINE1,LINE2,SAMPLE1,SAMPLE2,EPSILON', $
det,line1,line2,sample1,sample2,epsval
hist = 'CALHRS_BLEM version '+string(version,'(f5.2)')+ $
': Photocathode blemish table '+table
if !dump gt 0 then printf,!textunit,hist
if n_elements(log) gt 0 then sxaddhist,hist,log
;
; extract detector, line and sample positions of the data
;
n = n_elements(ih)/128
detector = ih(31)
line = float(ih(74:75,*),0,n)
samp0 = float(ih(70:71,*),0,n)
deltas = float(ih(72:73,*),0,n)
;
; extract positions for the given detector
;
good = where(det eq detector,ngood)
if ngood lt 1 then return
line1 = line1(good)
line2 = line2(good)
sample1 = sample1(good)
sample2 = sample2(good)
epsval = epsval(good)
;
; loop on bins of data
;
for ibin = 0,n-1 do begin
good = where((line(ibin) ge line1) and (line(ibin) le line2),ngood)
if ngood ge 1 then begin
;
; convert blemish sample positions to index positions
; JKF/ACC 6/17/92 - added index to samp0 and deltas.
;
index1 = fix((sample1(good) - samp0(ibin))/deltas(ibin))>0
index2 = fix((sample2(good) $
- samp0(ibin))/deltas(ibin)+ 1.0)<499
for i = 0,ngood-1 do begin
i1 = index1(i)+6 ;add 6 for the special diodes
i2 = index2(i)+6
eps = epsval(good(i))
if (i2 ge 0) and (i1 le 499) then $
epsilon(i1:i2,ibin) = epsilon(i1:i2,ibin) > eps
end
end
end; for loop on ibin
return
end