Bumped max candidates to 300 (configurable) and cleaned up some sync code

This commit is contained in:
Jordan Sherer 2020-05-02 14:48:46 -04:00
parent bef896c771
commit 2d6ac83606
15 changed files with 87 additions and 49 deletions

View File

@ -5,12 +5,13 @@ subroutine js8_downsample(dd,newdat,f0,c1)
!include 'js8_params.f90'
parameter (NDFFT1=NSPS*NDD, NDFFT2=NDFFT1/NDOWN) ! Downconverted FFT Size - 192000/60 = 3200
parameter (NTAPER=1) ! Should we taper the downsample?
logical newdat,first
complex c1(0:NDFFT2-1)
complex cx(0:NDFFT1/2)
real*4 dd(NMAX),x(NDFFT1),taper(0:NDD)
real dd(NMAX),x(NDFFT1),taper(0:NDD)
equivalence (x,cx)
data first/.true./
save cx,first,taper
@ -22,6 +23,7 @@ subroutine js8_downsample(dd,newdat,f0,c1)
enddo
first=.false.
endif
if(newdat) then
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> newdat', NMAX, NDFFT1
@ -54,8 +56,12 @@ subroutine js8_downsample(dd,newdat,f0,c1)
c1(k)=cx(i)
k=k+1
enddo
if(NTAPER.eq.1) then
c1(0:NDD)=c1(0:NDD)*taper(NDD:0:-1)
c1(k-1-NDD:k-1)=c1(k-1-NDD:k-1)*taper
endif
c1=cshift(c1,i0-ib)
call four2a(c1,NDFFT2,1,1,1) !c2c FFT back to time domain
fac=1.0/sqrt(float(NDFFT1)*NDFFT2)

View File

@ -19,3 +19,5 @@ parameter (NSTEP=NSPS/4) !Rough time-sync step size
parameter (NHSYM=NMAX/NSTEP-3) !Number of symbol spectra (1/4-sym steps)
parameter (NDOWN=NSPS/NDOWNSPS) !Downsample factor to 32 samples per symbol
parameter (NQSYMBOL=NDOWNSPS/4) !Downsample factor of a quarter symbol
parameter (NFSRCH=5) !Search frequency range in Hz (i.e., +/- 2.5 Hz)
parameter (NMAXCAND=300) !Maxiumum number of candidate signals

View File

@ -17,3 +17,5 @@ parameter (NSTEP=NSPS/4) !Rough time-sync step size
parameter (NHSYM=NMAX/NSTEP-3) !Number of symbol spectra (1/4-sym steps)
parameter (NDOWN=NSPS/NDOWNSPS) !Downsample factor to 32 samples per symbol
parameter (NQSYMBOL=NDOWNSPS/4) !Downsample factor of a quarter symbol
parameter (NFSRCH=5) !Search frequency range in Hz (i.e., +/- 2.5 Hz)
parameter (NMAXCAND=300) !Maxiumum number of candidate signals

View File

@ -17,3 +17,5 @@ parameter (NSTEP=NSPS/4) !Rough time-sync step size
parameter (NHSYM=NMAX/NSTEP-3) !Number of symbol spectra (1/4-sym steps)
parameter (NDOWN=NSPS/NDOWNSPS) !Downsample factor to 32 samples per symbol
parameter (NQSYMBOL=NDOWNSPS/4) !Downsample factor of a quarter symbol
parameter (NFSRCH=5) !Search frequency range in Hz (i.e., +/- 2.5 Hz)
parameter (NMAXCAND=300) !Maxiumum number of candidate signals

View File

@ -111,8 +111,7 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly
call js8_downsample(dd0,newdat,f1,cd0) !Mix f1 to baseband and downsample
call timer('js8_down',1)
xdt=xdt+ASTART
i0=nint(xdt*fs2) !Initial guess for start of signal
i0=nint((xdt+ASTART)*fs2) !Initial guess for start of signal
smax=0.0
if(NWRITELOG.eq.1) then
@ -122,19 +121,22 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly
do idt=i0-NQSYMBOL,i0+NQSYMBOL !Search over +/- one quarter symbol
call syncjs8d(cd0,icos,idt,ctwk,0,sync)
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> ', 'idt', idt, 'sync', sync
write(*,*) '<DecodeDebug> idt', idt, 'sync', sync
flush(6)
endif
if(sync.gt.smax) then
smax=sync
ibest=idt
endif
enddo
xdt2=ibest*dt2 !Improved estimate for DT
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> ', 'xdt2', xdt2, 'ibest', ibest
write(*,*) '<DecodeDebug> xdt2', xdt2, 'ibest', ibest
flush(6)
endif
@ -142,8 +144,8 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly
i0=nint(xdt2*fs2)
smax=0.0
do ifr=-5,5 !Search over +/- 2.5 Hz
! Search over +/- 1/2*nfsrch Hz (i.e., +/- 2.5Hz)
do ifr=-NFSRCH,NFSRCH
! compute the ctwk samples at the delta frequency to by used in syncjs8d
! to detect peaks at frequencies +/- 2.5 Hz so we can align the decoder
! for the best possible chance at decoding.
@ -151,6 +153,7 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly
! NOTE: this does not need to compute the entire set of samples for the
! costas arrays...it only needs to do it for the delta frequency
! whose conjugate is multiplied against each csync array in syncjs8d
delf=ifr*0.5
dphi=twopi*delf*dt2
phi=0.0
@ -160,18 +163,23 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly
enddo
call syncjs8d(cd0,icos,i0,ctwk,1,sync)
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> ', 'df', delf, 'sync', sync
write(*,*) '<DecodeDebug> df', delf, 'sync', sync
flush(6)
endif
if( sync .gt. smax ) then
smax=sync
delfbest=delf
endif
enddo
a=0.0
a(1)=-delfbest
call twkfreq1(cd0,NP2,fs2,a,cd0)
xdt=xdt2
f1=f1+delfbest !Improved estimate of DF
@ -209,6 +217,7 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly
ip=maxloc(s2(:,k+72))
if(icos7c(k-1).eq.(ip(1)-1)) is3=is3+1
enddo
! hard sync sum - max is 21
nsync=is1+is2+is3
@ -222,10 +231,12 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly
call timer('badnsync', 0)
nbadcrc=1
call timer('badnsync', 1)
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> bad sync', nsync
write(*,*) '<DecodeDebug> bad sync', f1, xdt, nsync
flush(6)
endif
return
endif
@ -239,6 +250,7 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly
enddo
call indexx(s1sort,8*ND,indxs1)
xmeds1=s1sort(indxs1(nint(0.5*8*ND)))
s1=s1/xmeds1
@ -350,15 +362,11 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly
! 6 ap pass 3
! 7 ap pass 4, etc.
!if(lapon) then
! if(.not.lapcqonly) then
! npasses=4+nappasses(nQSOProgress)
! else
! npasses=5
! endif
!else
if(lapon) then
npasses=4+nappasses(nQSOProgress)
else
npasses=4
!endif
endif
do ipass=1,npasses

View File

@ -17,3 +17,5 @@ parameter (NSTEP=NSPS/4) !Rough time-sync step size
parameter (NHSYM=NMAX/NSTEP-3) !Number of symbol spectra (1/4-sym steps)
parameter (NDOWN=NSPS/NDOWNSPS) !Downsample factor to 32 samples per symbol
parameter (NQSYMBOL=NDOWNSPS/4) !Downsample factor of a quarter symbol
parameter (NFSRCH=5) !Search frequency range in Hz (i.e., +/- 2.5 Hz)
parameter (NMAXCAND=300) !Maxiumum number of candidate signals

View File

@ -17,3 +17,5 @@ parameter (NSTEP=NSPS/4) !Rough time-sync step size
parameter (NHSYM=NMAX/NSTEP-3) !Number of symbol spectra (1/4-sym steps)
parameter (NDOWN=NSPS/NDOWNSPS) !Downsample factor to 32 samples per symbol
parameter (NQSYMBOL=NDOWNSPS/4) !Downsample factor of a quarter symbol
parameter (NFSRCH=5) !Search frequency range in Hz (i.e., +/- 2.5 Hz)
parameter (NMAXCAND=300) !Maxiumum number of candidate signals

View File

@ -45,7 +45,7 @@ subroutine subtractjs8(dd,itone,f0,dt)
flush(6)
endif
if(NSHIFT.ne.1) then
if(NSHIFT.eq.0) then
pi=4.0*atan(1.0)
fac=1.0/float(NFFT)
sum=0.0

View File

@ -9,8 +9,8 @@ subroutine syncjs8(dd,icos,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase)
real x(NFFT1)
real sync2d(NH1,-JZ:JZ)
real red(NH1)
real candidate0(3,200)
real candidate(3,200)
real candidate0(3,NMAXCAND)
real candidate(3,NMAXCAND)
real dd(NMAX)
integer icos
integer jpeak(NH1)
@ -144,15 +144,20 @@ subroutine syncjs8(dd,icos,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase)
red=red/base
k=0
do i=1,min(200,iz)
if(k.ge.200) exit
do i=1,min(iz,NMAXCAND)
if(k.ge.NMAXCAND) exit
n=ia + indx(iz+1-i) - 1
if(red(n).lt.syncmin.or.isnan(red(n))) exit
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> red candidate', red(n), n*df, (jpeak(n)-1)*tstep
flush(6)
endif
k=k+1
candidate0(1,k)=n*df
candidate0(2,k)=(jpeak(n)-1)*tstep
candidate0(3,k)=red(n)
@ -181,7 +186,6 @@ subroutine syncjs8(dd,icos,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase)
if(abs(candidate0(1,i)-nfqso).lt.10.0) candidate0(1,i)=-candidate0(1,i)
enddo
fac=20.0/maxval(s)
s=fac*s

View File

@ -58,7 +58,7 @@ subroutine syncjs8d(cd0,icos,i0,ctwk,itwk,sync)
phic=mod(phia+dphic,twopi)
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> computing costas waveforms', k, i, j, phia, phib, phic, dphia, dphib, dphic
write(*,*) '<DecodeDebug> computing costas waveforms', i, j, phia, phib, phic, dphia, dphib, dphic
flush(6)
endif
enddo

View File

@ -35,7 +35,7 @@ contains
procedure(js8a_decode_callback) :: callback
real s(NH1,NHSYM)
real sbase(NH1)
real candidate(3,200)
real candidate(3,NMAXCAND)
real dd(NMAX)
logical, intent(in) :: lft8apon,lapcqonly,nagain
logical newdat,lsubtract,ldupe,bcontest
@ -97,6 +97,16 @@ contains
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug>', ncand, "candidates"
flush(6)
do icand=1,ncand
sync=candidate(3,icand)
f1=candidate(1,icand)
xdt=candidate(2,icand)
xbase=10.0**(0.1*(sbase(nint(f1/(12000.0/NFFT1)))-40.0)) ! 3.125Hz
write(*,*) '<DecodeDebug> candidate', icand, 'f1', f1, 'sync', sync, 'xdt', xdt, 'xbase', xbase
flush(6)
enddo
endif
do icand=1,ncand

View File

@ -35,7 +35,7 @@ contains
procedure(js8b_decode_callback) :: callback
real s(NH1,NHSYM)
real sbase(NH1)
real candidate(3,200)
real candidate(3,NMAXCAND)
real dd(NMAX)
logical, intent(in) :: lft8apon,lapcqonly,nagain
logical newdat,lsubtract,ldupe,bcontest

View File

@ -35,7 +35,7 @@ contains
procedure(js8c_decode_callback) :: callback
real s(NH1,NHSYM)
real sbase(NH1)
real candidate(3,200)
real candidate(3,NMAXCAND)
real dd(NMAX)
logical, intent(in) :: lft8apon,lapcqonly,nagain
logical newdat,lsubtract,ldupe,bcontest

View File

@ -35,7 +35,7 @@ contains
procedure(js8e_decode_callback) :: callback
real s(NH1,NHSYM)
real sbase(NH1)
real candidate(3,200)
real candidate(3,NMAXCAND)
real dd(NMAX)
logical, intent(in) :: lft8apon,lapcqonly,nagain
logical newdat,lsubtract,ldupe,bcontest

View File

@ -35,7 +35,7 @@ contains
procedure(js8i_decode_callback) :: callback
real s(NH1,NHSYM)
real sbase(NH1)
real candidate(3,200)
real candidate(3,NMAXCAND)
real dd(NMAX)
logical, intent(in) :: lft8apon,lapcqonly,nagain
logical newdat,lsubtract,ldupe,bcontest