WSJT-X/lib/sync9.f90
Joe Taylor fcd068b7c4 Move Tune button to right of "Halt Tx".
Tweak decoding parameters in sync9.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3268 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-05-14 22:47:32 +00:00

47 lines
1.1 KiB
Fortran

subroutine sync9(ss,nzhsym,lag1,lag2,ia,ib,ccfred,ipkbest)
parameter (NSMAX=22000) !Max length of saved spectra
real ss(184,NSMAX)
real ss1(184)
real ccfred(NSMAX)
include 'jt9sync.f90'
ipk=0
ipkbest=0
sbest=0.
ccfred=0.
do i=ia,ib !Loop over freq range
ss1=ss(1:184,i)
call pctile(ss1,nzhsym,40,xmed)
ss1=ss1/xmed - 1.0
do j=1,nzhsym
if(ss1(j).gt.3.0) ss1(j)=3.0
enddo
smax=0.
do lag=lag1,lag2 !DT = 2.5 to 5.0 s
sum=0.
do j=1,16 !Sum over 16 sync symbols
k=ii2(j) + lag
if(k.ge.1 .and. k.le.nzhsym) sum=sum + ss1(k)
enddo
if(sum.gt.smax) then
smax=sum
ipk=i
endif
enddo
ccfred(i)=smax !Best at this freq, over all lags
if(smax.gt.sbest) then
sbest=smax
ipkbest=ipk
endif
enddo
call pctile(ccfred(ia),ib-ia+1,50,xmed)
if(xmed.le.0.0) xmed=1.0
ccfred=2.0*ccfred/xmed
return
end subroutine sync9