From 6339dc4b7e09e434ed5cfeb64f28da32ace53e87 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 16 May 2013 16:02:00 +0000 Subject: [PATCH] Many changes to the procedures for selecting decodable candidate JT9 signals. This code may be the new benchmark? git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3274 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/Makefile.linux | 2 +- lib/chkss2.f90 | 4 ++-- lib/decode9.f90 | 1 - lib/decoder.f90 | 45 +++++++++++++++++++++++++-------------------- lib/downsam9.f90 | 1 - lib/softsym.f90 | 13 +++++++++++-- lib/symspec.f90 | 13 +++---------- lib/symspec2.f90 | 6 ++++-- lib/sync9.f90 | 45 +++++++++++++++++++++++++++++++++++++++++++-- lib/zplot9.f90 | 6 ++++-- mainwindow.cpp | 2 +- 11 files changed, 94 insertions(+), 44 deletions(-) diff --git a/lib/Makefile.linux b/lib/Makefile.linux index ec08904fc..d10480925 100644 --- a/lib/Makefile.linux +++ b/lib/Makefile.linux @@ -30,7 +30,7 @@ OBJS1 = pctile.o graycode.o sort.o ssort.o \ softsym.o peakdt9.o getlags.o afc9.o fchisq.o \ twkfreq.o downsam9.o symspec2.o ipcomm.o sleep_msec.o \ stdmsg.o sec_midn.o cutil.o azdist.o geodist.o morse.o \ - fillcom.o + fillcom.o chkss2.o libjt9.a: $(OBJS1) ar cr libjt9.a $(OBJS1) diff --git a/lib/chkss2.f90 b/lib/chkss2.f90 index 046089fc3..932e387c8 100644 --- a/lib/chkss2.f90 +++ b/lib/chkss2.f90 @@ -1,4 +1,4 @@ -subroutine chkss2(ss2,schk) +subroutine chkss2(ss2,freq,drift,schk) real ss2(0:8,85) real s(0:8,85) @@ -8,7 +8,7 @@ subroutine chkss2(ss2,schk) ave=sum(ss2)/(9*85) s=ss2/ave-1.0 -! call zplot9(s) +! call zplot9(s,freq,drift) s1=0. do lag=0,5 do i=1,16 diff --git a/lib/decode9.f90 b/lib/decode9.f90 index 030671838..d4ad26d76 100644 --- a/lib/decode9.f90 +++ b/lib/decode9.f90 @@ -82,7 +82,6 @@ subroutine decode9(i1SoftSymbols,limit,nlim,msg) call packbits(i1DecodedBits,12,6,i4Decoded6BitWords) call unpackmsg(i4Decoded6BitWords,msg) !Unpack decoded msg if(index(msg,'000AAA ').gt.0) msg=' ' -! if(index(msg,'15P6715P67WCV').gt.0) msg=' ' endif return diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 15c8b8088..4e4d65af5 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -10,6 +10,7 @@ subroutine decoder(ss,c0,nstandalone) character*80 fmt character*20 datetime real*4 ccfred(NSMAX) + real*4 red2(NSMAX) logical ccfok(NSMAX) logical done(NSMAX) integer*1 i1SoftSymbols(207) @@ -61,6 +62,16 @@ subroutine decoder(ss,c0,nstandalone) ! idf=ntol/df3 + 0.999 done=.false. + ia=max(1,nint((nfa-1000)/df3)) + ib=min(NSMAX,nint((nfb-1000)/df3)) + lag1=-(2.5/tstep + 0.9999) + lag2=5.0/tstep + 0.9999 + call timer('sync9 ',0) + call sync9(ss,nzhsym,lag1,lag2,ia,ib,ccfred,red2,ipk) + call timer('sync9 ',1) + red2lim=1.6 + schklim=2.2 + do nqd=1,0,-1 limit=1000 ccflim=4.0 @@ -70,7 +81,7 @@ subroutine decoder(ss,c0,nstandalone) endif if(ndepth.ge.3) then limit=100000 - ccflim=3.0 + ccflim=2.5 endif if(nqd.eq.1) then @@ -82,27 +93,20 @@ subroutine decoder(ss,c0,nstandalone) nfa1=nfa nfb1=nfb endif + ia=max(1,nint((nfa1-1000)/df3)) ib=min(NSMAX,nint((nfb1-1000)/df3)) - lag1=-(2.5/tstep + 0.9999) - lag2=5.0/tstep + 0.9999 - call timer('sync9 ',0) -! Compute ccfred() - call sync9(ss,nzhsym,lag1,lag2,ia,ib,ccfred,ipk) - call timer('sync9 ',1) - ccfok=.false. - if(nqd.eq.1) then ccfok(ipk)=.true. do i=ia,ib - ccfok(i)=ccfred(i).gt.ccflim + ccfok(i)=ccfred(i).gt.ccflim .and. red2(i).gt.red2lim enddo ia1=ia ib1=ib else do i=ia,ib - ccfok(i)=ccfred(i).gt.ccflim + ccfok(i)=ccfred(i).gt.ccflim .and. red2(i).gt.red2lim enddo ccfok(ia1:ib1)=.false. endif @@ -128,7 +132,7 @@ subroutine decoder(ss,c0,nstandalone) drift,schk,i1SoftSymbols) call timer('softsym ',1) - if(schk.ge.2.0) then + if(schk.ge.schklim) then call timer('decode9 ',0) call decode9(i1SoftSymbols,limit,nlim,msg) @@ -141,8 +145,9 @@ subroutine decoder(ss,c0,nstandalone) nsnr=nint(snrdb) ndrift=nint(drift/df3) - write(38,3002) nutc,nqd,nsnr,i,freq,ccfred(i),schk,nlim,msg -3002 format(i4.4,i2,i5,i6,f8.1,2f6.1,i9,2x,a22) +! write(38,3002) nutc,nqd,nsnr,i,freq,ccfred(i),red2(i), & +! schk,nlim,msg +!3002 format(i4.4,i2,i5,i6,f8.1,3f6.1,i9,2x,a22) if(msg.ne.' ') then if(nqd.eq.0) ndecodes0=ndecodes0+1 @@ -163,7 +168,7 @@ subroutine decoder(ss,c0,nstandalone) call flush(6) endif else - write(38,3002) nutc,nqd,-99,i,freq,ccfred(i),schk,0 +! write(38,3002) nutc,nqd,-99,i,freq,ccfred(i),red2(i),schk,0 endif endif enddo @@ -181,11 +186,11 @@ subroutine decoder(ss,c0,nstandalone) if(nstandalone.eq.0) call timer('decoder ',101) call system_clock(iclock,iclock_rate,iclock_max) - write(39,3001) nutc,nfreqs1,nfreqs0,ndecodes1,ndecodes0+ndecodes1, & - float(iclock-iclock0)/iclock_rate -3001 format(5i8,f10.3) - call flush(38) - call flush(39) +! write(39,3001) nutc,nfreqs1,nfreqs0,ndecodes1,ndecodes0+ndecodes1, & +! float(iclock-iclock0)/iclock_rate +!3001 format(5i8,f10.3) +! call flush(38) +! call flush(39) return end subroutine decoder diff --git a/lib/downsam9.f90 b/lib/downsam9.f90 index 682a6dba8..413ad2c7b 100644 --- a/lib/downsam9.f90 +++ b/lib/downsam9.f90 @@ -34,7 +34,6 @@ subroutine downsam9(c0,npts8,nsps8,newdat,nspsd,fpk,c2,nz2) !3001 format(i5,2f12.3,i8) enddo call pctile(s,1000,40,avenoise) - newdat=0 endif ndown=nsps8/16 !Downsample factor diff --git a/lib/softsym.f90 b/lib/softsym.f90 index 4fea0b0cb..2981f6f31 100644 --- a/lib/softsym.f90 +++ b/lib/softsym.f90 @@ -11,6 +11,8 @@ subroutine softsym(c0,npts8,nsps8,newdat,fpk,syncpk,snrdb,xdt,freq,drift, & integer*1 i1SoftSymbolsScrambled(207) integer*1 i1SoftSymbols(207) include 'jt9sync.f90' + data freq0/-999.0/,drift0/-999.0/ + save freq0,drift0 nspsd=16 ndown=nsps8/nspsd @@ -26,15 +28,22 @@ subroutine softsym(c0,npts8,nsps8,newdat,fpk,syncpk,snrdb,xdt,freq,drift, & freq=fpk - a(1) drift=-2.0*a(2) + if(abs(freq-freq0).lt.0.1 .and. abs(drift-drift0).lt.0.1) then + schk=0. + go to 999 + endif + freq0=freq + drift0=drift + newdat=0 + call twkfreq(c3,c5,nz3,fsample,a) !Correct for deltaF, fDot, fDDot ! Compute soft symbols (in scrambled order) call symspec2(c5,nz3,nsps8,nspsd,fsample,freq,drift,snrdb,schk, & i1SoftSymbolsScrambled) - if(snrdb.lt.-99.0) return ! Remove interleaving call interleave9(i1SoftSymbolsScrambled,-1,i1SoftSymbols) - return +999 return end subroutine softsym diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 370fff9ad..f28ccd694 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -25,7 +25,7 @@ subroutine symspec(k,ntrperiod,nsps,ingain,nb,nbslider,pxdb,s,red, & parameter (NFFT2=1024,NFFT2A=NFFT2/8) parameter (MAXFFT3=32768) real*4 s(NSMAX),w3(MAXFFT3) - real*4 x0(NFFT1),x1(NFFT1) + real*4 x1(NFFT1) real*4 x2(NFFT1+105) real*4 ssum(NSMAX) real*4 red(NSMAX) @@ -82,24 +82,16 @@ subroutine symspec(k,ntrperiod,nsps,ingain,nb,nbslider,pxdb,s,red, & k0=k nzap=0 - sigmas=1.0*(10.0**(0.01*nbslider)) + 0.7 - peaklimit=sigmas*max(10.0,rms) px=0. - nwindow=2 -! nwindow=0 !### No windowing ### kstep1=NFFT1 - if(nwindow.ne.0) kstep1=NFFT1/2 fac=2.0/NFFT1 nblks=(k-k1)/kstep1 gain=10.0**(0.05*ingain) do nblk=1,nblks do i=1,NFFT1 - x0(i)=gain*id2(k1+i) + x1(i)=gain*id2(k1+i) enddo - call timf2(x0,k,NFFT1,nwindow,nb,peaklimit,x1, & - slimit,lstrong,px,nzap) - ! Mix at 1500 Hz, lowpass at +/-750 Hz, and downsample to 1500 Hz complex. x2(106:105+kstep1)=x1(1:kstep1) call fil3(x2,kstep1+105,c0(k8+1),n2) @@ -152,6 +144,7 @@ subroutine symspec(k,ntrperiod,nsps,ingain,nb,nbslider,pxdb,s,red, & call pctile(ssum,iz,npct,xmed1) fac1=fac00/max(xmed1,0.006*ihsym) savg(1:iz)=fac1*ssum(1:iz) + savg(iz+1:iz+20)=savg(iz) call redsync(ss,ntrperiod,ihsym,iz,red) return diff --git a/lib/symspec2.f90 b/lib/symspec2.f90 index 642abd6ce..9a29128af 100644 --- a/lib/symspec2.f90 +++ b/lib/symspec2.f90 @@ -11,7 +11,7 @@ subroutine symspec2(c5,nz3,nsps8,nspsd,fsample,freq,drift,snrdb,schk, & real ss3(0:7,69) integer*1 i1 equivalence (i1,i4) - include 'jt9sync.f90' + include 'jt9sync.f90' aa(1)=-1500.0/nsps8 aa(2)=0. @@ -37,7 +37,9 @@ subroutine symspec2(c5,nz3,nsps8,nspsd,fsample,freq,drift,snrdb,schk, & !### ! write(30) freq,drift,ss2 ! call flush(30) - call chkss2(ss2,schk) + call chkss2(ss2,freq,drift,schk) + freq0=freq + drift0=drift if(schk.lt.2.0) go to 900 !### ss=0. diff --git a/lib/sync9.f90 b/lib/sync9.f90 index 4806cd292..8bd3c2958 100644 --- a/lib/sync9.f90 +++ b/lib/sync9.f90 @@ -1,9 +1,14 @@ -subroutine sync9(ss,nzhsym,lag1,lag2,ia,ib,ccfred,ipkbest) +subroutine sync9(ss,nzhsym,lag1,lag2,ia,ib,ccfred,red2,ipkbest) parameter (NSMAX=22000) !Max length of saved spectra real ss(184,NSMAX) real ss1(184) real ccfred(NSMAX) + real savg(NSMAX) + real savg2(NSMAX) + real smo(-5:25) + real sq(NSMAX) + real red2(NSMAX) include 'jt9sync.f90' ipk=0 @@ -42,7 +47,43 @@ subroutine sync9(ss,nzhsym,lag1,lag2,ia,ib,ccfred,ipkbest) call pctile(ccfred(ia),ib-ia+1,50,xmed) if(xmed.le.0.0) xmed=1.0 - ccfred=2.0*ccfred/xmed + ccfred=2.0*ccfred/xmed +! ccfred=4.0*(ccfred/xmed - 1.0) + + savg=0. + do j=1,nzhsym + savg(ia:ib)=savg(ia:ib) + ss(j,ia:ib) + enddo + df=1500.0/2048.0 ! 0.732422 + df9=12000.0/6912.0 ! 1.736111 + savg(ia:ib)=savg(ia:ib)/nzhsym + smo(0:20)=1.0/21.0 + smo(-5:-1)=-(1.0/21.0)*(21.0/10.0) + smo(21:25)=smo(-5) + + do i=ia,ib + sm=0. + do j=-5,25 + if(i+j.ge.1 .and. i+j.lt.NSMAX) sm=sm + smo(j)*savg(i+j) + enddo + savg2(i)=sm + sq(i)=sm*sm + enddo + + call pctile(sq(ia:ib),ib-ia+1,20,sq0) + rms=sqrt(sq0) + savg2(ia:ib)=savg2(ia:ib)/(5.0*rms) + + red2=0. + do i=ia+11,ib-10 + ref=max(savg2(i-10),savg2(i+10)) + red2(i)=savg2(i)-ref + if(red2(i).lt.-99.0) red2(i)=-99.0 + if(red2(i).gt.99.0) red2(i)=99.0 +! write(30,3001) i,i*df+1000.0,savg2(i),red2(i),ccfred(i) +!3001 format(i8,4f10.3) + enddo +! call flush(30) return end subroutine sync9 diff --git a/lib/zplot9.f90 b/lib/zplot9.f90 index 9ffe408c2..6c56c9fc9 100644 --- a/lib/zplot9.f90 +++ b/lib/zplot9.f90 @@ -1,10 +1,12 @@ -subroutine zplot9(s) +subroutine zplot9(s,freq,drift) real s(0:8,85) character*1 line(85),mark(0:6) data mark/' ',' ','.','-','+','X','$'/ include 'jt9sync.f90' + write(32,1000) freq,drift +1000 format('Freq:',f7.1,' Drift:',f5.1,' ',60('-')) do j=8,0,-1 do i=1,85 n=(s(j,i)) @@ -23,7 +25,7 @@ subroutine zplot9(s) 1015 format(87('-')) write(32,1020) line 1020 format(2x,85a1) - write(32,1015) + call flush(32) return end subroutine zplot9 diff --git a/mainwindow.cpp b/mainwindow.cpp index 0a488a00e..5a39e3a08 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1760,7 +1760,7 @@ void MainWindow::startTx2() double snr=t.mid(1,5).toDouble(); if(snr>0.0 or snr < -50.0) snr=99.0; soundOutThread.setTxSNR(snr); - soundOutThread.start(QThread::HighPriority); + soundOutThread.start(QThread::HighestPriority); ui->xThermo->setValue(0.0); //Set Thermo to zero m_monitoring=false; soundInThread.setMonitoring(false);