implicit none *matches clem transformed to stetson * integer c,d,i,j,k,l,rahour,ramin,decmin,decdeg,rahour2,ramin2,decmin2,decdeg2 real rasec,decsec,radeg,ratest,dectest,decall,rasec2,decsec2,bmag,b2 real diffra,diffdec, gmag, vmag, Imag,v2,i2,match(100,10),temp(10),complist(200000,5) character*100 junk open(1,file = 'stetsonmatched_out13', status = 'old') open(2,file = 'clemtransformuvbri', status = 'old') open(3,file = 'clemstettransout', status = 'unknown') do k=1,200000 do l=1,5 complist(k,l) = 1000 end do end do write(3,1) 1 format('## Diffra Diffdec Btrans Vtrans Itrans Bstet Vstet Istet RA Dec') * chaff line for 2 read(2,*) do i=1,200000 read(2,*,end=5) rahour2,ramin2,rasec2,decdeg2,decmin2,decsec2,b2,v2,junk,i2 decall = float(decdeg2)+float(decmin2)*.01667+decsec2*.0002778 radeg = float(rahour2)*15 + float(ramin2)*.25 + rasec2*.004167 complist(i,1) = radeg complist(i,2) = decall complist(i,3) = b2 complist(i,4) = v2 complist(i,5) = i2 end do 5 continue *reading out the chaff read(1,10,end=11) 10 format(5x) 11 continue do i=1,200000 *main loops read(1,*,end=33) rahour,ramin,rasec,decdeg,decmin,decsec,bmag, : junk,junk,junk,vmag,(junk,k=1,7),Imag * 15 format(i2,1x,i2,1x,f5.2,1x,i2,1x,i2,1x,f4.1,f7.3,19x,f6.3,44x,f6.3) *from the stetson^ do k=1,100 do l=1,10 match(k,l) = 1000 end do end do k=1 ratest = float(rahour)*15 + float(ramin)*.25 + rasec*.004167 dectest = float(decdeg) +float(decmin)*.01667+decsec*.0002778 do j=1,200000 *from the clem *the cos comes from changing it to seconds of arc, or whatever it is diffra = (ratest-complist(j,1))*cosd(complist(j,2)) diffdec = dectest - complist(j,2) c offset!!! diffdec = diffdec - .0000762294 if(abs(diffra).lt.(.0002778)) then if(abs(diffdec).lt.(.0002778)) then *writes to the file match(k,1) = diffra*3600 match(k,2) = diffdec*3600 match(k,3) = complist(j,3) match(k,4) = complist(j,4) match(k,5) = complist(j,5) match(k,6) = sqrt(diffra**2 + diffdec**2) k = k+1 * write(3,27) (diffra)*(3600.),(diffdec)*(3600.),v2,i2, vmag,Imag,rahour,ramin,rasec,decdeg,decmin,decsec * 27 format(f8.3,3x,f6.3,3x,f6.3,f9.3,3x,f6.3,3x,f6.3,2x,i2,1x,i2,1x,f6.3,2x,i2,1x,i2,1x,f6.3) * end if end if end if end do 31 continue do c=k,2,-1 do d=1,10 temp(d) = match(c,d) end do if(match(c,6).lt.match(c-1,6)) then do d=1,10 match(c,d) = match(c-1,d) match(c-1,d) = temp(d) end do end if end do if(match(1,6).ne.(1000)) then write(3,32) match(1,1),match(1,2),match(1,3),match(1,4),match(1,5), : bmag,vmag,Imag,rahour,ramin,rasec,decdeg,decmin,decsec 32 format(f10.5,f11.5,f9.3,f9.3,f9.3,f9.3,f9.3,f9.3,2x,i2,1x, : i2,1x,f6.3,2x,i2,1x,i2,1x,f6.3) end if *reloops the inner do loop file rewind 2 if(MOD(i,100).eq.(0)) then print*,i end if end do 33 continue close(1) close(2) close(3) end