diff --git a/lib/jt65_decode.f90 b/lib/jt65_decode.f90 index f47d37bbf..2d9dd7af0 100644 --- a/lib/jt65_decode.f90 +++ b/lib/jt65_decode.f90 @@ -143,14 +143,16 @@ contains ncand=0 if(.not.robust) then call timer('sync65 ',0) - call sync65(ss,nfa,nfb,naggressive,ntol,nhsym,ca,ncand,0) + call sync65(ss,nfa,nfb,naggressive,ntol,nhsym,ca,ncand,0, & + single_decode) call timer('sync65 ',1) endif if(ncand.gt.50) robust=.true. if(robust) then ncand=0 call timer('sync65 ',0) - call sync65(ss,nfa,nfb,naggressive,ntol,nhsym,ca,ncand,1) + call sync65(ss,nfa,nfb,naggressive,ntol,nhsym,ca,ncand,1, & + single_decode) call timer('sync65 ',1) endif @@ -201,10 +203,10 @@ contains nfreq=nint(freq+a(1)) ndrift=nint(2.0*a(2)) -! s2db=10.0*log10(sync2) - 35 !### empirical ### -! if(width.gt.3) s2db=s2db + 2.1*sqrt(width-3.0) + 1.5 + & -! 0.11*(width-7.0) !### empirical^2 ### - s2db=sync1 - 30.0 + db(width/3.3) +!### +! s2db=10.0*log10(sync2) - 35 !### empirical (HF) + s2db=sync1 - 30.0 + db(width/3.3) !### VHF/UHF/microwave +!### nsnr=nint(s2db) if(nsnr.lt.-30) nsnr=-30 if(nsnr.gt.-1) nsnr=-1 diff --git a/lib/sync65.f90 b/lib/sync65.f90 index 9b08066da..f6a5c033c 100644 --- a/lib/sync65.f90 +++ b/lib/sync65.f90 @@ -1,10 +1,12 @@ -subroutine sync65(ss,nfa,nfb,naggressive,ntol,nhsym,ca,ncand,nrobust) +subroutine sync65(ss,nfa,nfb,naggressive,ntol,nhsym,ca,ncand,nrobust, & + single_decode) parameter (NSZ=3413,NFFT=8192,MAXCAND=300) real ss(322,NSZ) real ccfblue(-11:540) !CCF with pseudorandom sequence - real ccfred(NSZ) !Peak of ccfblue, as function of freq - + real ccfred(NSZ) !Peak of ccfblue, as function of freq + logical single_decode + type candidate real freq real dt @@ -31,7 +33,8 @@ subroutine sync65(ss,nfa,nfb,naggressive,ntol,nhsym,ca,ncand,nrobust) do i=ia,ib call xcor(ss,i,nhsym,nsym,lag1,lag2,ccfblue,ccf0,lagpk0,flip,fdot,nrobust) ! Remove best-fit slope from ccfblue and normalize so baseline rms=1.0 -! call slope(ccfblue(lag1),lag2-lag1+1,lagpk0-lag1+1.0) + if(.not.single_decode) call slope(ccfblue(lag1),lag2-lag1+1, & + lagpk0-lag1+1.0) ccfred(i)=ccfblue(lagpk0) if(ccfred(i).gt.ccfmax) then ccfmax=ccfred(i) @@ -43,12 +46,6 @@ subroutine sync65(ss,nfa,nfb,naggressive,ntol,nhsym,ca,ncand,nrobust) ccfred(ia-1)=ccfred(ia) ccfred(ib+1)=ccfred(ib) -! do i=1,NSZ -! ssum=sum(ss(1:322,i))/322.0 -! write(61,3001) i*df,ccfred(i),ssum -! enddo - - do i=ia,ib freq=i*df itry=0 @@ -64,8 +61,10 @@ subroutine sync65(ss,nfa,nfb,naggressive,ntol,nhsym,ca,ncand,nrobust) endif endif if(itry.ne.0) then - call xcor(ss,i,nhsym,nsym,lag1,lag2,ccfblue,ccf0,lagpk,flip,fdot,nrobust) -! call slope(ccfblue(lag1),lag2-lag1+1,lagpk-lag1+1.0) + call xcor(ss,i,nhsym,nsym,lag1,lag2,ccfblue,ccf0,lagpk,flip,fdot, & + nrobust) + if(.not.single_decode) call slope(ccfblue(lag1),lag2-lag1+1, & + lagpk-lag1+1.0) xlag=lagpk if(lagpk.gt.lag1 .and. lagpk.lt.lag2) then call peakup(ccfblue(lagpk-1),ccfmax,ccfblue(lagpk+1),dx2) @@ -76,20 +75,14 @@ subroutine sync65(ss,nfa,nfb,naggressive,ntol,nhsym,ca,ncand,nrobust) ccfblue(lag2)=0. ca(ncand)%freq=freq ca(ncand)%dt=dtx -! ca(ncand)%sync=ccfred(i) - ca(ncand)%sync=db(ccfred(i)) - 16.0 + if(single_decode) then + ca(ncand)%sync=db(ccfred(i)) - 16.0 + else + ca(ncand)%sync=ccfred(i) + endif endif if(ncand.eq.MAXCAND) return enddo -! do i=1,NSZ -! write(52,3001) i*df,ccfred(i) -!3001 format(3f12.3) -! enddo -! do i=-10,58 -! write(53,3002) i,i*2048.0/11025.0,ccfblue(i) -!3002 format(i6,2f12.3) -! enddo - return end subroutine sync65