From a402645e75a88da24f3b288835d9f5d1d0c27fdd Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 4 May 2016 18:16:09 +0000 Subject: [PATCH] Remove unused code from sh65.f90. Make csync a 2-character flag. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6666 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/decode65a.f90 | 8 ++------ lib/decoder.f90 | 10 +++++----- lib/jt65_decode.f90 | 8 ++++++-- lib/sh65.f90 | 44 ++++++++++++++------------------------------ 4 files changed, 27 insertions(+), 43 deletions(-) diff --git a/lib/decode65a.f90 b/lib/decode65a.f90 index a2790fcad..05448483c 100644 --- a/lib/decode65a.f90 +++ b/lib/decode65a.f90 @@ -1,6 +1,6 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & naggressive,ndepth,ntol,mycall,hiscall,hisgrid,nexp_decode, & - single_decode,sync2,a,dt,nft,qual,nhist,nsmo,decoded) + single_decode,sync2,a,dt,nft,nspecial,qual,nhist,nsmo,decoded) ! Apply AFC corrections to a candidate JT65 signal, then decode it. @@ -31,15 +31,11 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & ! Check for a shorthand message if(single_decode) then - call sh65(cx,n5,mode65,ntol,xdf,nspecial,snrdb) + call sh65(cx,n5,mode65,ntol,xdf,nspecial,sync2) if(nspecial.gt.0) then a=0. a(1)=xdf - if(nspecial.eq.2) decoded='RO' - if(nspecial.eq.3) decoded='RRR' - if(nspecial.eq.4) decoded='73' nflip=0 - sync2=snrdb go to 900 endif endif diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 9ef95c1c4..40ca1376f 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -229,7 +229,7 @@ contains integer i,n character*5 ctail character*22 decoded - character*1 csync + character*2 csync character*36 c data c/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/ @@ -256,11 +256,11 @@ contains if(qual.lt.3) decoded(21:21)='?' endif endif - csync=' ' + csync='# ' if(nflip.ne.0 .and. sync.ge.max(0.0,float(minsync))) then - csync='*' + csync='#*' if(nflip.eq.-1) then - csync='#' + csync='##' if(decoded.ne.' ') then do i=22,1,-1 if(decoded(i:i).ne.' ') exit @@ -270,7 +270,7 @@ contains endif endif write(*,1010) utc,snr,dt,freq,csync,decoded,ctail -1010 format(i4.4,i4,f5.1,i5,1x,a1,1x,a22,a5) +1010 format(i4.4,i4,f5.1,i5,1x,a2,1x,a22,a5) endif write(13,1012) utc,nint(sync),snr,dt,float(freq),drift,decoded,ft,nsum,nsmo diff --git a/lib/jt65_decode.f90 b/lib/jt65_decode.f90 index f41123cb3..eaceb3f2f 100644 --- a/lib/jt65_decode.f90 +++ b/lib/jt65_decode.f90 @@ -196,8 +196,11 @@ contains call timer('decod65a',0) call decode65a(dd,npts,first_time,nqd,freq,nflip,mode65,nvec, & naggressive,ndepth,ntol,mycall,hiscall,hisgrid, & - nexp_decode,single_decode,sync2,a,dtx,nft,qual,nhist, & - nsmo,decoded) + nexp_decode,single_decode,sync2,a,dtx,nft,nspecial,qual, & + nhist,nsmo,decoded) + if(nspecial.eq.2) decoded='RO' + if(nspecial.eq.3) decoded='RRR' + if(nspecial.eq.4) decoded='73' call timer('decod65a',1) if(sync1.lt.float(minsync) .and. & decoded.eq.' ') nflip=0 @@ -218,6 +221,7 @@ contains ndrift=nint(2.0*a(2)) if(single_decode) then s2db=sync1 - 30.0 + db(width/3.3) !### VHF/UHF/microwave + if(nspecial.gt.0) s2db=sync2 else s2db=10.0*log10(sync2) - 35 !### empirical (HF) endif diff --git a/lib/sh65.f90 b/lib/sh65.f90 index d943455a8..bf4e0c8c0 100644 --- a/lib/sh65.f90 +++ b/lib/sh65.f90 @@ -73,38 +73,22 @@ subroutine sh65(cx,n5,mode65,ntol,xdf,nspecial,snrdb) if(n2best.gt.8) n2best=nbest-4 xdf=min(ipk(nbest),ipk(n2best))*df nspecial=0 - if(abs(xdf).gt.ntol) go to 10 - - idiff=abs(ipk(nbest)-ipk(n2best)) - xk=float(idiff)/nfac - k=nint(xk) - iderr=nint((xk-k)*nfac) - maxerr=nint(0.008*abs(idiff) + 0.51) - if(abs(iderr).le.maxerr .and. k.ge.2 .and. k.le.4) nspecial=k - nstest=0 - if(nspecial.gt.0) then - call sh65snr(ss(ia2,nbest),ib2-ia2+1,snr1) - call sh65snr(ss(ia2,n2best),ib2-ia2+1,snr2) - snr=0.5*(snr1+snr2) - if(snr.gt.snrbest) then - snrbest=snr - nspecialbest=nspecial - nstest=snr/2.0 - 2.0 !Threshold set here - if(nstest.lt.0) nstest=0 - if(nstest.gt.10) nstest=10 - dfsh=nint(xdf) - iderrbest=iderr - snrdb=db(snr) - db(2500.0/df) - db(sqrt(nblks/4.0))+1.8 - n1=nbest - n2=n2best - ipk1=ipk(n1) - ipk2=ipk(n2) + if(abs(xdf).le.ntol) then + idiff=abs(ipk(nbest)-ipk(n2best)) + xk=float(idiff)/nfac + k=nint(xk) + iderr=nint((xk-k)*nfac) + maxerr=nint(0.008*abs(idiff) + 0.51) + if(abs(iderr).le.maxerr .and. k.ge.2 .and. k.le.4) nspecial=k + snrdb=-30.0 + if(nspecial.gt.0) then + call sh65snr(ss(ia2,nbest),ib2-ia2+1,snr1) + call sh65snr(ss(ia2,n2best),ib2-ia2+1,snr2) + snr=0.5*(snr1+snr2) + snrdb=db(snr) - db(2500.0/df) - db(sqrt(nblks/4.0)) + 8.0 endif + if(snr1.lt.4.0 .or. snr2.lt.4.0 .or. snr.lt.5.0) nspecial=0 endif - if(nstest.eq.0) nspecial=0 -10 continue - -! print*,'a',ia2,ib2,snrdb,xdf,nspecial return end subroutine sh65