;+
; NAME:
;     BLEEDER 
; PURPOSE:
;     Simulate pixel blooming due to saturation. 
; CATEGORY:
;     Yohkoh
; CALLING SEQUENCE:
; INPUTS:
;      IMG_DATA, a floating-point image that may or may not have
;                pixel brightnesses greater than 4095.  If any of
;		 the pixels are greater than 4095, this program 
;                will simulate pixel blooming.  If not, then simply
;                returns the original image. 
; OPTIONAL (KEYWORD) INPUT PARAMETERS:
; OUTPUTS:
;      SIM_SAT_IMG, output image with pixel blooming due to the
;                   saturation.
; COMMON BLOCKS:
; SIDE EFFECTS:
; RESTRICTIONS:
; MODIFICATION HISTORY:
;     29-may-98, DMcK, written to support FILT4_SIM.PRO 
;-
pro bleeder,img_data,sim_sat_img 
sim_sat_img=img_data
xs=n_elements(img_data(*,0))
ys=n_elements(img_data(0,*))
for i=0,ys-2 do begin
	for j=0,xs-1 do begin
	if (sim_sat_img(j,i) ge 4095.) then begin
	  sim_sat_img(j,i+1)=sim_sat_img(j,i+1)+(sim_sat_img(j,i)-4095.)
	  sim_sat_img(j,i)=4095.
	endif
	endfor
endfor 


end
 

