PRO combine_sbcdrk ; combine dark images ; fildat = 'sbcdark.dat' imageout = 'sbcdark.fits' immask = 'hotpix.fits' badthresh = 4 ; number of images in which pixel ; is hot for it to be considered bad idval = [4829, 4856, 4875, 4888, 4900, 4912, 4924, 4948, 4953, 4968] nid = n_elements(idval) - 1 expstart = 0.0*idval exptime = 0.0d0*idval sbctemp = 0.0d0*idval rate = 0.0d0*idval nhot = 0*idval dsum = fltarr(1024,1024) badct = intarr(1024,1024) badrate = 0.0005 ; 5x expected dark rate badim = 0.0*badct + 1 openw,1,fildat dbopen,'acs_log' printf,1,' ID FILTER3 Date time texp Tsbc mglobal nhot' print,' ID FILTER3 Date time texp Tsbc mglobal nhot' FOR i = 0, nid DO BEGIN acs_read,idval[i],h,d sbctemp[i] = sxpar(h,'sbctemp') mjd = float(dbval(idval[i],'expstart')) mjd_to_date,mjd,doy,date datestr = date_conv(date,'s') expstart[i] = date exptime[i] = sxpar(h,'exptime') filt3 = sxpar(h,'filter3') good = where(d LT ((badrate*exptime[i]) > 5), ngood) badct = badct + badim badct(good) = badct(good) - 1 rate[i] = total(d(good))/exptime[i] nhot[i] = n_elements(d) - ngood dsum = dsum + d print,idval[i],filt3,datestr,exptime[i],sbctemp[i],$ rate[i],nhot[i],format='(i5, 2x, a7, 2x, a24, f7.0, f7.2, f10.2,i5)' printf,1,idval[i],filt3,datestr,exptime[i],sbctemp[i],$ rate[i],nhot[i],format='(i5, 2x, a7, 2x, a24, f7.0, f7.2, f10.2,i5)' end texpsum = total(exptime) tempsbcavg = total(exptime*sbctemp)/texpsum dsum = 3600*dsum/texpsum ;units cts/pixel/hr good = where((badct LT badthresh), ngood) avg = total(dsum(good))/ngood ; create sorted list of hot(bad) pixels ; bad = where((badct GE badthresh), nbad) badval = dsum(bad) sind = reverse(sort(badval)) dum = badval badval = dum(sind) dum = bad bad = dum(sind) badj = fix(float(bad)/1024.0) badi = bad MOD 1024 badval2 = dsum(badi,badj) badi = badi + 1 badj = badj + 1 print,' ' print,' Total exposure time = ',texpsum print,' Weighted SBC temp = ',tempsbcavg print,' Dark rate = ',avg printf,1,' ' printf,1,' Total exposure time = ',texpsum printf,1,' Weighted SBC temp = ',tempsbcavg printf,1,' Dark rate = ',avg fits_write,imageout,dsum,h fits_write,immask,badct,h forprint,badi,badj,badval,badval2 forprint,badi,badj,badval,badval2,TEXTOUT='hotpixs.dat' dbclose close,1 END