	PRO Y_CHECKER, COL, YCO, Y_SIZ, CUTOFF, Y_RAY, ARB_AMOUNT, $
			ANY_DROPOUTS
;+
; Project     : SOHO - CDS
;
; Name        : Y_CHECKER
;
; Purpose     : A routine called by COSMIC_RAY_ZAPPER.
;
; Category    : Analysis
;
; Explanation : When looking for spikes in the Y direction, I've made things 
;		a bit more involved because sometimes spikes are not a single 
;		pixel but a pair of pixels next to each other. Suppose we have 
;		4 adjacent pixels with counts a, b, c, d. Then if b and c are 
;		both part of the cosmic ray and s.t. b,c>>a,d then comparing 
;		b directly with a and c will not reveal a cosmic ray. 
;		However, by then comparing b with a and d will reveal that b 
;		is a cosmic ray and so it will be flagged.
;
;		In comparing with a and d, I'm using a stronger cutoff 
;		criterion.
;
; Syntax      : Y_CHECKER, COL, YCO, Y_SIZ, CUTOFF, Y_RAY, ARB_AMOUNT, $
;			ANY_DROPOUTS
;
; Inputs      : COL	= if the potential cosmic ray is at (L0,X0,Y0), then 
;			  COL is simply the ARR(L0,X0,*)
;
;		YCO	= in the above notation, YCO is Y0
;
;		Y_SIZ	= the size of the COL
;
;		CUTOFF	= same as in COSMIC_RAY_ZAPPER
;
;		Y_RAY	= the flag for signalling a cosmic ray
;
;		ARB_AMOUNT	= set in COSMIC_RAY_ZAPPER and used to replace
;				  any zero values in U
;
;		ANY_DROPOUTS	= 0 if no drop-outs in the data array
;				  1 if drop-outs in data array
;
; Calls       : RAY_NEIGHBOUR
;
; Restrictions: COL must have dimension greater than 1
;		
; Side effects: 
;
; Prev. Hist. : 
;
; History     : Version 1, 15/9/96 	PRY 
;
; Contact     : Peter Young,  Cambridge University
;-

; -----------------
; When checking pixels two away from the pixel of interest, require a
; stronger cutoff criterion, hence define cutoff2
;
cutoff2=1.5*cutoff  &  y_ray=0

; Call ray_neighbour to create the "background" vector.
;
ray_neighbour,col,col_av,arb_amount,any_dropouts

; ------------------
; Do the standard check to see if we have a single pixel cosmic ray
;
if ( col(yco)/col_av(yco) - 1 ) gt cutoff then begin
;
  y_ray=1

; ------------------
; If it's not a single pixel CR then it may be a double pixel one
;
endif else begin

  case yco of

  0: if ( col(yco)/abs(col(2)) - 1) gt cutoff2 then y_ray=1

  y_siz-1: begin
             if col(yco+1) gt col(yco-1) then begin
               if ( col(yco)/abs(col(yco-1)) - 1) gt cutoff2 then y_ray=1
             endif
           end

  y_siz: 	; this may look strange but it's meant to be like this!

  else: begin
          bob=abs(average([col(yco-1),col(yco+2)]))
          if bob eq 0. then bob=arb_amount
          if (col(yco)/bob-1) gt cutoff2 then y_ray=1
        end

  endcase

endelse

end
