mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-05 08:51:19 -05:00
94472ac31c
The long FFTs can now use the multi-threaded FFTW routines. Subroutine decode9.f90 was renamed jt9fano.f90. The JT9 decoder's top-level functions were removed from decoder.f90 and put into a separate subroutine decjt90.f90. Subroutine decoder.f90 is now configured for possible use of OpenMP SECTIONS, with the JT9 and JT65 decoders running concurrently on a multi-core machine. Note, however, that this concurrent processing is not yet fully implemented. Probably calls to timer need to be removed; some variables used in calls to jt65a and decjt9 may need to be declared PRIVATE in decoder; some sections probably need to be declared CRITICAL; probably some SAVE statements in downstream routines have made them not thread-safe; etc., etc. I'm a neophyte at using OpenMP. Comments, suggestions, and/or tests by others will be welcome! git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4919 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
95 lines
2.1 KiB
Fortran
95 lines
2.1 KiB
Fortran
subroutine sync9(ss,nzhsym,lag1,lag2,ia,ib,ccfred,red2,ipkbest)
|
|
|
|
include 'constants.f90'
|
|
real ss(184,NSMAX)
|
|
real ss1(184)
|
|
real ccfred(NSMAX)
|
|
real savg(NSMAX)
|
|
real savg2(NSMAX)
|
|
real smo(-5:25)
|
|
real sq(NSMAX)
|
|
real red2(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
|
|
|
|
call pctile(ss1,nzhsym,45,sbase)
|
|
ss1=ss1-sbase
|
|
sq0=dot_product(ss1(1:nzhsym),ss1(1:nzhsym))
|
|
rms=sqrt(sq0/(nzhsym-1))
|
|
|
|
smax=0.
|
|
do lag=lag1,lag2 !DT = 2.5 to 5.0 s
|
|
sum1=0.
|
|
sq2=sq0
|
|
nsum=nzhsym
|
|
do j=1,16 !Sum over 16 sync symbols
|
|
k=ii2(j) + lag
|
|
if(k.ge.1 .and. k.le.nzhsym) then
|
|
sum1=sum1 + ss1(k)
|
|
sq2=sq2 - ss1(k)*ss1(k)
|
|
nsum=nsum-1
|
|
endif
|
|
enddo
|
|
if(sum1.gt.smax) then
|
|
smax=sum1
|
|
ipk=i
|
|
endif
|
|
rms=sqrt(sq2/(nsum-1))
|
|
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
|
|
|
|
savg=0.
|
|
do j=1,nzhsym
|
|
savg(ia:ib)=savg(ia:ib) + ss(j,ia:ib)
|
|
enddo
|
|
savg(ia:ib)=savg(ia:ib)/nzhsym
|
|
smo(0:20)=1.0/21.0
|
|
smo(-5:-1)=-(1.0/21.0)*(21.0/10.0)
|
|
smo(21:25)=smo(-5)
|
|
|
|
do i=ia,ib
|
|
sm=0.
|
|
do j=-5,25
|
|
if(i+j.ge.1 .and. i+j.lt.NSMAX) sm=sm + smo(j)*savg(i+j)
|
|
enddo
|
|
savg2(i)=sm
|
|
sq(i)=sm*sm
|
|
enddo
|
|
|
|
call pctile(sq(ia:ib),ib-ia+1,20,sq0)
|
|
rms=sqrt(sq0)
|
|
savg2(ia:ib)=savg2(ia:ib)/(5.0*rms)
|
|
|
|
red2=0.
|
|
do i=ia+11,ib-10
|
|
ref=max(savg2(i-10),savg2(i+10))
|
|
red2(i)=savg2(i)-ref
|
|
if(red2(i).lt.-99.0) red2(i)=-99.0
|
|
if(red2(i).gt.99.0) red2(i)=99.0
|
|
enddo
|
|
|
|
return
|
|
end subroutine sync9
|