subroutine vadjust(modvis2) C C C. A. Hummel 7 July 1992 C include 'constnts.inc' include 'data.inc' C real*8 modvis2(mxrec,mxfilt) real*8 sweight(mxfilt),weight,ratio integer*4 firstid,lastid firstid=1 lastid=1 idate=1 do ig=1,nfilt vis2rat(idate,ig)=0.0D0 sweight(ig)=0.0D0 enddo c open(7,file='factors.dat') c c Go through the whole data file and ... c DO ID=1,NDATA do ig=1,nfilt if(viserr(id,ig).ne.2)then ratio=obsvis2(id,ig)/modvis2(id,ig) weight=1.D0/viserr(id,ig)/viserr(id,ig) & *modvis2(id,ig)*modvis2(id,ig) vis2rat(idate,ig)=vis2rat(idate,ig)+ratio*weight sweight(ig)=sweight(ig)+weight endif enddo c c ... work on single night, when date or baseline changes c if(date(id+1).ne.date(id).or.baseline(id+1).ne.baseline(id) & .or.id+1.gt.ndata)then c loop over nfilt plots do ig=1,nfilt if(sweight(ig).ne.0.D0)then vis2rat(idate,ig)=vis2rat(idate,ig)/sweight(ig) else vis2rat(idate,ig)=1.D0 endif do n=1,lastid-firstid+1 if(viserr(n+firstid-1,ig).ne.2)then obsvis2(n+firstid-1,ig)=obsvis2(n+firstid-1,ig) & /vis2rat(idate,ig) viserr(n+firstid-1,ig)=viserr(n+firstid-1,ig) & /vis2rat(idate,ig) endif enddo enddo ! End of ig-loop c write(7,*)baseline(id),vis2rat(idate,1),vis2rat(idate,2), & vis2rat(idate,3) c c Now prepare for the next date idate=idate+1 do ig=1,nfilt vis2rat(idate,ig)=0.0D0 sweight(ig)=0.0D0 enddo firstid=lastid+1 lastid=firstid-1 c c continue here, if date did not change endif lastid=lastid+1 ENDDO close(7) return end