; ; Routine to calibrate ; SwRI eclipse images ; filenm=' ' listfile='./elist pixX = 256 pixY = 1024 bias = fltarr(pixX) img=intarr(pixX,pixY) fimg=fltarr(pixX,pixY) fopal=fltarr(pixX,pixY) fdark=fltarr(pixX,pixY) cols = fltarr(pixX) ord = findgen(256) close,1 openr,1,'Opals/meanopal' readu,1,fopal fopal(92,*)=fopal(91,*) close,1 openr,1,'meandark' readu,1,fdark fdark(92,*)=fdark(91,*) close,1 close,13 & openr,13,listfile ii=0 loadct,1 close,13 & openr,13,listfile ii=0 while ( not eof(13) ) do begin & readf,13,filenm & ii=ii+1 & endwhile close,13 numimgs=ii print,ii," images" close,13 & openr,13,listfile ii=0 while ( not eof(13) ) do begin ;{ readf,13,filenm print,filenm close,1 & openr,1,filenm img=intarr(pixX,pixY) readu,1,img byteorder,img fimg = 1.*img fimg = fimg - fdark fimg(92,*)=fimg(91,*) for jj=0,pixX-1 do bias(jj)=total(fimg(jj,0:7)) bias = bias/8. t = total(bias)/256. for jj=0,pixY-1 do fimg(*,jj)=fimg(*,jj)-bias+t fimg = 4096.*fimg/fopal ; Remove residual column defects for ii=0,255 do cols(ii)=total(fimg(*,20:400))/380. coef = poly_fit(ord,cols,1,colfit) cols = cols - colfit for ii=0,255 do fimg(ii,*)=fimg(ii,*)-cols(ii) ;;;;; img=fix(fimg) tv,sobel(fimg)+64 str = string(filenm,'.cal') print,str close,1 & openw,1,str writeu,1,fimg ii=ii+1 endwhile ;} close,13 stop end