lfilenm='eclipse4' lfilenm='opallist_SML+eclipse' close,13 & openr,13,lfilenm filenm =' ' xsz=2034 & ysz=2034 & ovxsz = 1. / float(xsz) ybeg = 100 yend = 2033-100 ylen = 1+(yend-ybeg) ovy = 1. / float(ylen) row_avg = fltarr(ylen) row_avg(*) = 0. myaa=0. mybb=0. 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,' ' print, filenm , expt ;; Reverse byte order to convert from DOS land to UNIX land. byteorder,img ;; Convert the signed integers to unsigned integers. fimg = float(img) fimg = (fimg lt 0.) * ( fimg + 2.*32768. ) + (fimg ge 0.)*(fimg) ;; Use a column (y-row) at x=4 , avoiding edge effects, ;; to see what the total image bias is. bias_line = fimg(4,ybeg:yend) bias_line(*)=0. for jj=0,4 do begin ;{ bias_line = bias_line + fimg(jj,ybeg:yend) endfor ;} bias_line = bias_line * 0.20 ;; Get the row_avg for jj=0,ylen-1 do begin;{ kk=jj+ybeg-1 row_avg(jj) = total(fimg(*,kk)) * ovxsz endfor ;} xx = row_avg yy = bias_line leastsq,xx,yy, aa,bb,RR yfit = xx*bb + aa print,aa,bb,RR,' aa , bb , RR' !p.multi=[0,1,4] plot,[0,2033],[0,50000],title=filenm,psym=2,/nodata,/ynoz oplot,fimg(720,ybeg:yend) ,psym=1 plot,[0,2034],[2000,3400],title=filenm,psym=2,/nodata,/ynoz oplot,fimg(4,ybeg:yend),psym=2 plot,[0,2034],[-200,200],title=filenm,psym=2,/nodata,/ynoz oplot,fimg(4,ybeg:yend) - yfit,psym=2 plot,[0,2034],[2000,4000],title=filenm,psym=2,/nodata,/ynoz oplot,findgen(ylen),yfit !p.multi=[0,1,1] ;;wset,0 & cursor,x,y,/NORMAL if( expt eq 4. ) then begin ;{ if((RR gt 0.90) and (RR le 1.00)) then begin ;{ print,'***************************** Good one! ***' myaa = myaa + aa mybb = mybb + bb ii = ii + 1. endif ;} endif ;} endwhile ;} close,13 print,ii,' good correlations, yielding: ', myaa/ii, mybb/ii print,' ' ;; myaa/ii= 3175.63 , mybb/ii = -0.00953071 end