mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-03-23 12:38:53 -04:00
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:
parent
6990f7e9b1
commit
fb00a603d5
@ -3,6 +3,7 @@ module jt4
|
||||
integer iutc(MAXAVE)
|
||||
integer nfsave(MAXAVE)
|
||||
integer listutc(10)
|
||||
logical ok(MAXAVE)
|
||||
real ppsave(207,7,MAXAVE) !Accumulated data for message averaging
|
||||
real rsymbol(207,7)
|
||||
real dtsave(MAXAVE)
|
||||
|
@ -114,7 +114,6 @@ contains
|
||||
|
||||
real ccfblue(-5:540) !CCF in time
|
||||
real ccfred(-224:224) !CCF in frequency
|
||||
real ps0(450)
|
||||
|
||||
! real z(458,65)
|
||||
logical first,prtavg
|
||||
@ -124,7 +123,7 @@ contains
|
||||
data first/.true./,nutc0/-999/,nfreq0/-999999/
|
||||
save
|
||||
|
||||
if(first) then
|
||||
if(first .or. nclearave) then
|
||||
nsave=0
|
||||
first=.false.
|
||||
blank=' '
|
||||
@ -155,9 +154,8 @@ contains
|
||||
|
||||
! Attempt to synchronize: look for sync pattern, get DF and DT.
|
||||
call timer('sync4 ',0)
|
||||
mousedf=nint(nfqso + 1.5*4.375*mode4 - 1270.46)
|
||||
call sync4(dat,npts,ntol,1,MouseDF,4,mode4,minw+1,dtx,dfx, &
|
||||
snrx,snrsync,ccfblue,ccfred,flip,width,ps0)
|
||||
call sync4(dat,npts,ntol,1,nfqso,4,mode4,minw+1,dtx,dfx, &
|
||||
snrx,snrsync,ccfblue,ccfred,flip,width)
|
||||
sync=snrsync
|
||||
dtxz=dtx-0.8
|
||||
nfreqz=dfx + 1270.46 - 1.5*4.375*mode4
|
||||
@ -227,8 +225,8 @@ contains
|
||||
nsave=mod(nsave-1,64)+1
|
||||
call timer('avg4 ',0)
|
||||
call this%avg4(nutc,sync,dtx,flip,nfreq,mode4,ntol,ndepth,neme, &
|
||||
mycall,hiscall,hisgrid,nfanoave,avemsg,qave,deepave,ich, &
|
||||
ndeepave)
|
||||
nclearave,mycall,hiscall,hisgrid,nfanoave,avemsg,qave, &
|
||||
deepave,ich,ndeepave)
|
||||
call timer('avg4 ',1)
|
||||
endif
|
||||
|
||||
@ -285,7 +283,8 @@ contains
|
||||
end subroutine wsjt4
|
||||
|
||||
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
|
||||
|
||||
@ -297,14 +296,14 @@ contains
|
||||
character*1 csync,cused(64)
|
||||
real sym(207,7)
|
||||
integer iused(64)
|
||||
logical first
|
||||
logical first,nclearave
|
||||
data first/.true./
|
||||
save
|
||||
|
||||
if(first) then
|
||||
if(first .or. nclearave) then
|
||||
iutc=-1
|
||||
nfsave=0
|
||||
dtdiff=0.2
|
||||
dtdiff=0.25
|
||||
first=.false.
|
||||
endif
|
||||
|
||||
@ -320,19 +319,33 @@ contains
|
||||
flipsave(nsave)=flip
|
||||
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.
|
||||
dtsum=0.
|
||||
nfsum=0
|
||||
nsum=0
|
||||
|
||||
do i=1,64
|
||||
do i=1,nsave
|
||||
cused(i)='.'
|
||||
if(iutc(i).lt.0) cycle
|
||||
if(mod(iutc(i),2).ne.mod(nutc,2)) cycle !Use only same sequence
|
||||
if(abs(dtxx-dtsave(i)).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
|
||||
dttest=dtsave(i)-dtave
|
||||
if(.not.ok(i)) cycle
|
||||
if(abs(dttest).gt.dtdiff) cycle !DT must match
|
||||
sym(1:207,1:7)=sym(1:207,1:7) + ppsave(1:207,1:7,i)
|
||||
syncsum=syncsum + syncsave(i)
|
||||
dtsum=dtsum + dtsave(i)
|
||||
|
@ -1,5 +1,5 @@
|
||||
subroutine sync4(dat,jz,ntol,NFreeze,MouseDF,mode,mode4,minwidth, &
|
||||
dtx,dfx,snrx,snrsync,ccfblue,ccfred1,flip,width,ps0)
|
||||
subroutine sync4(dat,jz,ntol,NFreeze,nfqso,mode,mode4,minwidth, &
|
||||
dtx,dfx,snrx,snrsync,ccfblue,ccfred1,flip,width)
|
||||
|
||||
! 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
|
||||
real dat(jz)
|
||||
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 ccfblue(-5:540) !CCF with pseudorandom sequence
|
||||
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/
|
||||
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
|
||||
! we have already downsampled the data by factor of 2.
|
||||
nsym=207
|
||||
@ -46,18 +42,21 @@ subroutine sync4(dat,jz,ntol,NFreeze,MouseDF,mode,mode4,minwidth, &
|
||||
nsmo=min(10*mode4,150)
|
||||
call flat1b(psavg,nsmo,s2,nh,nsteps,NHMAX,NSMAX) !Flatten spectra
|
||||
|
||||
if(mode4.ge.9) call smo(psavg,nh,tmp,mode4/4)
|
||||
|
||||
i0=132
|
||||
do i=1,450
|
||||
ps0(i)=5.0*(psavg(i0+2*i) + psavg(i0+2*i+1) - 2.0)
|
||||
enddo
|
||||
if(mode4.ge.9) then
|
||||
call smo(psavg,nh,tmp,mode4/4)
|
||||
psavg=psavg/(mode4/4.0)
|
||||
do j=1,nsteps
|
||||
call smo(s2(1,j),nh,tmp,mode4/4)
|
||||
enddo
|
||||
s2=s2/(mode4/4.0)
|
||||
endif
|
||||
|
||||
! Set freq and lag ranges
|
||||
famin=200.0 + 3*mode4*df
|
||||
fbmax=2700.0 - 3*mode4*df
|
||||
fa=famin
|
||||
fb=fbmax
|
||||
mousedf=nint(nfqso + 1.5*4.375*mode4 - 1270.46)
|
||||
if(NFreeze.eq.1) then
|
||||
fa=max(famin,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.
|
||||
jmax=-1000
|
||||
jmin=1000
|
||||
! rewind 83
|
||||
|
||||
do ich=minwidth,7 !Find best width
|
||||
kz=nch(ich)/2
|
||||
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, &
|
||||
lagpk0,flip)
|
||||
j=i-i0 + 3*mode4
|
||||
if(j.ge.-372 .and. j.le.372) then
|
||||
ccfred(j)=ccf0
|
||||
! write(83,4001) i*df,ccf0
|
||||
!4001 format(f10.1,e12.3)
|
||||
jmax=max(j,jmax)
|
||||
jmin=min(j,jmin)
|
||||
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)
|
||||
sync=abs(ccfblue(lagpk0))
|
||||
|
||||
@ -173,7 +174,28 @@ subroutine sync4(dat,jz,ntol,NFreeze,MouseDF,mode,mode4,minwidth, &
|
||||
enddo
|
||||
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
|
||||
end subroutine sync4
|
||||
|
||||
include 'flat1b.f90'
|
||||
|
Loading…
Reference in New Issue
Block a user