; ; COMPARE program, input files from phot.pro ; compares coordinates using tolerance and ; writes in IDL memory an array of B and V ; magnitudes, called APPMAG ; ; Input section ; bfile = ' ' vfile = ' ' str = ' ' temp = fltarr(5,5000) line = fltarr(5) ; print,format="('Enter filename for B data (no quotes)',$)" read, bfile ; read, bfile, prompt='Enter filename for B data (no quotes): ' openr, 2, bfile readf, 2, str readf, 2, str kb = 0 while not eof(2) do begin readf, 2, line temp(*,kb) = line kb = kb + 1 endwhile close, 2 bdata = temp(*,0:kb-1) ; print,format="('Enter filename for V data (no quotes)',$)" read, vfile ; read, vfile, prompt='Enter filename for V data (no quotes): ' openr, 2, vfile readf, 2, str readf, 2, str kv = 0 while not eof(2) do begin readf, 2, line temp(*,kv) = line kv = kv + 1 endwhile close, 2 vdata = temp(*,0:kv-1) print,format="('Enter tolerance for comparison',$)" read, tol ; read, tol, prompt='Enter tolerance for omparison: ' tol2 = tol^2 print,' B index B mag V index V mag' print,' ' ; ; Now sort magnitudes to match within tolerance ; ; k = 0 temp = fltarr(4,max([kb,kv])) for i = 0, kb-1 do begin for j = 0, kv-1 do begin xd = (bdata(0,j) - vdata(0,i))^2 if xd le tol2 then begin yd = (bdata(1,j) - vdata(1,i))^2 if xd + yd le tol2 then begin temp(0,k) = j temp(1,k) = bdata(4,j) temp(2,k) = i temp(3,k) = vdata(4,i) j = kv + 1 k = k + 1 endif endif endfor endfor appmag = temp(*,0:k-1) temp = 0 print,appmag print, ' ' if kb gt kv then $ print, 'There were', kb-k, ' entries with no match' $ else $ print, 'There were', kv-k, ' entries with no match' print,' Matching data printed above is in array APPMAG' end