From af6d406aebdbfd5a898e7b8dd6c6c8a6b79ed1cc Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 12 May 2021 16:34:00 -0400 Subject: [PATCH] Working toward wideband decoding for Q65. --- map65/libm65/CMakeLists.txt | 1 - map65/libm65/decode0.f90 | 7 ------- map65/libm65/m65.f90 | 2 +- map65/libm65/map65a.f90 | 19 ++++++++++++++++++- map65/libm65/q65b.f90 | 17 ++++++++++------- map65/libm65/synctest.f90 | 5 ++--- map65/libm65/wideband2_sync.f90 | 16 +++++++++------- 7 files changed, 40 insertions(+), 27 deletions(-) diff --git a/map65/libm65/CMakeLists.txt b/map65/libm65/CMakeLists.txt index e7ea7d103..6ff385893 100644 --- a/map65/libm65/CMakeLists.txt +++ b/map65/libm65/CMakeLists.txt @@ -1,6 +1,5 @@ set (libm65_FSRCS # Modules come first: - wideband_sync.f90 wideband2_sync.f90 # Non-module Fortran routines: diff --git a/map65/libm65/decode0.f90 b/map65/libm65/decode0.f90 index ae63c6f53..64c6ea32a 100644 --- a/map65/libm65/decode0.f90 +++ b/map65/libm65/decode0.f90 @@ -1,6 +1,5 @@ subroutine decode0(dd,ss,savg,nstandalone) - use wideband_sync use timer_module, only: timer parameter (NSMAX=60*96000) @@ -23,12 +22,6 @@ subroutine decode0(dd,ss,savg,nstandalone) ! npol=1 + 3*nxpol ! write(50) nutc,npol,ss(1:npol,:,:),savg(1:npol,:) !### - - nkhz_center=nint(1000.0*(fcenter-int(fcenter))) - ntone_spacing=2**(nmode/10) - call timer('wb_sync ',0) - call wb_sync(ss,savg,ntone_spacing) - call timer('wb_sync ',1) if(newdat.ne.0) then nz=52*96000 diff --git a/map65/libm65/m65.f90 b/map65/libm65/m65.f90 index 0fc19fa86..662c2c06b 100644 --- a/map65/libm65/m65.f90 +++ b/map65/libm65/m65.f90 @@ -25,10 +25,10 @@ program m65 ! 27 ! 28 fftw_wisdom.dat - use wideband_sync use timer_module, only: timer use timer_impl, only: init_timer, fini_timer + parameter (NFFT=32768) parameter (NSMAX=60*96000) parameter (NREAD=2048) integer*2 i2(NREAD) diff --git a/map65/libm65/map65a.f90 b/map65/libm65/map65a.f90 index 8886b61d8..78a974489 100644 --- a/map65/libm65/map65a.f90 +++ b/map65/libm65/map65a.f90 @@ -5,7 +5,7 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & ! Processes timf2 data from Linrad to find and decode JT65 signals. - use wideband_sync + use wideband2_sync use timer_module, only: timer parameter (MAXMSG=1000) !Size of decoded message list @@ -26,6 +26,8 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & character decoded*22,blank*22,cmode*2 real short(3,NFFT) !SNR dt ipol for potential shorthands real qphi(12) + type(candidate) :: cand(MAX_CANDIDATES) + common/c3com/ mcall3a common/testcom/ifreq @@ -34,6 +36,21 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & data nfile/0/,nutc0/-999/,nid/0/,ip000/1/,ip001/1/,mousefqso0/-999/ save + nkhz_center=nint(1000.0*(fcenter-int(fcenter))) + ntone_spacing=2**(nmode/10) + call timer('wb_sync ',0) +! call wb_sync(ss,savg,ntone_spacing) + call timer('wb_sync ',1) + +!### + mfa=nfa-nkhz_center+48 + mfb=nfb-nkhz_center+48 + nts_jt65=2 + nts_q65=1 + call get_candidates(ss,savg,mfa,mfb,nts_jt65,nts_q65,cand,ncand) +! print*,'AAA',nfa,nfb,ncand +!### + mode65=mod(nmode,10) if(mode65.eq.3) mode65=4 mode_q65=nmode/10 diff --git a/map65/libm65/q65b.f90 b/map65/libm65/q65b.f90 index b36bed61b..d30a56906 100644 --- a/map65/libm65/q65b.f90 +++ b/map65/libm65/q65b.f90 @@ -10,7 +10,7 @@ subroutine q65b(nutc,fcenter,nfcal,nfsample,ikhz,mousedf,ntol,xpol, & ! use wavhdr use q65_decode - use wideband_sync + use wideband2_sync use timer_module, only: timer parameter (MAXFFT1=5376000) !56*96000 @@ -46,13 +46,16 @@ subroutine q65b(nutc,fcenter,nfcal,nfsample,ikhz,mousedf,ntol,xpol, & ifreq=nint(1000.0*(ff-nkhz_center+48)/df3) !Freq index into ss(4,322,32768) ia=nint(ifreq-ntol/df3) ib=nint(ifreq+ntol/df3) - ipk1=maxloc(sync_dat(ia:ib,2)) - ipk=ia+ipk1(1)-1 - ipol=1 - if(xpol) ipol=nint(sync_dat(ipk,4)) - nhz=nint((ipk-ifreq)*df3) - snr1=sync_dat(ipk,2) +!### + ipk1=maxloc(sync(ia:ib)%ccfmax) + ipk=ia+ipk1(1)-1 + snr1=sync(ipk)%ccfmax + ipol=1 + if(xpol) ipol=sync(ipk)%ipol +! print*,'BBB',ipk00,ipk,snr1,ipol +!### + nfft1=MAXFFT1 nfft2=MAXFFT2 df=96000.0/NFFT1 diff --git a/map65/libm65/synctest.f90 b/map65/libm65/synctest.f90 index 237b36e80..016246588 100644 --- a/map65/libm65/synctest.f90 +++ b/map65/libm65/synctest.f90 @@ -2,13 +2,12 @@ program synctest ! Program to test an algorithm for detecting sync signals for both ! JT65 and Q65-60x signals and rejecting birdies in MAP65 data. - ! The important work is done in module wideband_sync. + ! The important work is done in module wideband2_sync. use timer_module, only: timer use timer_impl, only: init_timer, fini_timer use wideband2_sync - parameter (NFFT=32768) - parameter (MAX_CANDIDATES=20) + real ss(4,322,NFFT),savg(4,NFFT) ! real candidate(MAX_CANDIDATES,5) !snr1,f0,xdt0,ipol,flip character*8 arg diff --git a/map65/libm65/wideband2_sync.f90 b/map65/libm65/wideband2_sync.f90 index 01810579c..cc3381eba 100644 --- a/map65/libm65/wideband2_sync.f90 +++ b/map65/libm65/wideband2_sync.f90 @@ -14,7 +14,12 @@ module wideband2_sync integer :: iflip logical :: birdie end type sync_dat - + + parameter (NFFT=32768) + parameter (MAX_CANDIDATES=20) + type(sync_dat) :: sync(NFFT) + integer nkhz_center + contains subroutine get_candidates(ss,savg,nfa,nfb,nts_jt65,nts_q65,cand,ncand) @@ -24,21 +29,19 @@ subroutine get_candidates(ss,savg,nfa,nfb,nts_jt65,nts_q65,cand,ncand) ! spacings: 1 2 4 8 16 for A B C D E. Birdies are detected and ! excised. Candidates are returned in the structure array cand(). - parameter (NFFT=32768) - parameter (MAX_PEAKS=300,MAX_CANDIDATES=20) + parameter (MAX_PEAKS=300) real ss(4,322,NFFT),savg(4,NFFT) real pavg(-20:20) integer indx(NFFT) logical skip type(candidate) :: cand(MAX_CANDIDATES) - type(sync_dat) :: sync(NFFT) do j=322,1,-1 !Find end of data in ss() if(sum(ss(1,j,1:NFFT)).gt.0.0) exit enddo jz=j -call wb2_sync(ss,savg,jz,nfa,nfb,sync) +call wb2_sync(ss,savg,jz,nfa,nfb) tstep=2048.0/11025.0 !0.185760 s: 0.5*tsym_jt65, 0.3096*tsym_q65 df3=96000.0/NFFT @@ -101,7 +104,7 @@ call wb2_sync(ss,savg,jz,nfa,nfb,sync) return end subroutine get_candidates -subroutine wb2_sync(ss,savg,jz,nfa,nfb,sync) +subroutine wb2_sync(ss,savg,jz,nfa,nfb) ! Compute "orange sync curve" using the Q65 sync pattern @@ -113,7 +116,6 @@ subroutine wb2_sync(ss,savg,jz,nfa,nfb,sync) logical first integer isync(22) integer jsync0(63),jsync1(63) - type(sync_dat) :: sync(NFFT) ! Q65 sync symbols data isync/1,9,12,13,15,22,23,26,27,33,35,38,46,50,55,60,62,66,69,74,76,85/