next up previous contents
Next: Procedura che implementa l'algoritmo Up: Codice prodotto Previous: Procedura di cleaning per   Contents

Procedura di cleaning per bad channels

pro cleanch_one,inframe1,frame2
;Procedure for cleaning the values of a bad channel
;This procedure works if the frame has bad rows
on_error,2
frame1=inframe1
frame2=rotate(frame1,1)
frame=rotate(frame1,1)
xc=7    ;x coord of the second bad pixel
yc=1    ;y coord of the first bad pixel
for j=0,!VSIZE-1 do begin  ;0,30 do begin ;
for i=0,!HSIZE-1 do begin  ;30,60 do begin;
 if (i MOD 8) EQ xc AND (j MOD 2) EQ yc then begin
    ;check on the borders 
    ip1 = i+1 
    in1 = i-1
    jp1 = j+1
    jn1 = j-1  
    if ip1 GE !HSIZE then ip1 = !HSIZE-1
    if jp1 GE !VSIZE then jp1 = !VSIZE-1
    if in1 LT 0 then in1 = 0
    if jn1 LT 0 then jn1 = 0     
    ;substitute with the mean of the cross values
    ;print,i,j,frame(i,j)
    vector=fltarr(6)
    vector(0)=frame(in1,jn1)
    vector(1)=frame(in1,jp1)
    vector(2)=frame(ip1,jn1)
    vector(3)=frame(ip1,jp1)
    vector(4)=frame(in1,j)
    vector(5)=frame(ip1,j)
    std=stdev(vector,m)	
    if abs(frame(i,j)-m) GT std*2 then begin 
      frame2(i,j)=(frame(in1,jn1)+frame(in1,jp1)+frame(ip1,jp1) $
                   +frame(ip1,jn1)/4.+frame(in1,j)+frame(ip1,j))/6.
    endif
 endif
endfor
endfor
frame2=rotate(frame2,3)
end



Anna Custo 2002-02-05