Viewing contents of file '../idllib/astron/contrib/varosi/code/allpro/de_stripe.pro'
function de_stripe, image, DEGREE_POLY=pdeg, SMOOTH=smwid, BOTH=both
;Reduce the even/odd channel amplifier variation (vertical stripes) by using
;Least squares fit to determine the 2nd order polynomial relation
; between adjacent channels.
;Frank Varosi STX @ NASA/GSFC 1991
sim = size( image )
if (sim(0) NE 2) then begin
message,"need an image (2-D matrix)",/INFO
return, image
endif
if N_elements( pdeg ) NE 1 then pdeg=1
imfilt = image
if keyword_set( smwid ) then begin
for i=0,sim(1)-1 do imfilt(i,0) = smooth( image(i,*), smwid>3 )
endif
coefs = fltarr( pdeg+1, sim(1)/2 )
for i=1,sim(1)-2,2 do begin
if keyword_set( both ) then begin
imC = imfilt(i,*)
coef = transpose( poly_fit( [imC,imC], $
[imfilt(i-1,*),imfilt(i+1,*)], $
pdeg, yf,yb, sigma ) )
endif else begin
coef = transpose( poly_fit( imfilt(i,*), imfilt(i-1,*), $
pdeg, yf,yb, sigma ) )
endelse
coefs(0,(i-1)/2) = coef
imfilt(i,*) = poly( image(i,*), coef )
endfor
if !DEBUG then begin
for i=0,pdeg do print,i,stdev( coefs(i,*), m ),m
endif
if keyword_set( smwid ) then begin
for i=0,sim(1)-1,2 do imfilt(i,0) = image(i,*)
endif
return, imfilt
end