From fa73b3f50ec6ead52c3371a96f62bc6e666a9ee5 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Sun, 4 Dec 2022 22:15:32 +0100 Subject: New upstream version 2.6.0~rc5+repack --- lib/avecho.f90 | 47 +++++++++++++++++++++++++++++++++------------- lib/echosim.f90 | 54 ++++++++++++++++++++++++++++++++++++----------------- lib/fst4_decode.f90 | 25 +++++++++++++++++++------ lib/ft8/ft8b.f90 | 8 +++++--- lib/ft8/sync8.f90 | 54 ++++++++++++++++++++++++++++++++++++++--------------- lib/ft8_decode.f90 | 22 +++++++++++++--------- lib/symspec.f90 | 6 ++---- lib/testfast9.f90 | 6 +++--- 8 files changed, 152 insertions(+), 70 deletions(-) (limited to 'lib') diff --git a/lib/avecho.f90 b/lib/avecho.f90 index 4b078f71..7b499a05 100755 --- a/lib/avecho.f90 +++ b/lib/avecho.f90 @@ -1,5 +1,5 @@ -subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & - dfreq,width,bDiskData) +subroutine avecho(id2,ndop,nfrit,nauto,navg,nqual,f1,xlevel,snrdb, & + db_err,dfreq,width,bDiskData) integer TXLENGTH parameter (TXLENGTH=27648) !27*1024 @@ -8,6 +8,8 @@ subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & integer*2 id2(34560) !Buffer for Rx data real sa(NZ) !Avg spectrum relative to initial Doppler echo freq real sb(NZ) !Avg spectrum with Dither and changing Doppler removed + real, dimension (:,:), allocatable :: sax + real, dimension (:,:), allocatable :: sbx integer nsum !Number of integrations real dop0 !Doppler shift for initial integration (Hz) real dop !Doppler shift for current integration (Hz) @@ -20,8 +22,18 @@ subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & equivalence (x,c),(ipk,ipkv) common/echocom/nclearave,nsum,blue(NZ),red(NZ) common/echocom2/fspread_self,fspread_dx - save dop0,sa,sb + data navg0/-1/ + save dop0,navg0,sax,sbx + if(navg.ne.navg0) then + if(allocated(sax)) deallocate(sax) + if(allocated(sbx)) deallocate(sbx) + allocate(sax(1:navg,1:NZ)) + allocate(sbx(1:navg,1:NZ)) + nsum=0 + navg0=navg + endif + fspread=fspread_dx !### Use the predicted Doppler spread ### if(bDiskData) fspread=width if(nauto.eq.1) fspread=fspread_self @@ -44,8 +56,8 @@ subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & if(nclearave.ne.0) nsum=0 if(nsum.eq.0) then dop0=dop !Remember the initial Doppler - sa=0. !Clear the average arrays - sb=0. + sax=0. !Clear the average arrays + sbx=0. endif x(TXLENGTH+1:)=0. @@ -67,10 +79,14 @@ subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & endif nsum=nsum+1 + j=mod(nsum-1,navg)+1 do i=1,NZ - sa(i)=sa(i) + s(ia+i-2048) !Center at initial doppler freq - sb(i)=sb(i) + s(ib+i-2048) !Center at expected echo freq + sax(j,i)=s(ia+i-2048) !Center at initial doppler freq + sbx(j,i)=s(ib+i-2048) !Center at expected echo freq + sa(i)=sum(sax(1:navg,i)) + sb(i)=sum(sbx(1:navg,i)) enddo + call echo_snr(sa,sb,fspread,blue,red,snrdb,db_err,dfreq,snr_detect) nqual=snr_detect-2 if(nqual.lt.0) nqual=0 @@ -87,12 +103,17 @@ subroutine avecho(id2,ndop,nfrit,nauto,nqual,f1,xlevel,snrdb,db_err, & call smo121(blue,NZ) enddo - ia=200.0/df - ib=400.0/df - call pctile(red(ia:ib),ib-ia+1,50,bred) - red=red-bred - call pctile(blue(ia:ib),ib-ia+1,50,bblue) - blue=blue-bblue + ia=50.0/df + ib=250.0/df + call pctile(red(ia:ib),ib-ia+1,50,bred1) + call pctile(blue(ia:ib),ib-ia+1,50,bblue1) + ia=1250.0/df + ib=1450.0/df + call pctile(red(ia:ib),ib-ia+1,50,bred2) + call pctile(blue(ia:ib),ib-ia+1,50,bblue2) + + red=red-0.5*(bred1+bred2) + blue=blue-0.5*(bblue1+bblue2) 900 call sleep_msec(10) !Avoid the "blue Decode button" syndrome return diff --git a/lib/echosim.f90 b/lib/echosim.f90 index eeac4bd8..88477a21 100755 --- a/lib/echosim.f90 +++ b/lib/echosim.f90 @@ -8,7 +8,7 @@ program echosim character arg*12,fname*17 complex c0(0:NMAX-1) complex c(0:NMAX-1) -! complex cwave(0:NWAVE-1) + real*4 level_1,level_2 real*8 f0,dt,twopi,phi,dphi real wave(NZ) integer*2 iwave(NZ) !Generated full-length waveform @@ -20,9 +20,11 @@ program echosim ! Get command-line argument(s) nargs=iargc() - if(nargs.ne.5) then - print*,'Usage: echosim f0 fdop fspread nfiles snr' - print*,'Examples: echosim 1500 0.0 4.0 10 -22' + if(nargs.ne.3 .and. nargs.ne.5) then + print*,'Usage 1: echosim f0 fdop fspread nfiles snr' + print*,'Example: echosim 1500 0.0 4.0 10 -22' + print*,'Usage 2: echosim level_1 level_2 nfiles' + print*,'Example: echosim 30.0 40.0 100' go to 999 endif @@ -32,12 +34,21 @@ program echosim read(arg,*) fdop !Doppler shift (Hz) call getarg(3,arg) read(arg,*) fspread !Frequency spread (Hz) (JHT Lorentzian model) + + if(nargs.eq.3) then + level_1=f0 + level_2=fdop + nfiles=fspread + snrdb=0. + go to 10 + endif + call getarg(4,arg) read(arg,*) nfiles !Number of files call getarg(5,arg) read(arg,*) snrdb !SNR_2500 - twopi=8.d0*atan(1.d0) +10 twopi=8.d0*atan(1.d0) fs=12000.0 !Sample rate (Hz) dt=1.d0/fs !Sample interval (s) bandwidth_ratio=2500.0/(fs/2.0) @@ -49,18 +60,23 @@ program echosim 1000 format(' N f0 fDop fSpread SNR File name'/51('-')) do ifile=1,nfiles - phi=0.d0 - do i=0,NWAVE-1 - phi=phi + dphi - if(phi.gt.twopi) phi=phi-twopi - xphi=phi - c0(i)=cmplx(cos(xphi),sin(xphi)) - enddo - c0(NWAVE:)=0. - if(fspread.gt.0.0) call fspread_lorentz(c0,fspread) - c=sig*c0 - wave(1:NWAVE)=imag(c(1:NWAVE)) - peak=maxval(abs(wave)) + wave=0. + + if(nargs.eq.5) then + phi=0.d0 + do i=0,NWAVE-1 + phi=phi + dphi + if(phi.gt.twopi) phi=phi-twopi + xphi=phi + c0(i)=cmplx(cos(xphi),sin(xphi)) + enddo + c0(NWAVE:)=0. + if(fspread.gt.0.0) call fspread_lorentz(c0,fspread) + c=sig*c0 + wave(1:NWAVE)=imag(c(1:NWAVE)) + peak=maxval(abs(wave)) + endif + if(snrdb.lt.90) then do i=1,NWAVE !Add gaussian noise at specified SNR xnoise=gran() @@ -73,6 +89,10 @@ program echosim endif gain=100.0 + if(nargs.eq.3) then + gain=10.0**(0.05*level_1) + if(mod((ifile-1)/10,2).eq.1) gain=10.0**(0.05*level_2) + endif if(snrdb.lt.90.0) then wave=gain*wave else diff --git a/lib/fst4_decode.f90 b/lib/fst4_decode.f90 index 4245ad91..d3b8af73 100755 --- a/lib/fst4_decode.f90 +++ b/lib/fst4_decode.f90 @@ -586,13 +586,26 @@ contains xsig=xsig+s4(itone(i),i) enddo base=candidates(icand,5) - arg=600.0*(xsig/base)-1.0 + select case(ntrperiod) + case(15) + snr_calfac=800.0 + case(30) + snr_calfac=600.0 + case(60) + snr_calfac=430.0 + case(120) + snr_calfac=390.0 + case(300) + snr_calfac=340.0 + case(900) + snr_calfac=320.0 + case(1800) + snr_calfac=320.0 + case default + end select + arg=snr_calfac*xsig/base - 1.0 if(arg.gt.0.0) then - xsnr=10*log10(arg)-35.5-12.5*log10(nsps/8200.0) - if(ntrperiod.eq. 15) xsnr=xsnr+2 - if(ntrperiod.eq. 30) xsnr=xsnr+1 - if(ntrperiod.eq. 900) xsnr=xsnr+1 - if(ntrperiod.eq.1800) xsnr=xsnr+2 + xsnr=10*log10(arg)+10*log10(1.46/2500)+10*log10(8200.0/nsps) else xsnr=-99.9 endif diff --git a/lib/ft8/ft8b.f90 b/lib/ft8/ft8b.f90 index 36ae1283..75b17adf 100755 --- a/lib/ft8/ft8b.f90 +++ b/lib/ft8/ft8b.f90 @@ -287,6 +287,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & ! 5 : WW_DIGI ! 6 : FOX ! 7 : HOUND +! 8 : ARRL_DIGI ! ! Conditions that cause us to bail out of AP decoding if(ncontest.le.5 .and. iaptype.ge.3 .and. (abs(f1-nfqso).gt.napwid .and. abs(f1-nftx).gt.napwid) ) cycle @@ -306,6 +307,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & if(ncontest.eq.4) llrz(1:29)=apmag*mcqru(1:29) if(ncontest.eq.5) llrz(1:29)=apmag*mcqww(1:29) if(ncontest.eq.7) llrz(1:29)=apmag*mcq(1:29) + if(ncontest.eq.8) llrz(1:29)=apmag*mcqtest(1:29) apmask(75:77)=1 llrz(75:76)=apmag*(-1) llrz(77)=apmag*(+1) @@ -313,7 +315,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & if(iaptype.eq.2) then ! MyCall,???,??? apmask=0 - if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.5) then + if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.5.or.ncontest.eq.8) then apmask(1:29)=1 llrz(1:29)=apmag*apsym(1:29) apmask(75:77)=1 @@ -353,7 +355,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & if(iaptype.eq.3) then ! MyCall,DxCall,??? apmask=0 - if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.2.or.ncontest.eq.5.or.ncontest.eq.7) then + if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.2.or.ncontest.eq.5.or.ncontest.eq.7.or.ncontest.eq.8) then apmask(1:58)=1 llrz(1:58)=apmag*apsym apmask(75:77)=1 @@ -379,7 +381,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & if(iaptype.eq.5.and.ncontest.eq.7) cycle !Hound if(iaptype.eq.4 .or. iaptype.eq.5 .or. iaptype.eq.6) then apmask=0 - if(ncontest.le.5 .or. (ncontest.eq.7.and.iaptype.eq.6)) then + if(ncontest.le.5 .or. (ncontest.eq.7.and.iaptype.eq.6) .or. ncontest.eq.8) then apmask(1:77)=1 ! mycall, hiscall, RRR|73|RR73 llrz(1:58)=apmag*apsym if(iaptype.eq.4) llrz(59:77)=apmag*mrrr diff --git a/lib/ft8/sync8.f90 b/lib/ft8/sync8.f90 index 5ea2254a..f93afe75 100755 --- a/lib/ft8/sync8.f90 +++ b/lib/ft8/sync8.f90 @@ -1,9 +1,10 @@ -subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, & +subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,nzhsym,candidate, & ncand,sbase) include 'ft8_params.f90' - parameter (MAXPRECAND=500) -! Search over +/- 2.5s relative to 0.5s TX start time. + parameter (MAXPRECAND=1000) +! Maximum sync correlation lag +/- 2.5s relative to 0.5s TX start time. +! 2.5s / 0.16s/symbol * 4 samples/symbol = 62.5 lag steps in 2.5s parameter (JZ=62) complex cx(0:NH1) real s(NH1,NHSYM) @@ -12,11 +13,14 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, & real x(NFFT1) real sync2d(NH1,-JZ:JZ) real red(NH1) + real red2(NH1) real candidate0(3,MAXPRECAND) real candidate(3,maxcand) real dd(NMAX) integer jpeak(NH1) + integer jpeak2(NH1) integer indx(NH1) + integer indx2(NH1) integer ii(1) integer icos7(0:6) data icos7/3,1,4,0,6,5,2/ !Costas 7x7 tone pattern @@ -82,11 +86,16 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, & enddo red=0. + red2=0. + mlag=10 + mlag2=JZ do i=ia,ib - ii=maxloc(sync2d(i,-JZ:JZ)) - 1 - JZ - j0=ii(1) - jpeak(i)=j0 - red(i)=sync2d(i,j0) + ii=maxloc(sync2d(i,-mlag:mlag)) - 1 - mlag + jpeak(i)=ii(1) + red(i)=sync2d(i,jpeak(i)) + ii=maxloc(sync2d(i,-mlag2:mlag2)) - 1 - mlag2 + jpeak2(i)=ii(1) + red2(i)=sync2d(i,jpeak2(i)) enddo iz=ib-ia+1 call indexx(red(ia:ib),iz,indx) @@ -100,14 +109,29 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, & if(ibase.gt.nh1) ibase=nh1 base=red(ibase) red=red/base - + call indexx(red2(ia:ib),iz,indx2) + ibase2=indx2(npctile) - 1 + ia + if(ibase2.lt.1) ibase2=1 + if(ibase2.gt.nh1) ibase2=nh1 + base2=red2(ibase2) + red2=red2/base2 do i=1,min(MAXPRECAND,iz) n=ia + indx(iz+1-i) - 1 - if(red(n).lt.syncmin.or.isnan(red(n)).or.k.eq.MAXPRECAND) exit - k=k+1 - candidate0(1,k)=n*df - candidate0(2,k)=(jpeak(n)-0.5)*tstep - candidate0(3,k)=red(n) + if(k.ge.MAXPRECAND) exit + if( (red(n).ge.syncmin) .and. (.not.isnan(red(n))) ) then + k=k+1 + candidate0(1,k)=n*df + candidate0(2,k)=(jpeak(n)-0.5)*tstep + candidate0(3,k)=red(n) + endif + if(abs(jpeak2(n)-jpeak(n)).eq.0) cycle + if(k.ge.MAXPRECAND) exit + if( (red2(n).ge.syncmin) .and. (.not.isnan(red2(n))) ) then + k=k+1 + candidate0(1,k)=n*df + candidate0(2,k)=(jpeak2(n)-0.5)*tstep + candidate0(3,k)=red2(n) + endif enddo ncand=k @@ -116,7 +140,8 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, & if(i.ge.2) then do j=1,i-1 fdiff=abs(candidate0(1,i))-abs(candidate0(1,j)) - if(abs(fdiff).lt.4.0) then + tdiff=abs(candidate0(2,i)-candidate0(2,j)) + if(abs(fdiff).lt.4.0.and.tdiff.lt.0.04) then if(candidate0(3,i).ge.candidate0(3,j)) candidate0(3,j)=0. if(candidate0(3,i).lt.candidate0(3,j)) candidate0(3,i)=0. endif @@ -148,6 +173,5 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,s,candidate, & endif enddo ncand=k-1 - return end subroutine sync8 diff --git a/lib/ft8_decode.f90 b/lib/ft8_decode.f90 index 4eefa211..d36fbd5a 100755 --- a/lib/ft8_decode.f90 +++ b/lib/ft8_decode.f90 @@ -44,7 +44,7 @@ contains class(ft8_decoder), intent(inout) :: this procedure(ft8_decode_callback) :: callback - parameter (MAXCAND=300,MAX_EARLY=100) + parameter (MAXCAND=600,MAX_EARLY=100) real*8 tsec,tseq real s(NH1,NHSYM) real sbase(NH1) @@ -80,7 +80,9 @@ contains dt0=0. f0=0. endif - if(nutc.ne.nutc0) then +!Added 41==nzhsym to force a reset if the same wav file is processed twice or more in a row, +!in which case nutc.eq.nutc0 and ndec(jseq,1) doesn't get reset + if(nzhsym==41 .or. (nutc.ne.nutc0)) then ! New UTC. Move previously saved 'a7' data from k=1 to k=0 iz=ndec(jseq,1) dt0(1:iz,jseq,0) = dt0(1:iz,jseq,1) @@ -107,6 +109,7 @@ contains dd=iwave dd1=dd endif + if(nzhsym.eq.41) then ndecodes=0 allmessages=' ' @@ -114,10 +117,12 @@ contains else ndecodes=ndec_early endif + if(nzhsym.eq.47 .and. ndec_early.eq.0) then dd1=dd go to 800 endif + if(nzhsym.eq.47 .and. ndec_early.ge.1) then lsubtracted=.false. lrefinedt=.true. @@ -140,6 +145,7 @@ contains dd1=dd go to 900 endif + if(nzhsym.eq.50 .and. ndec_early.ge.1 .and. .not.nagain) then n=47*3456 dd(1:n)=dd1(1:n) @@ -151,6 +157,7 @@ contains enddo call timer('sub_ft8c',1) endif + ifa=nfa ifb=nfb if(nzhsym.eq.50 .and. nagain) then @@ -164,11 +171,12 @@ contains ! ndepth=2: subtraction, 3 passes, bp+osd (no subtract refinement) ! ndepth=3: subtraction, 3 passes, bp+osd npass=3 - if(ndepth.eq.1) npass=1 + if(ndepth.eq.1) npass=2 do ipass=1,npass newdat=.true. syncmin=1.3 if(ndepth.le.2) syncmin=1.6 + if(nzhsym.eq.41) syncmin=2.0 if(ipass.eq.1) then lsubtract=.true. ndeep=ndepth @@ -185,7 +193,7 @@ contains endif call timer('sync8 ',0) maxc=MAXCAND - call sync8(dd,ifa,ifb,syncmin,nfqso,maxc,s,candidate, & + call sync8(dd,ifa,ifb,syncmin,nfqso,maxc,nzhsym,candidate, & ncand,sbase) call timer('sync8 ',1) do icand=1,ncand @@ -221,10 +229,6 @@ contains if(emedelay.ne.0) xdt=xdt+2.0 call this%callback(sync,nsnr,xdt,f1,msg37,iaptype,qual) call ft8_a7_save(nutc,xdt,f1,msg37) !Enter decode in table -! ii=ndec(jseq,1) -! write(41,3041) jseq,ii,nint(f0(ii,jseq,0)),msg0(ii,jseq,0)(1:22),& -! nint(f0(ii,jseq,1)),msg0(ii,jseq,1)(1:22) -!3041 format(3i5,2x,a22,i5,2x,a22) endif endif call timestamp(tsec,tseq,ctime) @@ -237,7 +241,7 @@ contains if(nzhsym.lt.50) ndec_early=ndecodes 900 continue - if(nzhsym.eq.50 .and. ndec(jseq,0).ge.1) then + if(lft8apon .and. ncontest.ne.6 .and. ncontest.ne.7 .and. nzhsym.eq.50 .and. ndec(jseq,0).ge.1) then newdat=.true. do i=1,ndec(jseq,0) if(f0(i,jseq,0).eq.-99.0) exit diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 8dd788b4..4f54d022 100755 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -55,6 +55,7 @@ subroutine symspec(shared_data,k,TRperiod,nsps,ingain,bLowSidelobes, & endif if(k.lt.k0) then !Start a new data block + k0=0 ja=0 ssum=0. ihsym=0 @@ -64,11 +65,8 @@ subroutine symspec(shared_data,k,TRperiod,nsps,ingain,bLowSidelobes, & sq=0. pxmax=0.; -! dwell_time=0.0001 -! if(k.gt.k0 .and. npct.gt.0) call blanker(shared_data%id2(k0+1:k), & -! k-k0,dwell_time,npct) - do i=k0+1,k + if(k0.eq.0 .and. i.le.10) cycle x1=shared_data%id2(i) if (abs(x1).gt.pxmax) pxmax = abs(x1); sq=sq + x1*x1 diff --git a/lib/testfast9.f90 b/lib/testfast9.f90 index 22993b24..eb08fb78 100755 --- a/lib/testfast9.f90 +++ b/lib/testfast9.f90 @@ -1,6 +1,6 @@ program testfast9 - parameter (NMAX=359424) + parameter (NMAX=30*12000) integer*2 id2(NMAX) integer narg(0:11) character*80 line(100) @@ -8,8 +8,8 @@ program testfast9 nargs=iargc() if(nargs.ne.2) then - print*,'Usage: testfast9 submode infile' - print*,'Example: testfast9 E /data/VE1SKY/K1JT/JT9E/150806_123300.wav' + print*,'Usage: testfast9 submode infile' + print*,'Example: testfast9 E 150806_123300.wav' go to 999 endif call getarg(1,submode) -- cgit v1.2.3