From 326fe4715d875a5023f613a60183235bb770ac78 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 21 Jan 2016 20:03:53 +0000 Subject: [PATCH] Progress toward integrating JTMSK short messages. Not finished, and won't work! git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6417 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- CMakeLists.txt | 3 ++- lib/fast_decode.f90 | 2 +- lib/{jtmsk.f90 => jtmsk_decode.f90} | 36 ++++++++++++++++++------- lib/jtmsk_short.f90 | 42 +++++++++++++++-------------- lib/testmsk.f90 | 6 ++--- 5 files changed, 55 insertions(+), 34 deletions(-) rename lib/{jtmsk.f90 => jtmsk_decode.f90} (83%) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0dac4603..73bdb2cc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -358,7 +358,8 @@ set (wsjt_FSRCS lib/jt65_decode.f90 lib/jt9_decode.f90 lib/jt9fano.f90 - lib/jtmsk.f90 + lib/jtmsk_decode.f90 + lib/jtmsk_short.f90 lib/libration.f90 lib/lpf1.f90 lib/mixlpf.f90 diff --git a/lib/fast_decode.f90 b/lib/fast_decode.f90 index 32aa2c201..e39e96c01 100644 --- a/lib/fast_decode.f90 +++ b/lib/fast_decode.f90 @@ -28,7 +28,7 @@ subroutine fast_decode(id2,narg,line) call fast9(id2,narg,line) go to 900 else if(nmode.eq.103) then - call jtmsk(id2,narg,line) + call jtmsk_decode(id2,narg,line) go to 900 endif diff --git a/lib/jtmsk.f90 b/lib/jtmsk_decode.f90 similarity index 83% rename from lib/jtmsk.f90 rename to lib/jtmsk_decode.f90 index de9b24036..20408c87b 100644 --- a/lib/jtmsk.f90 +++ b/lib/jtmsk_decode.f90 @@ -1,4 +1,4 @@ -subroutine jtmsk(id2,narg,line) +subroutine jtmsk_decode(id2,narg,line) ! Decoder for JTMSK @@ -12,14 +12,12 @@ subroutine jtmsk(id2,narg,line) real d(0:NMAX) !Raw r*4 data real ty(703) real yellow(703) -! real spk2(20) -! real fpk2(20) -! integer jpk2(20) complex c(NFFTMAX) !Complex (analytic) data complex cdat(24000) !Short segments, up to 2 s complex cdat2(24000) integer narg(0:11) !Arguments passed from calling pgm character*22 msg,msg0 !Decoded message + character*22 msg1 !### Test ### character*80 line(100) !Decodes passed back to caller limtrace=-1 @@ -56,6 +54,29 @@ subroutine jtmsk(id2,narg,line) call analytic(d,npts,nfft,c) !Convert to analytic signal call timer('analytic',1) + msg1=" R26" + msg=' ' + call jtmsk_short(c,npts,msg1,msg) + +!### Needs work! + print*,'b ',msg + nsnr=1 + if(msg.ne.' ') then + if(msg.ne.msg0) then + nline=nline+1 + nsnr0=-99 + endif + if(nsnr.gt.nsnr0) then +! call rectify_msk(cdat2(jpk:jpk+NSPM-1),msg,freq2) + write(line(nline),1020) nutc,nsnr,t0,nint(freq2),msg + nsnr0=nsnr + go to 900 + endif + msg0=msg + if(nline.ge.maxlines) go to 900 + endif +!### + nbefore=NSPM nafter=4*NSPM ! Process ping list (sorted by S/N) from top down. @@ -69,8 +90,6 @@ subroutine jtmsk(id2,narg,line) ja=ia/NSPM + 1 jb=ib/NSPM t0=ia/12000.0 -! call msksync(cdat,iz,jpk2,fpk2,spk2) -! call softmsk(cdat,iz,jpk2,fpk2,spk2) do itry=1,21 idf1=(itry/2) * 50 @@ -85,8 +104,6 @@ subroutine jtmsk(id2,narg,line) call syncmsk(cdat,iz,jpk,ipk,idf,rmax,snr,metric,msg) call timer('syncmsk ',1) freq=fpk+idf -! write(72,4001) jpk,idf,nint(freq),rmax,snr,msg -!4001 format(3i6,2f9.2,2x,a22) if(metric.eq.-9999) cycle !No output if no significant sync t0=(ia+jpk)/12000.0 nsnr=nint(yellow(n)-2.0) @@ -109,6 +126,7 @@ subroutine jtmsk(id2,narg,line) enddo 900 if(line(1)(1:6).eq.' ') line(1)(1:1)=char(0) + print*,'z ',line(1) return -end subroutine jtmsk +end subroutine jtmsk_decode diff --git a/lib/jtmsk_short.f90 b/lib/jtmsk_short.f90 index 6b0c50d22..3e13dc3f8 100644 --- a/lib/jtmsk_short.f90 +++ b/lib/jtmsk_short.f90 @@ -1,4 +1,4 @@ -subroutine jtmsk_short(cdat,npts,msg) +subroutine jtmsk_short(cdat,npts,msg,decoded) parameter (NMAX=15*12000,NSAVE=100) character*22 msg,decoded,msgsent @@ -11,16 +11,14 @@ subroutine jtmsk_short(cdat,npts,msg) real r1(0:NMAX-1) real r2(0:4096) real r1save(NSAVE) - integer*8 count0,count1,clkfreq +! integer*8 count0,count1,clkfreq integer itone(234) !Message bits integer jgood(NSAVE) integer indx(NSAVE) logical first data rpt /'26 ','27 ','28 ','R26','R27','R28','RRR','73 '/ data first/.true./ - save first,cw - -! msg=' 73 ' + save first,cw,cb11 if(first) then dt=1.d0/12000.d0 @@ -49,18 +47,19 @@ subroutine jtmsk_short(cdat,npts,msg) enddo enddo enddo + cb11=cw(0:65,0) first=.false. endif - r1thresh=0.40 +! r1thresh=0.40 + r1thresh=0.80 r2thresh=0.50 rmax=0.9 ngood=0 nbad=0 maxdecodes=999 - cb11=cw(0:65,0) - call system_clock(count0,clkfreq) +! call system_clock(count0,clkfreq) r1max=0. do j=0,npts-210 !Find the B11 sync vectors @@ -94,9 +93,11 @@ subroutine jtmsk_short(cdat,npts,msg) do kk=1,kmax k=indx(kmax+1-kk) j=jgood(k) + if(j.lt.144 .or. j.gt.npts-210) cycle u1=0. u2=0. r2max=0. + ibest=-1 do imsg=0,4096 ssa=0. ssb=0. @@ -127,19 +128,20 @@ subroutine jtmsk_short(cdat,npts,msg) n=1 decoded=msg(1:14)//rpt(irpt) endif - if(n.eq.0) nbad=nbad+1 - if(n.eq.1) ngood=ngood+1 - if(n.eq.0 .and. r2max.gt.r2bad) r2bad=r2max - write(52,3020) k,t,ibest,r1(j),r2max,u2/u1,r1or2,n,decoded -3020 format(i3,f9.4,i5,4f7.2,i2,1x,a22) - if(ngood+nbad.ge.maxdecodes) exit + print*,'a ', decoded + go to 900 + +! if(n.eq.0) nbad=nbad+1 +! if(n.eq.1) ngood=ngood+1 +! if(n.eq.0 .and. r2max.gt.r2bad) r2bad=r2max +! write(52,3020) k,t,ibest,r1(j),r2max,u2/u1,r1or2,n,decoded +!3020 format(i3,f9.4,i5,4f7.2,i2,1x,a22) +! if(ngood+nbad.ge.maxdecodes) exit endif enddo - call system_clock(count1,clkfreq) - t=float(count1-count0)/float(clkfreq) - print "('Decode: ',f6.3)",t - print "('Worst false decode:',f6.3)",r2bad - print "('Good:',i3,' Bad:',i3)",ngood,nbad - return +! print "('Worst false decode:',f6.3)",r2bad +! print "('Good:',i3,' Bad:',i3)",ngood,nbad + +900 return end subroutine jtmsk_short diff --git a/lib/testmsk.f90 b/lib/testmsk.f90 index ce013c736..3e62784e6 100644 --- a/lib/testmsk.f90 +++ b/lib/testmsk.f90 @@ -50,9 +50,9 @@ program testmsk narg(10)=nrxfreq narg(11)=ntol - call timer('jtmsk ',0) - call jtmsk(id2,narg,line) - call timer('jtmsk ',1) + call timer('jtmsk_de',0) + call jtmsk_decode(id2,narg,line) + call timer('jtmsk_de',1) do i=1,narg(8) if(line(i)(1:1).eq.char(0)) exit ndecodes=ndecodes+1