From b0e5ff00134841d0b3d02e8e2adb5aa6fe715eaa Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 22 Dec 2022 08:20:39 -0500 Subject: [PATCH] Code cleanup. --- q65w/libq65/getcand2.f90 | 12 ------------ q65w/libq65/q65b.f90 | 18 +----------------- q65w/libq65/q65wa.f90 | 16 ---------------- q65w/libq65/wideband_sync.f90 | 13 ------------- 4 files changed, 1 insertion(+), 58 deletions(-) diff --git a/q65w/libq65/getcand2.f90 b/q65w/libq65/getcand2.f90 index 7ebcc35aa..da779e470 100644 --- a/q65w/libq65/getcand2.f90 +++ b/q65w/libq65/getcand2.f90 @@ -1,7 +1,6 @@ subroutine getcand2(ss,savg0,nts_q65,cand,ncand) use wideband_sync -! parameter(NFFT=32768) real ss(322,NFFT) real savg0(NFFT),savg(NFFT) integer ipk1(1) @@ -27,8 +26,6 @@ subroutine getcand2(ss,savg0,nts_q65,cand,ncand) nguard=5 j=0 - sync(1:NFFT)%ccfmax=0. - do i=1,NFFT-nbw-nguard if(savg(i).lt.smin) cycle spk=maxval(savg(i:i+nb0)) @@ -39,13 +36,9 @@ subroutine getcand2(ss,savg0,nts_q65,cand,ncand) call q65_sync(ss,i0,nts_q65,sync_ok,snr_sync,xdt) if(.not.sync_ok) cycle j=j+1 -! write(73,3073) j,fpk+32.0-2.270,snr_sync,xdt -!3073 format(i3,3f10.3) cand(j)%f=fpk cand(j)%xdt=xdt cand(j)%snr=snr_sync - cand(j)%iflip=0 - sync(i0)%ccfmax=snr_sync ia=min(i,i0-nguard) ib=i0+nbw+nguard savg(ia:ib)=0. @@ -53,10 +46,5 @@ subroutine getcand2(ss,savg0,nts_q65,cand,ncand) enddo ncand=j -! do i=1,NFFT -! write(72,3072) i,0.001*i*df+32.0,savg0(i),savg(i),sync(i)%ccfmax -!3072 format(i6,f15.6,3f15.3) -! enddo - return end subroutine getcand2 diff --git a/q65w/libq65/q65b.f90 b/q65w/libq65/q65b.f90 index 4f75ab2d9..373e5183a 100644 --- a/q65w/libq65/q65b.f90 +++ b/q65w/libq65/q65b.f90 @@ -15,11 +15,9 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & parameter (MAXFFT2=336000) !56*6000 (downsampled by 1/16) parameter (NMAX=60*12000) parameter (RAD=57.2957795) -! type(hdr) h !Header for the .wav file integer*2 iwave(60*12000) complex ca(MAXFFT1) !FFTs of raw x,y data complex cx(0:MAXFFT2-1),cz(0:MAXFFT2) - integer ipk1(1) real*8 fcenter,freq0,freq1 character*12 mycall0,hiscall0 character*12 mycall,hiscall @@ -38,16 +36,7 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & ! Find best frequency from sync_dat, the "orange sync curve". df3=96000.0/32768.0 - ifreq=nint((1000.0*f0)/df3) - ia=nint(ifreq-ntol/df3) - ib=nint(ifreq+ntol/df3) - ipk1=maxloc(sync(ia:ib)%ccfmax) - ipk=ia+ipk1(1)-1 -! f_ipk=ipk*df3 - ipk2=(1000.0*f0-1.0)/df3 - snr1=sync(ipk)%ccfmax - ipk=ipk2 !Substitute new ipk value - + ipk=(1000.0*f0-1.0)/df3 nfft1=MAXFFT1 nfft2=MAXFFT2 df=96000.0/NFFT1 @@ -62,8 +51,6 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & if(nagain.eq.1) k0=nint((f_mouse-1000.0)/df) if(k0.lt.nh .or. k0.gt.MAXFFT1-nfft2+1) go to 900 - if(snr1.lt.1.5) go to 900 !### Threshold needs work? ### - fac=1.0/nfft2 cx(0:nfft2-1)=ca(k0:k0+nfft2-1) cx=fac*cx @@ -111,7 +98,6 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & nsnr0=-99 !Default snr for no decode ! NB: Frequency of ipk is now shifted to 1000 Hz. - call map65_mmdec(nutc,iwave,nqd,nsubmode,nfa,nfb,1000,ntol, & newdat,nagain,max_drift,ndepth,mycall,hiscall,hisgrid) MHz=fcenter @@ -134,11 +120,9 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & write(12,1130) datetime,trim(result(ndecodes)(5:)) 1130 format(a11,1x,a) result(ndecodes)=trim(result(ndecodes))//char(0) -! print*,'AAA',f_ipk,k0*df,f0,ipk,ipk2,trim(msg0) idec=0 endif 900 flush(12) - return end subroutine q65b diff --git a/q65w/libq65/q65wa.f90 b/q65w/libq65/q65wa.f90 index af0ad6b2d..d9f7d1b10 100644 --- a/q65w/libq65/q65wa.f90 +++ b/q65w/libq65/q65wa.f90 @@ -26,7 +26,6 @@ subroutine q65wa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & save if(nagain.eq.1) ndepth=3 - nkhz_center=nint(1000.0*(fcenter-int(fcenter))) mfa=nfa-nkhz_center+48 mfb=nfb-nkhz_center+48 @@ -34,15 +33,9 @@ subroutine q65wa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & nts_q65=2**(mode_q65-1) !Q65 tone separation factor call timer('get_cand',0) -! call get_candidates(ss,savg,nhsym,mfa,mfb,nts_jt65,nts_q65,cand,ncand) call getcand2(ss,savg,nts_q65,cand,ncand) call timer('get_cand',1) -! do i=1,ncand -! write(71,3071) i,cand(i)%f,cand(i)%xdt,cand(i)%snr -!3071 format(i2,3f10.3) -! enddo - candec=.false. nwrite_q65=0 bq65=mode_q65.gt.0 @@ -61,26 +54,17 @@ subroutine q65wa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & ! Do the wideband Q65 decode do icand=1,ncand f0=cand(icand)%f - if(cand(icand)%iflip.ne.0) cycle !Do only Q65 candidates here if(candec(icand)) cycle !Skip if already decoded freq=cand(icand)%f+nkhz_center-48.0-1.27046 ikhz=nint(freq) idec=-1 -! print*,'AAA',icand,nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & -! mycall,hiscall,hisgrid,mode_q65,f0,fqso,newdat, & -! nagain,max_drift,ndop00 call timer('q65b ',0) call q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & mycall,hiscall,hisgrid,mode_q65,f0,fqso,newdat, & nagain,max_drift,ndepth,datetime,ndop00,idec) call timer('q65b ',1) if(idec.ge.0) candec(icand)=.true. - -! write(71,3071) icand,cand(icand)%f,32.0+cand(icand)%f, & -! cand(icand)%xdt,cand(icand)%snr,idec,ndecodes -!3071 format(i2,4f10.3,2i5) - enddo ! icand ndecdone=2 diff --git a/q65w/libq65/wideband_sync.f90 b/q65w/libq65/wideband_sync.f90 index 6ef154f46..45702e653 100644 --- a/q65w/libq65/wideband_sync.f90 +++ b/q65w/libq65/wideband_sync.f90 @@ -4,24 +4,11 @@ module wideband_sync real :: snr !Relative S/N of sync detection real :: f !Freq of sync tone, 0 to 96000 Hz real :: xdt !DT of matching sync pattern, -1.0 to +4.0 s - real :: pol !Polarization angle, degrees - integer :: ipol !Polarization angle, 1 to 4 ==> 0, 45, 90, 135 deg - integer :: iflip !Sync type: JT65 = +/- 1, Q65 = 0 - integer :: indx end type candidate - type sync_dat - real :: ccfmax - real :: xdt - real :: pol - integer :: ipol - integer :: iflip - logical :: birdie - end type sync_dat parameter (NFFT=32768) parameter (MAX_CANDIDATES=50) parameter (SNR1_THRESHOLD=4.5) - type(sync_dat) :: sync(NFFT) integer nkhz_center end module wideband_sync