implicit none *matches kyle to the plate, which has previously been matched with jen and clem. Only outputs high probability stars. also makes cmd cuts. integer plate,fiber,a,b,c,d,j,x,y,krahour,kramin,kdecdeg,kdecmin,prob real u,uerr,g,gerr,r,rerr,i,ierr,z,zerr,up,uperr,gp,gperr,rp,rperr,ip real iperr,zp,zperr, krasec,kdecsec,pra,pdec,kra,kdec,chi,sharp,sep,vel real match(200,15),temp(15),diffra,diffdec character*100 junk open(1, file = 'platematchout', status = 'old') open(2, file = 'kyle', status = 'old') open(3, file = 'platekylematchout', status = 'unknown') write(3,1) 1 format('##Plate Fiber RA Dec vel u err g err r : err i err z err up err gp err rp : err ip err zp err chi sharp sep prob') read(1,*) do a=1,200000 do x=1,200 do y=1,15 match(x,y) = 1000 end do end do x = 1 read(1,*,end = 30) plate,fiber,pra,pdec,vel,u,uerr,g,gerr,r,rerr,i,ierr, : z,zerr,up,uperr,gp,gperr,rp,rperr,ip,iperr,zp,zperr,chi,sharp,sep if(((g-r).gt.(.23).and.(g-r).lt.(.45).and.g.gt.(17.88).and.g.lt.(18.4)) : .or.(g.lt.(17.88).and.g.gt.(14.7).and.g.gt.(-12.878*(g-r) + 22.9) : .and.g.lt.(-13.554*(g-r) + 24.33))) then go to 18 else if(g.lt.(18.8).and.g.gt.(14.8).and.((g.gt.(-20*(g-r) + 8).and. : g.lt.(-20*(g-r) + 10)).or.(g.lt.(15.5).and.(g-r).gt.(-.35) : .and.(g-r).lt.(-.1)))) then go to 18 else if(g.lt.(-7.7333*(g-r)**2 + 14.5782*(g-r) + 16.6442).and. : g.gt.(-7.6469*(g-r)**2 + 15.7178*(g-r) + 14.4055).and. : g.gt.(18.2).and.(g-r).gt.(.227).and.(g-r).lt.(.986)) then go to 18 else go to 28 end if 18 continue do b=1,40 read(2,*) end do do b=1,200000 read(2,20,end = 25) krahour,kramin,krasec,kdecdeg, : kdecmin,kdecsec,prob 20 format(38x,i2,i3,f7.3,i3,i3,f6.2,16x,i2) kra = float(krahour)*15 + float(kramin)*.25 + krasec*.004167 kdec = float(kdecdeg) + float(kdecmin)*.01667 + kdecsec*.0002778 diffra = (pra - kra)*cosd(kdec) diffdec = pdec - kdec if(abs(diffra).lt.(.0002778)) then if(abs(diffdec).lt.(.0002778)) then match(x,1) = sqrt(diffra**2 + diffdec**2) match(x,2) = prob x = x+1 end if end if end do 25 continue do c=x,2,-1 do d=1,15 temp(d) = match(c,d) end do if(match(c,1).lt.match(c-1,1)) then do d=1,15 match(c,d) = match(c-1,d) match(c-1,d) = temp(d) end do end if end do if(match(1,1).ne.(1000).and.match(1,2).gt.(75)) then write(3,27) plate,fiber,pra,pdec,vel,u,uerr,g,gerr,r,rerr, : i,ierr,z,zerr,up,uperr,gp,gperr,rp,rperr,ip,iperr,zp,zperr, : chi,sharp,sep,(int(match(1,2))) 27 format(i4,i5,f11.5,f10.5,f8.1,f8.3,f7.4,f8.3,f7.4,f8.3,f7.4,f8.3,f7.4, : f8.3,f7.4,5(f8.3,f7.4),f7.3,f8.3,f8.3,i5) end if 28 continue print*,a rewind 2 end do 30 continue close(1) close(2) close(3) end