Fixed signal subtraction for E speed signals

This commit is contained in:
Jordan Sherer 2019-12-08 14:14:58 -05:00
parent 3be107b348
commit f706685cc9
3 changed files with 48 additions and 34 deletions

View File

@ -95,8 +95,10 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
delfbest=0.
ibest=0
write(*,*) '<DecodeDebug> downsampling', fs2, dt2
flush(6)
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> downsampling', fs2, dt2
flush(6)
endif
call timer('js8_down',0)
call js8_downsample(dd0,newdat,f1,cd0) !Mix f1 to baseband and downsample

View File

@ -1,5 +1,4 @@
subroutine subtractjs8(dd,itone,f0,dt)
! Subtract an ft8 signal
!
! Measured signal : dd(t) = a(t)cos(2*pi*f0*t+theta(t))
@ -7,14 +6,10 @@ subroutine subtractjs8(dd,itone,f0,dt)
! Complex amp : cfilt(t) = LPF[ dd(t)*CONJG(cref(t)) ]
! Subtract : dd(t) = dd(t) - 2*REAL{cref*cfilt}
use timer_module, only: timer
!include 'js8_params.f90'
parameter (NFRAME=NSPS*NN)
parameter (NFFT=NMAX, NFILT=1400)
real*4 dd(NMAX), window(-NFILT/2:NFILT/2)
real dd(NMAX), window(-NFILT/2:NFILT/2)
complex cref,camp,cfilt,cw
integer itone(NN)
logical first
@ -30,51 +25,72 @@ subroutine subtractjs8(dd,itone,f0,dt)
endif
call genjs8refsig(itone,cref,f0)
camp=0.
do i=1,nframe
do i=1,NFRAME
id=nstart-1+i
if(id.ge.1.and.id.le.NMAX) camp(i)=dd(id)*conjg(cref(i))
enddo
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> filtering', nfft
write(*,*) '<DecodeDebug> filtering', NFFT
flush(6)
endif
if(first) then
! Create and normalize the filter
pi=4.0*atan(1.0)
fac=1.0/float(nfft)
sum=0.0
do j=-NFILT/2,NFILT/2
window(j)=cos(pi*j/NFILT)**2
sum=sum+window(j)
enddo
cw=0.
cw(1:NFILT+1)=window/sum
cw=cshift(cw,NFILT/2+1)
call four2a(cw,nfft,1,-1,1)
cw=cw*fac
first=.false.
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> creating and normalizing filter'
flush(6)
endif
pi=4.0*atan(1.0)
fac=1.0/float(NFFT)
sum=0.0
do j=-NFILT/2,NFILT/2
window(j)=cos(pi*j/NFILT)**2
sum=sum+window(j)
enddo
cw=0.
! this ultimately shifts 1/2 of the window out of computation
! since it's multiplied against cfilt whiich will only have amp
! values for NFRAME length, which will always be > 20000 samples
! longer than the NFRAME.
! cw(1:NFILT+1)=window/sum
! cw=cshift(cw,NFILT/2+1)
cw(1:NFILT/2)=window(1:NFILT/2)
! we really don't even need the second half of the window.
! start=NMAX-NFILT/2
! end=NMAX-NFILT+1
! cw(start:end)=window(-NFILT/2:1)
cw=cw/sum
call four2a(cw,NFFT,1,-1,1)
cw=cw*fac
first=.false.
endif
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> generating complex amplitude'
flush(6)
endif
cfilt=0.0
cfilt(1:nframe)=camp(1:nframe)
call four2a(cfilt,nfft,1,-1,1)
cfilt(1:nfft)=cfilt(1:nfft)*cw(1:nfft)
call four2a(cfilt,nfft,1,1,1)
cfilt(1:NFRAME)=camp(1:NFRAME)
call four2a(cfilt,NFFT,1,-1,1)
cfilt(1:NFFT)=cfilt(1:NFFT)*cw(1:NFFT)
call four2a(cfilt,NFFT,1,1,1)
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> subtracting filtered reference', nfft
write(*,*) '<DecodeDebug> subtracting filtered reference', NFFT
flush(6)
endif
! Subtract the reconstructed signal
do i=1,nframe
do i=1,NFRAME
j=nstart+i-1
if(j.ge.1 .and. j.le.NMAX) dd(j)=dd(j)-2*REAL(cfilt(i)*cref(i))
enddo
return
end subroutine subtractjs8

View File

@ -109,10 +109,6 @@ contains
endif
call timer('js8dec ',0)
! for now, subtraction of slow is not possible
if(NSPS.gt.1920) then
lsubtract=.false.
endif
call js8dec(dd,newdat,nQSOProgress,nfqso,nftx,ndepth,lft8apon, &
lapcqonly,napwid,lsubtract,nagain,iaptype,mycall12,mygrid6, &
hiscall12,bcontest,sync,f1,xdt,xbase,apsym,nharderrors,dmin, &