From acc2ea0c48ac76c5965606637c241d088721c915 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 5 Apr 2016 13:17:38 +0000 Subject: [PATCH] Refactor parts of jt9w. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6576 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/Makefile.jt9w | 2 +- lib/decode9w.f90 | 57 +++++++++++++++++++++++++++++++++++++++++++++++ lib/jt9w.f90 | 53 ++----------------------------------------- 3 files changed, 60 insertions(+), 52 deletions(-) create mode 100644 lib/decode9w.f90 diff --git a/lib/Makefile.jt9w b/lib/Makefile.jt9w index 3d44edb7c..797a7e97b 100644 --- a/lib/Makefile.jt9w +++ b/lib/Makefile.jt9w @@ -35,7 +35,7 @@ all: jt9w OBJS1 = jt9w.o smo.o sync9w.o pctile.o shell.o lorentzian.o fchisq0.o \ softsym9w.o four2a.o interleave9.o jt9fano.o fano232.o packjt.o \ - deg2grid.o grid2deg.o fmtmsg.o db.o + deg2grid.o grid2deg.o fmtmsg.o db.o decode9w.o jt9w: $(OBJS1) $(FC) -o jt9w $(OBJS1) -lfftw3f diff --git a/lib/decode9w.f90 b/lib/decode9w.f90 new file mode 100644 index 000000000..80d8255f1 --- /dev/null +++ b/lib/decode9w.f90 @@ -0,0 +1,57 @@ +subroutine decode9w(nutc,nfqso,ntol,nsubmode,ss,id2) + + parameter (NSMAX=6827,NZMAX=60*12000) + real ss(184,NSMAX) + real ccfred(NSMAX) + real ccfblue(-9:18) + real a(5) + integer*2 id2(NZMAX) + integer*1 i1SoftSymbols(207) + character*22 decoded + + df=12000.0/16384.0 + nsps=6912 + tstep=nsps*0.5/12000.0 + npts=52*12000 + limit=10000 + ntol=100 + + ia=nint((nfqso-ntol)/df) + ib=nint((nfqso+ntol)/df) + lag1=-int(2.5/tstep + 0.9999) + lag2=int(5.0/tstep + 0.9999) + nhsym=184 + do iter=1,2 + nadd=3 + if(iter.eq.2) nadd=2*nint(0.375*a(4)) + 1 + call sync9w(ss,nhsym,lag1,lag2,ia,ib,ccfred,ccfblue,ipk,lagpk,nadd) + sum1=sum(ccfblue) - ccfblue(lagpk-1)-ccfblue(lagpk) -ccfblue(lagpk+1) + sq=dot_product(ccfblue,ccfblue) - ccfblue(lagpk-1)**2 - & + ccfblue(lagpk)**2 - ccfblue(lagpk+1)**2 + base=sum1/25.0 + rms=sqrt(sq/24.0) + snr=(ccfblue(lagpk)-base)/rms + nsnr=nint(db(snr)-29.7) + xdt0=lagpk*tstep + + call lorentzian(ccfred(ia),ib-ia+1,a) + f0=(ia+a(3))*df +! write(*,3001) nadd,a,base,rms,snr,xdt,f0,ipk,lagpk +!3001 format(i3,9f7.2,f7.1,2i5) + + ccfblue=(ccfblue-base)/rms +! rewind 16 +! do lag=lag1,lag2 +! write(16,3002) lag*tstep,ccfblue(lag) +!3002 format(2f10.3) +! enddo + + enddo + + call softsym9w(id2,npts,xdt0,f0,a(4)*df,nsubmode,xdt1,i1softsymbols) + call jt9fano(i1softsymbols,limit,nlim,decoded) + write(*,1100) nutc,nsnr,xdt1-1.0,nint(f0),decoded,nlim +1100 format(i4.4,i4,f5.1,i5,1x,'@',1x,a22,i10) + + return +end subroutine decode9w diff --git a/lib/jt9w.f90 b/lib/jt9w.f90 index b3fb62281..923b0dc48 100644 --- a/lib/jt9w.f90 +++ b/lib/jt9w.f90 @@ -3,13 +3,8 @@ program jt9w parameter (NSMAX=6827,NZMAX=60*12000) real ss(184,NSMAX) real ref(NSMAX) - real ccfred(NSMAX) - real ccfblue(-9:18) - real a(5) integer*2 id2(NZMAX) character*12 arg - character*22 decoded - integer*1 i1SoftSymbols(207) call getarg(1,arg) read(arg,*) iutc @@ -19,54 +14,10 @@ program jt9w read(20,*) j,freq,ref(i) enddo - df=12000.0/16384.0 - nsps=6912 - tstep=nsps*0.5/12000.0 - npts=52*12000 - limit=10000 - ntol=100 - do ifile=1,999 - read(60,end=999) nutc,nfqso,ntol,ndepth,nmode,nsubmode,nzhsym,ss,id2 + read(60,end=999) nutc,nfqso,ntol,ndepth,nmode,nsubmode,ss,id2 if(nutc.ne.iutc) cycle - - ia=nint((nfqso-ntol)/df) - ib=nint((nfqso+ntol)/df) - lag1=-int(2.5/tstep + 0.9999) - lag2=int(5.0/tstep + 0.9999) - nhsym=184 - do iter=1,2 - nadd=3 - if(iter.eq.2) nadd=2*nint(0.375*a(4)) + 1 - call sync9w(ss,nhsym,lag1,lag2,ia,ib,ccfred,ccfblue,ipk,lagpk,nadd) - sum1=sum(ccfblue) - ccfblue(lagpk-1)-ccfblue(lagpk) -ccfblue(lagpk+1) - sq=dot_product(ccfblue,ccfblue) - ccfblue(lagpk-1)**2 - & - ccfblue(lagpk)**2 - ccfblue(lagpk+1)**2 - base=sum1/25.0 - rms=sqrt(sq/24.0) - snr=(ccfblue(lagpk)-base)/rms - nsnr=db(snr)-29.7 - xdt0=lagpk*tstep - - call lorentzian(ccfred(ia),ib-ia+1,a) - f0=(ia+a(3))*df -! write(*,3001) nadd,a,base,rms,snr,xdt,f0,ipk,lagpk -!3001 format(i3,9f7.2,f7.1,2i5) - - ccfblue=(ccfblue-base)/rms -! rewind 16 -! do lag=lag1,lag2 -! write(16,3002) lag*tstep,ccfblue(lag) -!3002 format(2f10.3) -! enddo - - enddo - - call softsym9w(id2,npts,xdt0,f0,a(4)*df,nsubmode,xdt1,i1softsymbols) - call jt9fano(i1softsymbols,limit,nlim,decoded) - write(*,1100) nutc,nsnr,xdt1-1.0,nint(f0),decoded,nlim -1100 format(i4.4,i4,f5.1,i5,1x,'@',1x,a22,i10) - + call decode9w(nutc,nfqso,ntol,nsubmode,ss,id2) enddo 999 end program jt9w