From f9e209f399f7bdc9080534c6b62f0ccf252ea338 Mon Sep 17 00:00:00 2001 From: Pavel Demin Date: Sat, 13 Oct 2018 21:45:41 +0200 Subject: [PATCH] add cshift to ft8_downsample and sync8 --- ft8_downsample.f90 | 14 +++++--------- sync8.f90 | 10 +++++----- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/ft8_downsample.f90 b/ft8_downsample.f90 index e07a036..05c3f0b 100644 --- a/ft8_downsample.f90 +++ b/ft8_downsample.f90 @@ -16,21 +16,17 @@ subroutine ft8_downsample(dd,newdat,f0,c1) ! 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,1) !c2c FFT to freq domain + call four2a(x,NFFT1,1,-1,1) !c2c FFT to freq domain + x=cshift(x,NFFT1/2) newdat=.false. endif - if(f0.lt.2000.0) then - f=f0+2000.0 - else - f=f0-2000.0 - endif df=4000.0/NFFT1 baud=4000.0/NSPS - i0=nint(f/df) - ft=f+8.0*baud + i0=nint(f0/df) + ft=f0+8.0*baud it=min(nint(ft/df),NFFT1) - fb=f-1.0*baud + fb=f0-1.0*baud ib=max(1,nint(fb/df)) k=0 c1=0. diff --git a/sync8.f90 b/sync8.f90 index 3ad6ad8..f25de77 100644 --- a/sync8.f90 +++ b/sync8.f90 @@ -3,7 +3,7 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase) include 'ft8_params.f90' ! Search over +/- 2.5s relative to 0.5s TX start time. parameter (JZ=62) - complex cx(NFFT1) + complex cx(0:NFFT1) real s(NFFT1,NHSYM) real savg(NFFT1) real sbase(NFFT1) @@ -19,6 +19,7 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase) integer icos7(0:6) data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern equivalence (x,cx) + save cx ! Compute symbol spectra, stepping by NSTEP steps. savg=0. @@ -31,11 +32,10 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase) x(1:NSPS)=fac*dd(ia:ib) x(NSPS+1:)=0. call four2a(x,NFFT1,1,-1,1) !c2c FFT - do i=2,NH1 - s(i-1,j)=real(cx(i+NH1))**2 + aimag(cx(i+NH1))**2 - s(i-1+NH1,j)=real(cx(i))**2 + aimag(cx(i))**2 + x=cshift(x,NFFT1/2) + do i=1,NFFT1 + s(i,j)=real(cx(i))**2 + aimag(cx(i))**2 enddo - s(NH1,j)=real(cx(1))**2 + aimag(cx(1))**2 savg=savg + s(1:NFFT1,j) !Average spectrum enddo call baseline(savg,nfa,nfb,sbase)