implicit none *combines the three plates for M13 and matches to jen+clem integer stripe,fiber,a,b,c,d,j,x,y,f,h,crahour,cramin,cdecdeg,cdecmin real u,uerr,g,gerr,r,rerr,i,ierr,z,zerr,ra,dec,chi,sharp,sep,vel real up,uperr,gp,gperr,rp,rperr,ip,iperr,zp,zperr,jra,jdec real match(2000,25),temp(25),diffra,diffdec,match2(2000,25) real jenlist(100000,15),clemlist(300000,20),crasec,cdecsec,cra,cdec character*100 junk open(1,file = 'infoerr.2174', status = 'old') open(2,file = 'infoerr.2185', status = 'old') open(3,file = '2255allmapout', status = 'old') open(4,file = 'platematchout', status = 'unknown') open(5,file = 'jj/all4', status = 'old') open(8,file = 'clemmatched13_wsep', status = 'old') do x=1,100000 do y=1,15 jenlist(x,y) = 1000 end do end do do x=1,300000 do y=1,20 clemlist(x,y) = 1000 end do end do do a=1,1000000 read(5,*,end=2) jra,jdec,junk,u,uerr,g,gerr,r,rerr,i, : ierr,z,zerr jenlist(a,1) = jra jenlist(a,2) = jdec jenlist(a,3) = u jenlist(a,4) = uerr jenlist(a,5) = g jenlist(a,6) = gerr jenlist(a,7) = r jenlist(a,8) = rerr jenlist(a,9) = i jenlist(a,10) = ierr jenlist(a,11) = z jenlist(a,12) = zerr end do 2 continue do a=1,1000000 read(8,*,end=3) crahour,cramin,crasec,cdecdeg,cdecmin,cdecsec,junk, : junk,up,uperr,gp,gperr,rp,rperr,ip,iperr,zp,zperr, : (junk,j=1,5),chi,sharp,sep cra = float(crahour)*15 + float(cramin)*.25 + crasec*.004167 cdec = float(cdecdeg) + float(cdecmin)*.01667 + cdecsec*.0002778 clemlist(a,1) = cra clemlist(a,2) = cdec clemlist(a,3) = up clemlist(a,4) = uperr clemlist(a,5) = gp clemlist(a,6) = gperr clemlist(a,7) = rp clemlist(a,8) = rperr clemlist(a,9) = ip clemlist(a,10) = iperr clemlist(a,11) = zp clemlist(a,12) = zperr clemlist(a,13) = chi clemlist(a,14) = sharp clemlist(a,15) = sep end do 3 continue write(4,5) 5 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') do b=1,3 do a=1,20000 do x=1,2000 do y=1,25 match(x,y) = 1000 match2(x,y) = 1000 end do end do x = 1 if(b.eq.(1).or.b.eq.(2)) then read (b,*,end=80) stripe,junk,fiber,(junk,j=1,5),ra,dec,vel else if(b.eq.(3)) then read (b,*,end=80) stripe,fiber,ra,dec,junk,junk,vel end if if(vel.gt.(-260).and.vel.lt.(-240)) then * if(uperr.gt.(8).or.up.gt.(90)) then * up = 99.999 * uperr = 9.9999 * end if * if(gperr.gt.(8).or.gp.gt.(90)) then * gp = 99.999 * gperr = 9.9999 * end if * if(rperr.gt.(8).or.rp.gt.(90)) then * rp = 99.999 * rperr = 9.9999 * end if * if(iperr.gt.(8).or.ip.gt.(90)) then * ip = 99.999 * iperr = 9.9999 * end if * if(zperr.gt.(8).or.zp.gt.(90)) then * zp = 99.999 * zperr = 9.9999 * end if do f=1,200000 if(jenlist(f,1).eq.(1000)) then go to 20 end if diffra = (jenlist(f,1) - ra)*cosd(jenlist(f,2)) diffdec = jenlist(f,2) - dec *offsets: diffra = diffra - .0007491 diffdec = diffdec + .00019444 if(jenlist(f,4).gt.(8).or.jenlist(f,3).gt.(90)) then jenlist(f,3) = 99.999 jenlist(f,4) = 9.9999 end if if(jenlist(f,6).gt.(8).or.jenlist(f,5).gt.(90)) then jenlist(f,5) = 99.999 jenlist(f,6) = 9.9999 end if if(jenlist(f,8).gt.(8).or.jenlist(f,7).gt.(90)) then jenlist(f,7) = 99.999 jenlist(f,8) = 9.9999 end if if(jenlist(f,10).gt.(8).or.jenlist(f,9).gt.(90)) then jenlist(f,9) = 99.999 jenlist(f,10) = 9.9999 end if if(jenlist(f,12).gt.(8).or.jenlist(f,11).gt.(90)) then jenlist(f,11) = 99.999 jenlist(f,12) = 9.9999 end if g = jenlist(f,5) r = jenlist(f,7) 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 10 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 10 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 10 else go to 15 end if 10 continue if(abs(diffra).lt.(.0002778)) then if(abs(diffdec).lt.(.0002778)) then print*,'through jen' match(x,1) = sqrt(diffra**2 + diffdec**2) match(x,2) = jenlist(f,3) match(x,3) = jenlist(f,4) match(x,4) = jenlist(f,5) match(x,5) = jenlist(f,6) match(x,6) = jenlist(f,7) match(x,7) = jenlist(f,8) match(x,8) = jenlist(f,9) match(x,9) = jenlist(f,10) match(x,10) = jenlist(f,11) match(x,11) = jenlist(f,12) match(x,12) = diffra match(x,13) = diffdec x = x+1 end if end if 15 continue end do 20 continue * now clem: h = 1 do f=1,1000000 if(clemlist(f,1).eq.1000) then go to 40 end if diffra = (clemlist(f,1) - ra)*cosd(clemlist(f,2)) diffdec = clemlist(f,2) - dec if(clemlist(f,4).gt.(8).or.clemlist(f,3).gt.(90)) then clemlist(f,3) = 99.999 clemlist(f,4) = 9.9999 end if if(clemlist(f,6).gt.(8).or.clemlist(f,5).gt.(90)) then clemlist(f,5) = 99.999 clemlist(f,6) = 9.9999 end if if(clemlist(f,8).gt.(8).or.clemlist(f,7).gt.(90)) then clemlist(f,7) = 99.999 clemlist(f,8) = 9.9999 end if if(clemlist(f,10).gt.(8).or.clemlist(f,9).gt.(90)) then clemlist(f,9) = 99.999 clemlist(f,10) = 9.9999 end if if(clemlist(f,12).gt.(8).or.clemlist(f,11).gt.(90)) then clemlist(f,11) = 99.999 clemlist(f,12) = 9.9999 end if g = clemlist(f,5) r = clemlist(f,7) 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 30 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 30 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 30 else go to 35 end if 30 continue if(abs(diffra).lt.(.0002778)) then if(abs(diffdec).lt.(.0002778)) then print*,'through clem' match2(h,1) = sqrt(diffra**2 + diffdec**2) match2(h,2) = clemlist(f,3) match2(h,3) = clemlist(f,4) match2(h,4) = clemlist(f,5) match2(h,5) = clemlist(f,6) match2(h,6) = clemlist(f,7) match2(h,7) = clemlist(f,8) match2(h,8) = clemlist(f,9) match2(h,9) = clemlist(f,10) match2(h,10) = clemlist(f,11) match2(h,11) = clemlist(f,12) match2(h,12) = clemlist(f,13) match2(h,13) = clemlist(f,14) match2(h,14) = clemlist(f,15) h = h+1 end if end if 35 continue end do 40 continue do c=x,2,-1 do d=1,25 temp(d) = match(c,d) end do if(match(c,1).lt.match(c-1,1)) then do d=1,25 match(c,d) = match(c-1,d) match(c-1,d) = temp(d) end do end if end do do c=h,2,-1 do d=1,25 temp(d) = match2(c,d) end do if(match2(c,1).lt.match2(c-1,1)) then do d=1,25 match2(c,d) = match2(c-1,d) match2(c-1,d) = temp(d) end do end if end do if(match(1,1).ne.(1000).or.match2(1,1).ne.(1000)) then if(match(1,1).eq.(1000)) then do j=2,11 if(mod(j,2).eq.(0)) then match(1,j) = 99.999 else match(1,j) = 9.9999 end if end do end if if(match2(1,1).eq.(1000)) then do j=2,11 if(mod(j,2).eq.(0)) then match2(1,j) = 99.999 else match2(1,j) = 9.9999 end if end do match2(1,12) = 99.999 match2(1,13) = 99.999 match2(1,14) = 99.999 end if write(4,50) stripe,fiber,ra,dec,vel,(match(1,j),j=2,11), : (match2(1,j),j=2,14) * if(match(1,1).ne.(1000)) then * print*,match(1,12),match(1,13),match(1,1) * write(4,7) stripe,fiber,ra,dec,vel,(match(1,j),j=2,11), * : up,uperr,gp,gperr,rp,rperr,ip,iperr,zp,zperr,chi, * : sharp,sep,match(1,12),match(1,13) * 7 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,f12.7,f12.7) * end if 50 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) end if end if if(mod(a,10).eq.(0)) then print*,a end if end do 80 continue end do close(1) close(2) close(3) close(4) close(5) end