diff --git a/libm65/map65a.f90 b/libm65/map65a.f90 index ba74837bc..6e9c46b40 100644 --- a/libm65/map65a.f90 +++ b/libm65/map65a.f90 @@ -190,7 +190,10 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & if(nqd.eq.1 .and. ntol.le.100) thresh1=0. noffset=0 if(nqd.ge.1) noffset=nint(1000.0*(freq-fqso)-mousedf) - if(nqd.eq.2) sync1=thresh1+1.0 + if(nqd.eq.2) then + sync1=thresh1+1.0 + noffset=0 + endif if(sync1.gt.thresh1 .and. abs(noffset).le.ntol) then ! Keep only the best candidate within ftol. ! (Am I deleting any good decodes by doing this?) diff --git a/libm65/qra64b.f90 b/libm65/qra64b.f90 index 5f6d22836..a2e4588bc 100644 --- a/libm65/qra64b.f90 +++ b/libm65/qra64b.f90 @@ -1,4 +1,4 @@ -subroutine qra64b(nutc,nqd,ikhz,idf,ntol,xpol,mycall_12,hiscall_12, & +subroutine qra64b(nutc,nqd,ikhz,mousedf,ntol,xpol,mycall_12,hiscall_12, & hisgrid_6) parameter (NFFT1=5376000) !56*96000 @@ -11,7 +11,7 @@ subroutine qra64b(nutc,nqd,ikhz,idf,ntol,xpol,mycall_12,hiscall_12, & common/cacb/ca,cb df=96000.0/NFFT1 - k0=(ikhz-75.7)*1000.0/df + k0=(ikhz-75.74)*1000.0/df nh=nfft2/2 fac=1.0/NFFT2 cx(0:nh)=ca(k0:k0+nh) @@ -26,7 +26,7 @@ subroutine qra64b(nutc,nqd,ikhz,idf,ntol,xpol,mycall_12,hiscall_12, & call four2a(cy,NFFT2,1,-1,1) ! write(67) nutc,cx,cy - call qra64c(cx,cy,nutc,nqd,ikhz,idf,ntol,xplo,mycall_12, & + call qra64c(cx,cy,nutc,nqd,ikhz,mousedf,ntol,xplo,mycall_12, & hiscall_12,hisgrid_6) return diff --git a/libm65/qra64c.f90 b/libm65/qra64c.f90 index f0f089f5a..5e4f1c3b6 100644 --- a/libm65/qra64c.f90 +++ b/libm65/qra64c.f90 @@ -29,10 +29,8 @@ subroutine qra64c(cx,cy,nutc,nqd,ikhz,nfqso,ntol,xpol,mycall_12, & save ! For now: - nf1=200 - nf2=2200 -! nfqso=808 -! ntol=1000 + nf1=-3000 + nf2=3000 mode64=1 minsync=-1 ndepth=3 @@ -71,8 +69,10 @@ subroutine qra64c(cx,cy,nutc,nqd,ikhz,nfqso,ntol,xpol,mycall_12, & naptype=maxaptype npts2=NFFT2 -!1 read(67,end=999) nutc,cx,cy +!### c00(0:NFFT2-1)=conjg(cy) +!### + call sync64(c00,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk0,sync, & sync2,width) @@ -161,18 +161,16 @@ subroutine qra64c(cx,cy,nutc,nqd,ikhz,nfqso,ntol,xpol,mycall_12, & ! write(*,1011) nutc/100,nsnr,dtx,nfreq,decoded !1011 format(i4.4,i4,f5.1,i5,1x,2x,1x,a22) - nkhz=108 npol=0 cp='H' - nsync=sync ntxpol=0 if(irc.ge.0) then - write(*,1010) nkHz,nfreq,npol,nutc/100,dtx,nsnr,decoded,irc,ntxpol,cp + write(*,1010) ikHz,nfreq,npol,nutc/100,dtx,nsnr,decoded,irc,ntxpol,cp !1010 format('!',i3,i5,i4,i7.6,f5.1,i4,2x,a22,i2,i5,i5,1x,a1) !1010 format(i3,i5,i4,i5.4,f5.1,i5,2x,a22,i2,i5,1x,a1) 1010 format('!',i3,i5,i4,i6.4,f5.1,i5,2x,a22,i2,i5,1x,a1) else - write(*,1010) nkHz,nfreq,npol,nutc/100,dtx,nsync + write(*,1010) ikHz,nfreq,npol,nutc/100,dtx,nsnr endif ! goto 1 diff --git a/libm65/sync64.f90 b/libm65/sync64.f90 index d52ad23d2..5ace65d75 100644 --- a/libm65/sync64.f90 +++ b/libm65/sync64.f90 @@ -45,16 +45,22 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & nh3=nfft3/2 df3=6000.0/nfft3 - fa=max(nf1,nfqso-ntol) - fb=min(nf2,nfqso+ntol) - iaa=max(0,nint(fa/df3)) - ibb=min(NSPC-1,nint(fb/df3)) +! fa=max(nf1,nfqso-ntol) +! fb=min(nf2,nfqso+ntol) + fa=nfqso-ntol + fb=nfqso+ntol + iaa=max(0,nint(fa/df3)+nh3) + ibb=min(NSPC-1,nint(fb/df3)+nh3) + write(74,3401) nf1,nf2,nfqso,ntol,iaa,ibb,fa,fb +3401 format(6i6,2f8.1) + flush(74) maxtol=max(ntol,500) fa=max(nf1,nfqso-maxtol) fb=min(nf2,nfqso+maxtol) - ia=max(0,nint(fa/df3)) - ib=min(NSPC-1,nint(fb/df3)) + ia=max(0,nint(fa/df3)+nh3) + ib=min(NSPC-1,nint(fb/df3)+nh3) + id=0.1*(ib-ia) iz=ib-ia+1 sync=-1.e30 @@ -79,6 +85,9 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & call four2a(c1,nfft3,1,-1,1) call four2a(c2,nfft3,1,-1,1) call four2a(c3,nfft3,1,-1,1) + c1=cshift(c1,nh3) + c2=cshift(c2,nh3) + c3=cshift(c3,nh3) s1=0. s2=0. s3=0. @@ -111,14 +120,14 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & sync=s dtx=jpk/6000.0 - 1.0 ipk=ip - f0=ip*df3 + f0=ip*df3 - 3000.0 endif call timer('sync64_2',1) enddo s0a=s0a+2.0 - write(17) ia,ib,s0a(ia:ib) !Save data for red curve - close(17) +! write(17) ia,ib,s0a(ia:ib) !Save data for red curve +! close(17) nskip=50 call lorentzian(s0a(ia+nskip:ib-nskip),iz-2*nskip,a) @@ -137,18 +146,27 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & rms2=sqrt(sq/40.0) sync2=10.0*log10(a(2)/rms2) -! do i=1,iz-2*nskip -! x=i -! z=(x-a(3))/(0.5*a(4)) -! yfit=a(1) -! if(abs(z).lt.3.0) then -! d=1.0 + z*z -! yfit=a(1) + a(2)*(1.0/d - 0.1) -! endif -! j=i+ia+49 -! write(76,1110) j*df3,s0a(j),yfit -!1110 format(3f10.3) -! enddo + rewind 76 + do i=1,iz-2*nskip + x=i + z=(x-a(3))/(0.5*a(4)) + yfit=a(1) + if(abs(z).lt.3.0) then + d=1.0 + z*z + yfit=a(1) + a(2)*(1.0/d - 0.1) + endif + j=i+ia+49 + write(76,1110) j*df3-3000.0,s0a(j),yfit +1110 format(3f10.3) + enddo + flush(76) + + !### + write(75,3301) ntol,maxtol,nfqso,fa,fb,iaa*df3,ibb*df3,dtx,f0,sync +3301 format(3i6,7f8.1) + flush(75) +!### + return end subroutine sync64