lfilenm='opallist_L_bias' & fileout='OPALS/opal_L_bias' & Iopal = 8.00e-8 ; 5C ;lfilenm='opallist_M_bias' & fileout='OPALS/opal_M_bias' & Iopal = 7.76e-7 ; 5B ;lfilenm='opallist_S_bias' & fileout='OPALS/opal_S_bias' & Iopal = 7.76e-7 ; 5B close,13 & openr,13,lfilenm filenm =' ' filenmb=' ' xsz=2034 & ysz=2034 opal_img = fltarr(xsz,ysz) & opal_img(*,*) = 0.0 row_avg = fltarr(ysz) row_img = fltarr(xsz,ysz) ovxsz = 1. / float(xsz) ii=0. while ( not eof(13) ) do begin ;{ readf,13,filenm img = readfits(filenm,hdr, SILENT=1) xsz = fix (sxpar (hdr , 'NAXIS1' )) ysz = fix (sxpar (hdr , 'NAXIS2' )) expt = float(sxpar (hdr , 'SHUTTER')) lcvrv = fix (sxpar (hdr , 'LCVR-V' )) lcvrt = float(sxpar (hdr , 'LCVR-T' )) print, filenm , expt readf,13,filenmb bias = readfits(filenmb,hdr, SILENT=1) ;; Reverse byte order to convert from DOS land to UNIX land. byteorder,img byteorder,bias ;; Convert the signed integers to unsigned integers. imgL = float(img) imgL = (imgL lt 0.) * ( imgL + 2.*32768. ) + (imgL ge 0.)*(imgL) bias = float(bias) bias = (bias lt 0.) * ( bias + 2.*32768. ) + (bias ge 0.)*(bias) ;; Compute CCD offset. ;; ;; There is an offset in the CCD that is approximately the ;; average of the row's intensity / 100. This needs to be ;; removed after the bias removal. for jj=0,ysz-2 do begin row_avg(jj) =total(imgL(*,jj )) * ovxsz ;; Alice's way row_img(*,jj)=row_avg(jj) endfor imgL = imgL - bias imgL = imgL + row_img * 0.01 opal_img = opal_img + imgL ii = ii + 1. endwhile ;} close,13 opal_img = opal_img / ii opal_img = Iopal / opal_img openw,1,fileout & writeu,1,opal_img & close,1 end