Fix an off-by-one error. Remove attempt to refine DT estimate using polynomial interpolation.

This commit is contained in:
Steve Franke 2018-07-02 16:13:27 -05:00
parent 394efcae71
commit 5fc4fe6eda
3 changed files with 21 additions and 19 deletions

View File

@ -5,15 +5,23 @@ subroutine ft8_downsample(dd,newdat,f0,c1)
parameter (NMAX=15*12000,NSPS=1920)
parameter (NFFT1=192000,NFFT2=3200) !192000/60 = 3200
logical newdat
logical newdat,first
complex c1(0:NFFT2-1)
complex cx(0:NFFT1/2)
real dd(NMAX),x(NFFT1)
real dd(NMAX),x(NFFT1),taper(0:100)
equivalence (x,cx)
save cx
data first/.true./
save cx,first,taper
if(first) then
pi=4.0*atan(1.0)
do i=0,100
taper(i)=0.5*(1.0+cos(i*pi/100))
enddo
first=.false.
endif
if(newdat) then
! Data in dd have changed, recompute the long FFT
! Data in dd have changed, recompute the long FFT
x(1:NMAX)=dd
x(NMAX+1:NFFT1)=0. !Zero-pad the x array
call four2a(cx,NFFT1,1,-1,0) !r2c FFT to freq domain
@ -23,9 +31,9 @@ subroutine ft8_downsample(dd,newdat,f0,c1)
df=12000.0/NFFT1
baud=12000.0/NSPS
i0=nint(f0/df)
ft=f0+8.0*baud
ft=f0+8.5*baud
it=min(nint(ft/df),NFFT1/2)
fb=f0-1.0*baud
fb=f0-1.5*baud
ib=max(1,nint(fb/df))
k=0
c1=0.
@ -33,6 +41,8 @@ subroutine ft8_downsample(dd,newdat,f0,c1)
c1(k)=cx(i)
k=k+1
enddo
c1(0:100)=c1(0:100)*taper(100:0:-1)
c1(k-1-100:k-1)=c1(k-1-100:k-1)*taper
c1=cshift(c1,i0-ib)
call four2a(c1,NFFT2,1,1,1) !c2c FFT back to time domain
fac=1.0/sqrt(float(NFFT1)*NFFT2)

View File

@ -131,7 +131,6 @@ subroutine ft8b_2(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
call twkfreq1(cd0,NP2,fs2,a,cd0)
xdt=xdt2
f1=f1+delfbest !Improved estimate of DF
call sync8d(cd0,i0,ctwk,0,2,sync)
do k=1,NN
@ -323,14 +322,7 @@ subroutine ft8b_2(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
call extractmessage77(message77,message)
! This needs fixing for messages with i5bit=1
call genft8_174_91(message,mygrid6,bcontest,i5bit,msgsent,msgbits,itone)
if(lsubtract) then
call sync8d(cd0,i0-1,ctwk,0,2,sm1)
call sync8d(cd0,i0,ctwk,0,2,sp0)
call sync8d(cd0,i0+1,ctwk,0,2,sp1)
pk=0.5*(sm1-sp1)/(sp1-2*sp0+sm1)
xdti=(i0+pk)*dt2
call subtractft8(dd0,itone,f1,xdti)
endif
if(lsubtract) call subtractft8(dd0,itone,f1,xdt)
xsig=0.0
xnoi=0.0
do i=1,79

View File

@ -142,15 +142,15 @@ program ft8sim
call genft8_174_91(msg,mygrid6,bcontest,i3bit,msgsent,msgbits,itone)
endif
endif
! k=-1 + nint((xdt+0.5+0.01*gran())/dt)
k=-1 + nint((xdt+0.5)/dt)
ia=k+1
! k=nint((xdt+0.5+0.01*gran())/dt)
k=nint((xdt+0.5)/dt)
ia=k
phi=0.0
do j=1,NN !Generate complex waveform
dphi=twopi*(f0*dt+itone(j)/real(NSPS))
do i=1,NSPS
k=k+1
if(k.ge.0 .and. k.lt.NMAX) c0(k)=cmplx(cos(phi),sin(phi))
k=k+1
phi=mod(phi+dphi,twopi)
enddo
enddo