C This program uses the brightest N stars from MasterList, and compares C each of them to all the stars in each "*sum" file. The assumption C is that you have fun "files *sum> allfiles" before you began.... C The program outputs the file "sumoffset" C containing the offsets: angle, x, y, and magnitude parameter(maxuse=300) parameter(maxtry=300) character*80 newfile dimension xrefs(maxuse),yrefs(maxuse),arefs(maxuse), & xnews(maxuse),ynews(maxuse),anews(maxuse), & xnewp(maxuse),ynewp(maxuse) dimension ang(maxtry),xs(maxtry),ys(maxtry), & ds(maxtry),fw(maxtry),inum(maxtry) nrefuse=100 nnewuse=100 if(nrefuse.gt.maxuse) stop 'want too many ref stars' if(nnewuse.gt.maxuse) stop 'want too many new stars' C OK, first get the reference stars: call getref(xrefs,yrefs,arefs,nrefuse) C this should return the brightest n stars.... C Now start comparing that list to the stars in each "new" file.... open(unit=2,file='allfiles',status='old') open(unit=3,file='allshifts',status='new') 901 read(2,88,end=999) newfile Cwrite(6,88) newfile 88 format(a80) lastnew=lnblnk(newfile) Cwrite(6,*) newfile(1:lastnew) open(unit=1,file=newfile(1:lastnew),status='old') C Now get the "new" stars: call getnew(xnews,ynews,anews,nnewuse,ierr) if(ierr.eq.1) go to 901 C OK, start rotation loop.... big=0. do 2000 j=1,100 angle=(j-1)*0.0002-50*.0002 do 1000 i=1,nnewuse x=xnews(i) y=ynews(i) xnewp(i)=x*cos(angle)+y*sin(angle) ynewp(i)=y*cos(angle)-x*sin(angle) 1000 continue call best3(xrefs,yrefs,arefs,nrefuse, & xnewp,ynewp,anews,nnewuse, & xshift,yshift,ashift,std,nk) Cwrite(6,*) angle,xshift,yshift,ashift,std,nk ang(j)=angle xs(j)=xshift ys(j)=yshift ds(j)=ashift fw(j)=std inum(j)=nk 2000 continue C Now find a true minimum: small=15. do 2001 j=3,98 val=(fw(j-2)+fw(j-1)+fw(j)+fw(j+1)+fw(j+2))/5. if(val.lt.small) then small=val ibest=j end if 2001 continue write(6,3002) newfile(1:lastnew),ang(ibest),xs(ibest),ys(ibest), & ds(ibest) write(3,3002) newfile(1:lastnew),ang(ibest),xs(ibest),ys(ibest), & ds(ibest) 3002 format(a,f8.4,2f8.2,f8.3) go to 901 999 close(unit=2) stop end include 'getsubany.f' Cinclude 'best2sub.f' include 'bestsub.f' include 'sortsub.f'