Further improvements in JT4 decoder. NB: this is an intermediate save, users beware!

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6702 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2016-05-25 17:35:27 +00:00
parent 6990f7e9b1
commit fb00a603d5
3 changed files with 71 additions and 35 deletions

View File

@ -3,6 +3,7 @@ module jt4
integer iutc(MAXAVE) integer iutc(MAXAVE)
integer nfsave(MAXAVE) integer nfsave(MAXAVE)
integer listutc(10) integer listutc(10)
logical ok(MAXAVE)
real ppsave(207,7,MAXAVE) !Accumulated data for message averaging real ppsave(207,7,MAXAVE) !Accumulated data for message averaging
real rsymbol(207,7) real rsymbol(207,7)
real dtsave(MAXAVE) real dtsave(MAXAVE)

View File

@ -114,7 +114,6 @@ contains
real ccfblue(-5:540) !CCF in time real ccfblue(-5:540) !CCF in time
real ccfred(-224:224) !CCF in frequency real ccfred(-224:224) !CCF in frequency
real ps0(450)
! real z(458,65) ! real z(458,65)
logical first,prtavg logical first,prtavg
@ -124,7 +123,7 @@ contains
data first/.true./,nutc0/-999/,nfreq0/-999999/ data first/.true./,nutc0/-999/,nfreq0/-999999/
save save
if(first) then if(first .or. nclearave) then
nsave=0 nsave=0
first=.false. first=.false.
blank=' ' blank=' '
@ -155,9 +154,8 @@ contains
! Attempt to synchronize: look for sync pattern, get DF and DT. ! Attempt to synchronize: look for sync pattern, get DF and DT.
call timer('sync4 ',0) call timer('sync4 ',0)
mousedf=nint(nfqso + 1.5*4.375*mode4 - 1270.46) call sync4(dat,npts,ntol,1,nfqso,4,mode4,minw+1,dtx,dfx, &
call sync4(dat,npts,ntol,1,MouseDF,4,mode4,minw+1,dtx,dfx, & snrx,snrsync,ccfblue,ccfred,flip,width)
snrx,snrsync,ccfblue,ccfred,flip,width,ps0)
sync=snrsync sync=snrsync
dtxz=dtx-0.8 dtxz=dtx-0.8
nfreqz=dfx + 1270.46 - 1.5*4.375*mode4 nfreqz=dfx + 1270.46 - 1.5*4.375*mode4
@ -227,8 +225,8 @@ contains
nsave=mod(nsave-1,64)+1 nsave=mod(nsave-1,64)+1
call timer('avg4 ',0) call timer('avg4 ',0)
call this%avg4(nutc,sync,dtx,flip,nfreq,mode4,ntol,ndepth,neme, & call this%avg4(nutc,sync,dtx,flip,nfreq,mode4,ntol,ndepth,neme, &
mycall,hiscall,hisgrid,nfanoave,avemsg,qave,deepave,ich, & nclearave,mycall,hiscall,hisgrid,nfanoave,avemsg,qave, &
ndeepave) deepave,ich,ndeepave)
call timer('avg4 ',1) call timer('avg4 ',1)
endif endif
@ -285,7 +283,8 @@ contains
end subroutine wsjt4 end subroutine wsjt4
subroutine avg4(this,nutc,snrsync,dtxx,flip,nfreq,mode4,ntol,ndepth,neme, & subroutine avg4(this,nutc,snrsync,dtxx,flip,nfreq,mode4,ntol,ndepth,neme, &
mycall,hiscall,hisgrid,nfanoave,avemsg,qave,deepave,ichbest,ndeepave) nclearave, mycall,hiscall,hisgrid,nfanoave,avemsg,qave,deepave, &
ichbest,ndeepave)
! Decodes averaged JT4 data ! Decodes averaged JT4 data
@ -297,14 +296,14 @@ contains
character*1 csync,cused(64) character*1 csync,cused(64)
real sym(207,7) real sym(207,7)
integer iused(64) integer iused(64)
logical first logical first,nclearave
data first/.true./ data first/.true./
save save
if(first) then if(first .or. nclearave) then
iutc=-1 iutc=-1
nfsave=0 nfsave=0
dtdiff=0.2 dtdiff=0.25
first=.false. first=.false.
endif endif
@ -320,19 +319,33 @@ contains
flipsave(nsave)=flip flipsave(nsave)=flip
ppsave(1:207,1:7,nsave)=rsymbol(1:207,1:7) ppsave(1:207,1:7,nsave)=rsymbol(1:207,1:7)
10 sym=0. 10 dtsum=0.
nsum=0
ok=.false.
do i=1,nsave
if(iutc(i).lt.0) cycle
if(mod(iutc(i),2).ne.mod(nutc,2)) cycle !Use only same sequence
if(abs(nfreq-nfsave(i)).gt.ntol) cycle !Freq must match
if(flip.ne.flipsave(i)) cycle !Sync (*/#) must match
if(abs(dtxx-dtsave(i)).gt.2*dtdiff) cycle !Pk-to-pk DT range < 2*dtdiff
dtsum=dtsum+dtsave(i)
nsum=nsum+1
ok(i)=.true.
enddo
dtave=0.
if(nsum.ge.1) dtave=dtsum/nsum
sym=0.
syncsum=0. syncsum=0.
dtsum=0. dtsum=0.
nfsum=0 nfsum=0
nsum=0 nsum=0
do i=1,nsave
do i=1,64
cused(i)='.' cused(i)='.'
if(iutc(i).lt.0) cycle dttest=dtsave(i)-dtave
if(mod(iutc(i),2).ne.mod(nutc,2)) cycle !Use only same sequence if(.not.ok(i)) cycle
if(abs(dtxx-dtsave(i)).gt.dtdiff) cycle !DT must match if(abs(dttest).gt.dtdiff) cycle !DT must match
if(abs(nfreq-nfsave(i)).gt.ntol) cycle !Freq must match
if(flip.ne.flipsave(i)) cycle !Sync (*/#) must match
sym(1:207,1:7)=sym(1:207,1:7) + ppsave(1:207,1:7,i) sym(1:207,1:7)=sym(1:207,1:7) + ppsave(1:207,1:7,i)
syncsum=syncsum + syncsave(i) syncsum=syncsum + syncsave(i)
dtsum=dtsum + dtsave(i) dtsum=dtsum + dtsave(i)

View File

@ -1,5 +1,5 @@
subroutine sync4(dat,jz,ntol,NFreeze,MouseDF,mode,mode4,minwidth, & subroutine sync4(dat,jz,ntol,NFreeze,nfqso,mode,mode4,minwidth, &
dtx,dfx,snrx,snrsync,ccfblue,ccfred1,flip,width,ps0) dtx,dfx,snrx,snrsync,ccfblue,ccfred1,flip,width)
! Synchronizes JT4 data, finding the best-fit DT and DF. ! Synchronizes JT4 data, finding the best-fit DT and DF.
@ -9,7 +9,6 @@ subroutine sync4(dat,jz,ntol,NFreeze,MouseDF,mode,mode4,minwidth, &
integer ntol !Range of DF search integer ntol !Range of DF search
real dat(jz) real dat(jz)
real psavg(NHMAX) !Average spectrum of whole record real psavg(NHMAX) !Average spectrum of whole record
real ps0(450) !Avg spectrum for plotting
real s2(NHMAX,NSMAX) !2d spectrum, stepped by half-symbols real s2(NHMAX,NSMAX) !2d spectrum, stepped by half-symbols
real ccfblue(-5:540) !CCF with pseudorandom sequence real ccfblue(-5:540) !CCF with pseudorandom sequence
real ccfred(-450:450) !Peak of ccfblue, as function of freq real ccfred(-450:450) !Peak of ccfblue, as function of freq
@ -23,9 +22,6 @@ subroutine sync4(dat,jz,ntol,NFreeze,MouseDF,mode,mode4,minwidth, &
data nch/1,2,4,9,18,36,72/ data nch/1,2,4,9,18,36,72/
save save
! write(*,3001) 'A',ntol,nfreeze,mousedf,mode,mode4,minwidth
!3001 format(a1,6i6)
! Do FFTs of twice symbol length, stepped by half symbols. Note that ! Do FFTs of twice symbol length, stepped by half symbols. Note that
! we have already downsampled the data by factor of 2. ! we have already downsampled the data by factor of 2.
nsym=207 nsym=207
@ -46,18 +42,21 @@ subroutine sync4(dat,jz,ntol,NFreeze,MouseDF,mode,mode4,minwidth, &
nsmo=min(10*mode4,150) nsmo=min(10*mode4,150)
call flat1b(psavg,nsmo,s2,nh,nsteps,NHMAX,NSMAX) !Flatten spectra call flat1b(psavg,nsmo,s2,nh,nsteps,NHMAX,NSMAX) !Flatten spectra
if(mode4.ge.9) call smo(psavg,nh,tmp,mode4/4) if(mode4.ge.9) then
call smo(psavg,nh,tmp,mode4/4)
i0=132 psavg=psavg/(mode4/4.0)
do i=1,450 do j=1,nsteps
ps0(i)=5.0*(psavg(i0+2*i) + psavg(i0+2*i+1) - 2.0) call smo(s2(1,j),nh,tmp,mode4/4)
enddo enddo
s2=s2/(mode4/4.0)
endif
! Set freq and lag ranges ! Set freq and lag ranges
famin=200.0 + 3*mode4*df famin=200.0 + 3*mode4*df
fbmax=2700.0 - 3*mode4*df fbmax=2700.0 - 3*mode4*df
fa=famin fa=famin
fb=fbmax fb=fbmax
mousedf=nint(nfqso + 1.5*4.375*mode4 - 1270.46)
if(NFreeze.eq.1) then if(NFreeze.eq.1) then
fa=max(famin,1270.46+MouseDF-ntol) fa=max(famin,1270.46+MouseDF-ntol)
fb=min(fbmax,1270.46+MouseDF+ntol) fb=min(fbmax,1270.46+MouseDF+ntol)
@ -77,21 +76,23 @@ subroutine sync4(dat,jz,ntol,NFreeze,MouseDF,mode,mode4,minwidth, &
ccfred=0. ccfred=0.
jmax=-1000 jmax=-1000
jmin=1000 jmin=1000
! rewind 83
do ich=minwidth,7 !Find best width do ich=minwidth,7 !Find best width
kz=nch(ich)/2
savered=.false. savered=.false.
do i=ia+kz,ib-kz !Find best frequency channel for CCF do i=ia,ib !Find best frequency channel for CCF
call xcor4(s2,i,nsteps,nsym,lag1,lag2,ich,mode4,ccfblue,ccf0, & call xcor4(s2,i,nsteps,nsym,lag1,lag2,ich,mode4,ccfblue,ccf0, &
lagpk0,flip) lagpk0,flip)
j=i-i0 + 3*mode4 j=i-i0 + 3*mode4
if(j.ge.-372 .and. j.le.372) then if(j.ge.-372 .and. j.le.372) then
ccfred(j)=ccf0 ccfred(j)=ccf0
! write(83,4001) i*df,ccf0
!4001 format(f10.1,e12.3)
jmax=max(j,jmax) jmax=max(j,jmax)
jmin=min(j,jmin) jmin=min(j,jmin)
endif endif
! Find rms of the CCF, without main peak ! Normalize ccfblue so that baseline rms = 1.0
call slope(ccfblue(lag1),lag2-lag1+1,lagpk0-lag1+1.0) call slope(ccfblue(lag1),lag2-lag1+1,lagpk0-lag1+1.0)
sync=abs(ccfblue(lagpk0)) sync=abs(ccfblue(lagpk0))
@ -173,7 +174,28 @@ subroutine sync4(dat,jz,ntol,NFreeze,MouseDF,mode,mode4,minwidth, &
enddo enddo
width=(i-i1)*df width=(i-i1)*df
! rewind 80
! rewind 81
! rewind 82
! do i=1,NHMAX
! write(80,3004) i*df,psavg(i),sum(s2(i,1:nsteps))
!3004 format(f10.1,2e12.3)
! enddo
! do i=jmin,jmax
! write(81,3001) i,ccfred1(i),width
!3001 format(i5,2f10.3)
! enddo
! do i=lag1,lag2
! write(82,3002) i,ccfblue(i)
!3002 format(i5,f10.3)
! enddo
! flush(80)
! flush(81)
! flush(82)
! flush(83)
return return
end subroutine sync4 end subroutine sync4
include 'flat1b.f90'