Pro tvgeantimage,date=date,SingleImage=SingleImage

If (not keyword_set(SingleImage)) then SingleImage = 1
If (not keyword_set(date)) then date = '11'

;PRIMITIVE SUBTRACTION AND FLAT FIELD
CalibrationDir='/nfs/slac/g/ki/ki08/lsst/CPcampaign/SOAR/2005-05-09/'+$
	      'Calibration/Images/'
BiasFrameFile=CalibrationDir+'Zero09May2005.fits'
fits_read,BiasFrameFile,Bias,BiasHeader
FlatFrameFile=CalibrationDir+'SFlat_09May2005R.fits'
fits_read,FlatFrameFile,Flat,FlatHeader
FlatNormal=float(Flat)/max(Flat)
ZeroFrameFile='/nfs/slac/g/ki/ki08/lsst/CPcampaign/SOAR/2005-05-09/'+$
              'Raw/zero.1024.fits'
fits_read,ZeroFrameFile,ZeroFrame,ZeroHeader
;SOAR IMAGES IN RESPECTIVE 2005-05-{9,10,11,12} DIRECTORIES
SOARDir='/nfs/slac/g/ki/ki08/lsst/CPcampaign/SOAR/2005-05-'+Date+$
	'/Raw/'
SOARFiles=file_search(SOARDir+'*.fits',count=NumSOARFiles)

for i=0, NumSOARFiles-2 do begin
  fits_read,SOARFiles(i),Im1,header1
  fits_read,SOARFiles(i+1),Im2,header2
  Diff=float(Im2)-float(Im1)
  ExpTime=SXPAR(header1,'EXPTIME')
  WindDir=SXPAR(header1,'WINDDIR')
  TimeObs=SXPAR(header1,'TIME-OBS')
  TelFocus=SXPAR(header1,'TELFOCUS')
  print,"Exposure Time =    " , ExpTime
  print,"Observation Time=  " , TimeObs
  print,"Telescope Focus=   " , TelFocus
  if SingleImage eq 1 then begin
    SatPix=where(Im1 gt 50000)
    Im1(SatPix)=0      		  ;BAD PIXELS
    Im1(0:1536)=0                  ;TWO BAD ROWS 
    tvscl,congrid(Im1,256,1024,/center)
  endif else begin
    tvscl,congrid(Diff,512,1024,/center)
  endelse
  stop
endfor

end
