From 3ee18fe688031800a0b3845adaa99e29dec3d652 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 16 Oct 2012 20:58:03 +0000 Subject: [PATCH] Working on JT9 decoder. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2668 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/jt9.f90 | 35 +++++++++++++---------------------- lib/spec9.f90 | 4 ++-- lib/symspec.f90 | 7 +++---- lib/sync9.f90 | 5 ++--- mainwindow.cpp | 2 +- 5 files changed, 21 insertions(+), 32 deletions(-) diff --git a/lib/jt9.f90 b/lib/jt9.f90 index d821a282a..f325f0fa6 100644 --- a/lib/jt9.f90 +++ b/lib/jt9.f90 @@ -16,9 +16,8 @@ program jt9 integer*1 i1SoftSymbols(207) character*22 msg integer*2 id2 - complex c0 - common/jt9com/id2(NMAX),ss(184,NSMAX),savg(NSMAX),c0(NDMAX), & - nutc,npts8,junk(20) + complex c0(NDMAX) + common/jt9com/ss(184,NSMAX),savg(NSMAX),id2(NMAX) nargs=iargc() if(nargs.lt.1) then @@ -30,9 +29,7 @@ program jt9 go to 999 endif call getarg(1,arg) - if(arg(1:2).eq.'-s') then - go to 999 - endif + if(arg(1:2).eq.'-s') go to 999 read(arg,*) ntrperiod ifile1=2 @@ -66,7 +63,6 @@ program jt9 k=0 nhsym0=-999 npts=(60*ntrperiod-6)*12000 - read(10) id2(1:npts) ! do i=1,npts ! id2(i)=100.0*sin(6.283185307*1046.875*i/12000.0) @@ -74,36 +70,31 @@ program jt9 do iblk=1,npts/kstep k=iblk*kstep + read(10,end=10) id2(k-kstep+1:k) nhsym=(k-2048)/kstep if(nhsym.ge.1 .and. nhsym.ne.nhsym0) then ! Emit signal readyForFFT call symspec(k,ntrperiod,nsps,ndiskdat,nb,nbslider,pxdb, & - s,red,df3,ihsym,nzap,slimit,lstrong) + s,red,df3,ihsym,nzap,slimit,lstrong,c0,npts8) nhsym0=nhsym if(ihsym.ge.184) go to 10 endif enddo -10 continue +10 close(10) + iz=1000.0/df3 + print*,'A',ihsym,nhsym,tstep,df3,ntol,nfqso ! Now do the decoding nutc=nutc0 ! Get sync, approx freq - call sync9(ss,tstep,f0a,df3,ntol,nfqso,sync,fpk,red) - fpk0=fpk -! iz=1000.0/df3 -! do i=1,iz -! freq=1000.0 + (i-1)*df3 -! write(72,3001) freq,red(i),db(red(i)) -!3001 format(3f10.3) -! enddo -! flush(72) - - call spec9(c0,npts8,nsps,f0a,fpk,xdt,i1SoftSymbols) + call sync9(ss,tstep,df3,ntol,nfqso,sync,fpk,red) + print*,'B',sync,fpk + call spec9(c0,npts8,nsps,fpk,xdt,i1SoftSymbols) call decode9(i1SoftSymbols,msg) - write(*,1010) nutc,xdt,1000.0+fpk,msg,sync,fpk0 -1010 format(i4.4,f6.1,f7.1,2x,a22,2f9.1) + write(*,1010) nutc,sync,xdt,1000.0+fpk,msg +1010 format(i4.4,3f7.1,2x,a22) enddo go to 999 diff --git a/lib/spec9.f90 b/lib/spec9.f90 index 01be6f28e..04c76ebe6 100644 --- a/lib/spec9.f90 +++ b/lib/spec9.f90 @@ -1,4 +1,4 @@ -subroutine spec9(c0,npts8,nsps,f0a,fpk,xdt,i1SoftSymbols) +subroutine spec9(c0,npts8,nsps,fpk,xdt,i1SoftSymbols) parameter (MAXFFT=31500) complex c0(0:npts8-1) @@ -31,7 +31,7 @@ subroutine spec9(c0,npts8,nsps,f0a,fpk,xdt,i1SoftSymbols) enddo nsps8=nsps/8 - foffset=fpk-f0a + foffset=fpk istart=1520 call peakdf9(c0,npts8,nsps8,istart,foffset,idf) diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 4e6cab445..49a0e75ad 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -1,5 +1,5 @@ subroutine symspec(k,ntrperiod,nsps,ndiskdat,nb,nbslider,pxdb,s,red, & - df3,ihsym,nzap,slimit,lstrong) + df3,ihsym,nzap,slimit,lstrong,c0,npts8) ! Input: ! k pointer to the most recent new data @@ -31,9 +31,8 @@ subroutine symspec(k,ntrperiod,nsps,ndiskdat,nb,nbslider,pxdb,s,red, & complex cx(0:MAXFFT3-1) logical*1 lstrong(0:1023) !Should be (0:512) integer*2 id2 - complex c0 - common/jt9com/id2(NMAX),ss(184,NSMAX),savg(NSMAX),c0(NDMAX), & - nutc,npts8,junk(20) + complex c0(NDMAX) + common/jt9com/ss(184,NSMAX),savg(NSMAX),id2(NMAX) data rms/999.0/,k0/99999999/,ntrperiod0/0/,nfft3z/0/ save diff --git a/lib/sync9.f90 b/lib/sync9.f90 index 94a73ab5b..2aaf1057b 100644 --- a/lib/sync9.f90 +++ b/lib/sync9.f90 @@ -1,4 +1,4 @@ -subroutine sync9(ss,tstep,f0a,df3,ntol,nfqso,sync,fpk,ccfred) +subroutine sync9(ss,tstep,df3,ntol,nfqso,sync,fpk,ccfred) parameter (NSMAX=22000) !Max length of saved spectra real ss(184,NSMAX) @@ -25,7 +25,6 @@ subroutine sync9(ss,tstep,f0a,df3,ntol,nfqso,sync,fpk,ccfred) if(ia.lt.1) ia=1 if(ib.gt.NSMAX) ib=NSMAX endif -! print*,ia,ib,f0a,df3,ntol,nfqso,df3*ia+1000,df3*ib+1000 sbest=0. lagmax=2.5/tstep + 0.9999 @@ -53,7 +52,7 @@ subroutine sync9(ss,tstep,f0a,df3,ntol,nfqso,sync,fpk,ccfred) ccfred(i)=smax enddo - fpk=f0a + (ipkbest-1)*df3 + fpk=(ipkbest-1)*df3 sync=sbest return diff --git a/mainwindow.cpp b/mainwindow.cpp index 29eed4b6c..d613ec92c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,4 +1,4 @@ -//--------------------------------------------------------------- MainWindow +//---------------------------------------------------------------- MainWindow #include "mainwindow.h" #include "ui_mainwindow.h" #include "devsetup.h"