Simplify equalization logic - still need to fix & vs ^ display.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7573 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Steven Franke 2017-02-21 20:13:36 +00:00
parent 4525981f73
commit 208e7e2d0b
3 changed files with 20 additions and 26 deletions

View File

@ -1,4 +1,4 @@
subroutine analytic(d,npts,nfft,c,dpc,bseq,bdeq)
subroutine analytic(d,npts,nfft,c,pc,beq)
! Convert real data to analytic signal
@ -6,24 +6,20 @@ subroutine analytic(d,npts,nfft,c,dpc,bseq,bdeq)
real d(npts) ! passband signal
real h(NFFTMAX/2) ! real BPF magnitude
real dpc(5) ! dynamic phase coeffs
real sac(5),saclast(5) ! amp coeffs
real pc(5),pclast(5) ! static phase coeffs
real ac(5),aclast(5) ! amp coeffs
real fp
complex corrs(NFFTMAX/2) ! allpass static phase correction
complex corrd(NFFTMAX/2) ! allpass overall phase correction
complex corr(NFFTMAX/2) ! complex frequency-dependent correction
complex c(NFFTMAX) ! analytic signal
logical*1 bseq ! boolean static equalizer flag
logical*1 bdeq ! boolean dynamic equalizer flag
logical*1 bseqlast
logical*1 beq ! boolean static equalizer flag
data nfft0/0/
data bseqlast/.false./
data saclast/1.0,0.0,0.0,0.0,0.0/
data sac/1.0,0.05532,0.11438,0.12918,0.09274/ ! amp coeffs for TS2000
data aclast/1.0,0.0,0.0,0.0,0.0/
data ac/1.0,0.05532,0.11438,0.12918,0.09274/ ! amp coeffs for TS2000
save corrs,corrd,nfft0,h,sac,saclast,pi,t,beta
save corr,nfft0,h,ac,aclast,pclast,pi,t,beta
df=12000.0/nfft
nh=nfft/2
@ -44,15 +40,17 @@ subroutine analytic(d,npts,nfft,c,dpc,bseq,bdeq)
nfft0=nfft
endif
if( any(saclast .ne. sac) ) then
saclast=sac
if( any(aclast .ne. ac) .or. any(pclast .ne. pc) ) then
aclast=ac
pclast=pc
write(*,*) 'phase coeffs ',pc
do i=1,nh+1
ff=(i-1)*df
f=ff-1500.0
fp=f/1000.0
corrs(i)=sac(1)+fp*(sac(2)+fp*(sac(3)+fp*(sac(4)+fp*sac(5))))
pd=fp*fp*(dpc(3)+fp*(dpc(4)+fp*dpc(5))) ! ignore 1st two terms
corrd(i)=cmplx(cos(pd),sin(pd))
corr(i)=ac(1)+fp*(ac(2)+fp*(ac(3)+fp*(ac(4)+fp*ac(5))))
pd=fp*fp*(pc(3)+fp*(pc(4)+fp*pc(5))) ! ignore 1st two terms
corr(i)=corr(i)*cmplx(cos(pd),sin(pd))
enddo
endif
@ -61,14 +59,10 @@ subroutine analytic(d,npts,nfft,c,dpc,bseq,bdeq)
c(npts+1:nfft)=0.
call four2a(c,nfft,1,-1,1) !Forward c2c FFT
if( (.not. bseq) .and. (.not. bdeq) ) then
if( beq ) then
c(1:nh+1)=h(1:nh+1)*corr(1:nh+1)*c(1:nh+1)
else
c(1:nh+1)=h(1:nh+1)*c(1:nh+1)
else if( bseq .and. (.not. bdeq) ) then
c(1:nh+1)=h(1:nh+1)*corrs(1:nh+1)*c(1:nh+1)
else if( (.not. bseq) .and. bdeq ) then
c(1:nh+1)=h(1:nh+1)*corrd(1:nh+1)*c(1:nh+1)
else if( bseq .and. bdeq ) then
c(1:nh+1)=h(1:nh+1)*corrs(1:nh+1)*corrd(1:nh+1)*c(1:nh+1)
endif
c(1)=0.5*c(1) !Half of DC term

View File

@ -160,7 +160,7 @@ write(*,*) 'start training on call ',training_dxcall
nfft=1024
d=0
d(1:864)=waveform(0:863)
call analytic(d,npts,nfft,canalytic,pcoeffs,.false.,.false.) ! don't equalize the model
call analytic(d,npts,nfft,canalytic,pcoeffs,.false.) ! don't equalize the model
call tweak1(canalytic,nfft,-freq,cmodel)
call four2a(cframe(1:864),864,1,-1,1)
call four2a(cmodel(1:864),864,1,-1,1)

View File

@ -97,7 +97,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, &
d(NZ+1:NFFT1)=0.
bvar=.true.
if( btrain ) bvar=.false. ! if training, turn off rx eq
call analytic(d,NZ,NFFT1,cdat,pcoeffs,bvar,.false.) ! never apply dynamic coeffs
call analytic(d,NZ,NFFT1,cdat,pcoeffs,bvar)
! Calculate average power for each frame and for the entire block.
! If decode is successful, largest power will be taken as signal+noise.