pro get_peak,data,s,c,f25,f26
;+
;
;  Procedure returns peak count in spectral arrays (avoiding end dump bin).
;  Values can be decompressed before return if requested.
;
;  Input:   DATA  - array as returned by test_rd
;
;  Output:  S    }
;           C    }  1-d arrays containing the peak value in
;           F25  }  each channel of each spectrum
;           F26  }
;
;
;  Use:
;          IDL>   get_peak,data,s,c,f25,f26
;
;
;  Limitations:    Assumes 256/256/128/128 binning in each spectrum.
;
;
;  CDP Dec 91
;-

sss = size(data)
s = intarr(sss(2))
c = intarr(sss(2))
f25 = intarr(sss(2))
f26 = intarr(sss(2))

ans = ' '
read,'Decompress before finding peaks? ',ans

for i=0,sss(2)-1  do begin
   s(i) = max(data(640:766,i))
   c(i) = max(data(512:638,i))
   f25(i) = max(data(256:510,i))
   f26(i) = max(data(0:254,i))
endfor
if strupcase(ans) eq 'Y' then begin
   s   = bcs_decomp(s)
   c   = bcs_decomp(c)
   f25 = bcs_decomp(f25)
   f26 = bcs_decomp(f26)
endif

end

