From e5a8e80c495e7eddf78bfdaa2746a977bc050152 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Fri, 1 Jan 2021 15:28:41 -0500 Subject: [PATCH] Minor tweaks to Q^% decoding scheme. --- lib/qra/q65/q65_avg.f90 | 8 ++++---- lib/qra/q65/q65_loops.f90 | 28 ++++++++++++++-------------- lib/test_q65.f90 | 6 +++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/qra/q65/q65_avg.f90 b/lib/qra/q65/q65_avg.f90 index 85fda7fc7..b90a7a227 100644 --- a/lib/qra/q65/q65_avg.f90 +++ b/lib/qra/q65/q65_avg.f90 @@ -23,7 +23,6 @@ subroutine q65_avg(nutc,ntrperiod,LL,nfqso,ntol,lclearave,xdt,f0,snr1,s3) iutc=-1 iseq=-1 f0save=0.0 - dtdiff=0.2 nsave=0 LL0=LL first=.false. @@ -73,6 +72,7 @@ subroutine q65_avg(nutc,ntrperiod,LL,nfqso,ntol,lclearave,xdt,f0,snr1,s3) if(nsave.lt.2) go to 900 mode_q65=2**nsubmode + f0diff=baud*mode_q65 ibwa=1.8*log(baud*mode_q65) + 2 ibwb=min(10,ibwa+4) snr1sum=0. @@ -87,7 +87,7 @@ subroutine q65_avg(nutc,ntrperiod,LL,nfqso,ntol,lclearave,xdt,f0,snr1,s3) if(iutc(i).lt.0) cycle if(iseq(i).ne.iseq(nsave)) cycle !Sequence must match if(abs(xdt-xdtsave(i)).gt.dtdiff) cycle !DT must be close - if(abs(f0-f0save(i)).gt.float(ntol)) cycle !Freq must match + if(abs(f0-f0save(i)).gt.f0diff) cycle !Freq must match cused(i)='$' !Flag for "use this one" s3avg=s3avg + s3save(:,:,i) !Add this spectrum snr1sum=snr1sum + snr1save(i) @@ -97,7 +97,6 @@ subroutine q65_avg(nutc,ntrperiod,LL,nfqso,ntol,lclearave,xdt,f0,snr1,s3) iused(navg)=i enddo if(navg.lt.MAXAVE) iused(navg+1)=0 - if(navg.lt.2) go to 900 ! Find averages of snr1, xdt, and f0 used in this decoding attempt. snr1ave=0. @@ -118,6 +117,7 @@ subroutine q65_avg(nutc,ntrperiod,LL,nfqso,ntol,lclearave,xdt,f0,snr1,s3) xdtsave(i),f0save(i) 1001 format(a1,i5.4,f6.1,f6.2,f7.1) enddo + if(navg.lt.2) go to 900 s3avg=s3avg/navg nFadingModel=1 @@ -129,7 +129,7 @@ subroutine q65_avg(nutc,ntrperiod,LL,nfqso,ntol,lclearave,xdt,f0,snr1,s3) call timer('dec1avg ',1) if(irc.ge.0) then snr2=esnodb - 0.5*db(2500.0/baud) + 3.0 !Empirical adjustment - snr2=snr2 - db(float(navg)) !Is this right? + snr2=snr2 - db(float(navg)) !Is this right? idec=100+navg go to 900 endif diff --git a/lib/qra/q65/q65_loops.f90 b/lib/qra/q65/q65_loops.f90 index b3c4eece8..ce476c0fb 100644 --- a/lib/qra/q65/q65_loops.f90 +++ b/lib/qra/q65/q65_loops.f90 @@ -35,14 +35,13 @@ subroutine q65_loops(c00,npts2,nsps,mode_q65,nsubmode,ndepth,jpk0, & if(iand(ndepth,3).ge.2) then idfmax=5 idtmax=5 - maxdist=15 + maxdist=10 endif if(iand(ndepth,3).eq.3) then - maxdist=25 + maxdist=15 ibwa=max(1,ibwa-1) ibwb=min(10,ibwb+1) endif - LL=64*(mode_q65+2) napmin=99 @@ -57,17 +56,15 @@ subroutine q65_loops(c00,npts2,nsps,mode_q65,nsubmode,ndepth,jpk0, & call twkfreq(c00,c0,npts2,6000.0,a) do idt=1,idtmax ndt=idt/2 - if(iaptype.eq.0) then - if(mod(idt,2).eq.0) ndt=-ndt - jpk=jpk0 + nsps*ndt/16 !tsym/16 - if(jpk.lt.0) jpk=0 - call timer('spec64 ',0) - call spec64(c0,nsps,65,mode_q65,jpk,s3,LL,NN) - call timer('spec64 ',1) - call pctile(s3,LL*NN,40,base) - s3=s3/base - where(s3(1:LL*NN)>s3lim) s3(1:LL*NN)=s3lim - endif + if(mod(idt,2).eq.0) ndt=-ndt + jpk=jpk0 + nsps*ndt/16 !tsym/16 + if(jpk.lt.0) jpk=0 + call timer('spec64 ',0) + call spec64(c0,nsps,65,mode_q65,jpk,s3,LL,NN) + call timer('spec64 ',1) + call pctile(s3,LL*NN,40,base) + s3=s3/base + where(s3(1:LL*NN)>s3lim) s3(1:LL*NN)=s3lim do ibw=ibwa,ibwb ndist=ndf**2 + ndt**2 + (ibw-ibw0)**2 if(ndist.gt.maxdist) cycle @@ -87,6 +84,9 @@ subroutine q65_loops(c00,npts2,nsps,mode_q65,nsubmode,ndepth,jpk0, & enddo ! idf (f0 loop) 100 if(irc.ge.0) then +! write(55,3055) ndepth,iaptype,idf,idt,ibw,ndist,irc,sum(s3(1:LL*NN)), & +! trim(decoded) +!3055 format(7i4,f10.1,1x,a) idec=iaptype+2 snr2=esnodb - db(2500.0/baud) xdt1=xdt0 + nsps*ndt/(16.0*6000.0) diff --git a/lib/test_q65.f90 b/lib/test_q65.f90 index cf557591d..710220a8a 100644 --- a/lib/test_q65.f90 +++ b/lib/test_q65.f90 @@ -4,7 +4,7 @@ program test_q65 character*22 msg character*8 arg character*1 csubmode - integer naptype(1:6) + integer naptype(0:5) logical decok nargs=iargc() @@ -93,8 +93,8 @@ program test_q65 !1000 format(/'Depth:',i2,' AP:',i2,' df:',i3,' dt:',i3,' bw1:',i3,' bw2:',i3, & ! ' dist:',i3) - write(*,1010) (j,j=1,6) - write(12,1010) (j,j=1,6) + write(*,1010) (j,j=0,5) + write(12,1010) (j,j=0,5) 1010 format(' SNR Mode d Dop Sync Avg Dec Bad',6i4,' tdec avg rms'/ & 75('-'))