pro puffy_events_ramp_diff_slideshow

;This script will attempt to locate the events on the H2RG-015 that are attributed
;to electron-hole pairs in the CdZnTe 800 um substrate

;File numbers.  These are the two files that will be differenced and used
file_number_1='dark_160K_33_min_1_10.0_18.fits'


file_number_2='dark_160K_33_min_1_10.0_19.fits'

readsnum=32
readsstr=string(readsnum,format='(I3)')

file_name_1='dark_160K_33_min_1_0.0_18.fits'
file_name_2='dark_160K_33_min_1_0.0_19.fits'

numpixrd=2048.*2048.    ;Size of device
threshold=1000       ;Threshold to flag pixel as Cosmic Ray

;Enter the directory that holds the dark current files for the device
cd,'/a/pippin01/Volumes/u08/lsst/sipinrockwell/65_Meg_Files'

for read_num=0,readsnum do begin

;Take in section of one file as the vector x and the section of another file
;as the vector x2
fits_read,file_name_1,x1,first=long(read_num*numpixrd),last=long((read_num+1)*numpixrd)-1
fits_read,file_name_2,x2,first=long(read_num*numpixrd),last=long((read_num+1)*numpixrd)-1

;Since x and x2 are one-dimensional vectors, we need to turn them into 2-dimensional
;arrays where the size of each dimension is 2048

im1=reform(float(x1),2048.,2048.)
im2=reform(float(x2),2048.,2048.)
diff=float(im2-im1)

tv,bytscl(congrid(diff,1024,1024),min=-1000,max=1000)

endfor

end


