From e21236722122a2f5f06d7c4d7ae82bef09357e61 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 5 Apr 2016 14:17:34 +0000 Subject: [PATCH] First decodes of wide/slow JT9 submodes from within wsjtx. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6577 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- CMakeLists.txt | 3 +++ lib/decode9w.f90 | 56 ++++++++++++++++++++-------------------------- lib/decoder.f90 | 4 ++-- lib/jt9_decode.f90 | 15 +++++++++---- lib/jt9w.f90 | 7 +++++- 5 files changed, 46 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f2abbdd7..9db64f97e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,6 +297,7 @@ set (wsjt_FSRCS lib/decode4.f90 lib/decode65a.f90 lib/decode65b.f90 + lib/decode9w.f90 lib/decoder.f90 lib/deep4.f90 lib/deg2grid.f90 @@ -395,6 +396,7 @@ set (wsjt_FSRCS lib/smo121.f90 lib/softsym.f90 lib/softsym9f.f90 + lib/softsym9w.f90 lib/shell.f90 lib/spec9f.f90 lib/stdmsg.f90 @@ -407,6 +409,7 @@ set (wsjt_FSRCS lib/sync65.f90 lib/sync9.f90 lib/sync9f.f90 + lib/sync9w.f90 lib/synciscat.f90 lib/syncmsk.f90 lib/timer_C_wrapper.f90 diff --git a/lib/decode9w.f90 b/lib/decode9w.f90 index 80d8255f1..60b769bde 100644 --- a/lib/decode9w.f90 +++ b/lib/decode9w.f90 @@ -1,26 +1,30 @@ -subroutine decode9w(nutc,nfqso,ntol,nsubmode,ss,id2) +subroutine decode9w(nutc,nfqso,ntol,nsubmode,ss,id2,sync,nsnr,xdt1,f0,decoded) + +! Decode a weak signal in a wide/slow JT9 submode. parameter (NSMAX=6827,NZMAX=60*12000) - real ss(184,NSMAX) - real ccfred(NSMAX) - real ccfblue(-9:18) - real a(5) - integer*2 id2(NZMAX) - integer*1 i1SoftSymbols(207) - character*22 decoded + real ss(184,NSMAX) !Symbol spectra at 1/2-symbol steps + real ccfred(NSMAX) !Best sync vs frequency + real ccfblue(-9:18) !Sync vs time at best frequency + real a(5) !Fitted Lorentzian params + integer*2 id2(NZMAX) !Raw 16-bit data + integer*1 i1SoftSymbols(207) !Binary soft symbols + character*22 decoded !Decoded message - df=12000.0/16384.0 - nsps=6912 - tstep=nsps*0.5/12000.0 + df=12000.0/16384.0 !Bin spacing in ss() + nsps=6912 !Samples per 9-FSK symbol + tstep=nsps*0.5/12000.0 !Half-symbol duration npts=52*12000 - limit=10000 - ntol=100 + limit=10000 !Fano timeout parameter - ia=nint((nfqso-ntol)/df) - ib=nint((nfqso+ntol)/df) - lag1=-int(2.5/tstep + 0.9999) - lag2=int(5.0/tstep + 0.9999) - nhsym=184 + ia=nint((nfqso-ntol)/df) !Start frequency bin + ib=nint((nfqso+ntol)/df) !End frequency bin + lag1=-int(2.5/tstep + 0.9999) !Start lag + lag2=int(5.0/tstep + 0.9999) !End lag + nhsym=184 !Number of half-symbols + +! First sync pass finds approximate Doppler spread; second pass does a +! good Lorentzian fit to determine frequency f0. do iter=1,2 nadd=3 if(iter.eq.2) nadd=2*nint(0.375*a(4)) + 1 @@ -30,28 +34,16 @@ subroutine decode9w(nutc,nfqso,ntol,nsubmode,ss,id2) ccfblue(lagpk)**2 - ccfblue(lagpk+1)**2 base=sum1/25.0 rms=sqrt(sq/24.0) - snr=(ccfblue(lagpk)-base)/rms - nsnr=nint(db(snr)-29.7) + sync=(ccfblue(lagpk)-base)/rms + nsnr=nint(db(sync)-29.7) xdt0=lagpk*tstep - call lorentzian(ccfred(ia),ib-ia+1,a) f0=(ia+a(3))*df -! write(*,3001) nadd,a,base,rms,snr,xdt,f0,ipk,lagpk -!3001 format(i3,9f7.2,f7.1,2i5) - ccfblue=(ccfblue-base)/rms -! rewind 16 -! do lag=lag1,lag2 -! write(16,3002) lag*tstep,ccfblue(lag) -!3002 format(2f10.3) -! enddo - enddo call softsym9w(id2,npts,xdt0,f0,a(4)*df,nsubmode,xdt1,i1softsymbols) call jt9fano(i1softsymbols,limit,nlim,decoded) - write(*,1100) nutc,nsnr,xdt1-1.0,nint(f0),decoded,nlim -1100 format(i4.4,i4,f5.1,i5,1x,'@',1x,a22,i10) return end subroutine decode9w diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 087638e8f..1d39e08e0 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -96,7 +96,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) call my_jt9%decode(jt9_decoded,ss,id2,params%nutc,params%nfqso, & newdat9,params%npts8,params%nfa,params%nfsplit,params%nfb, & params%ntol,params%nzhsym,logical(params%nagain),params%ndepth, & - params%nmode,params%nsubmode) + params%nmode,params%nsubmode,params%nexp_decode) call timer('decjt9 ',1) endif @@ -118,7 +118,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) call my_jt9%decode(jt9_decoded,ss,id2,params%nutc,params%nfqso, & newdat9,params%npts8,params%nfa,params%nfsplit,params%nfb, & params%ntol,params%nzhsym,logical(params%nagain), & - params%ndepth,params%nmode,params%nsubmode) + params%ndepth,params%nmode,params%nsubmode,params%nexp_decode) call timer('decjt9 ',1) end if endif diff --git a/lib/jt9_decode.f90 b/lib/jt9_decode.f90 index 2985a3cbe..615aa317a 100644 --- a/lib/jt9_decode.f90 +++ b/lib/jt9_decode.f90 @@ -25,7 +25,7 @@ module jt9_decode contains subroutine decode(this,callback,ss,id2,nutc,nfqso,newdat,npts8,nfa, & - nfsplit,nfb,ntol,nzhsym,nagain,ndepth,nmode,nsubmode) + nfsplit,nfb,ntol,nzhsym,nagain,ndepth,nmode,nsubmode,nexp_decode) use timer_module, only: timer include 'constants.f90' @@ -43,9 +43,16 @@ contains common/decstats/ntry65a,ntry65b,n65a,n65b,num9,numfano save ccfred,red2 -! write(60) nutc,nfqso,ntol,ndepth,nmode,nsubmode,nzhsym,ss,id2(1:60*12000) - this%callback => callback + if(nmode.eq.9 .and. nsubmode.ge.1) then + call decode9w(nutc,nfqso,ntol,nsubmode,ss,id2,sync,nsnr,xdt,freq,msg) + if (associated(this%callback)) then + ndrift=0 + call this%callback(nutc,sync,nsnr,xdt,freq,ndrift,msg) + end if + go to 999 + endif + nsynced=0 ndecoded=0 nsps=6912 !Params for JT9-1 @@ -160,6 +167,6 @@ contains if(nagain) exit enddo - return +999 return end subroutine decode end module jt9_decode diff --git a/lib/jt9w.f90 b/lib/jt9w.f90 index 923b0dc48..47623e7b5 100644 --- a/lib/jt9w.f90 +++ b/lib/jt9w.f90 @@ -5,6 +5,7 @@ program jt9w real ref(NSMAX) integer*2 id2(NZMAX) character*12 arg + character*22 decoded call getarg(1,arg) read(arg,*) iutc @@ -17,7 +18,11 @@ program jt9w do ifile=1,999 read(60,end=999) nutc,nfqso,ntol,ndepth,nmode,nsubmode,ss,id2 if(nutc.ne.iutc) cycle - call decode9w(nutc,nfqso,ntol,nsubmode,ss,id2) + ntol=100 + call decode9w(nutc,nfqso,ntol,nsubmode,ss,id2,sync,nsnr,xdt,freq,decoded) + write(*,1100) nutc,nsnr,xdt1-1.0,nint(freq),decoded +1100 format(i4.4,i4,f5.1,i5,1x,'@',1x,a22) + exit enddo 999 end program jt9w