Refactor parts of jt9w.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6576 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2016-04-05 13:17:38 +00:00
parent fc4b33f934
commit acc2ea0c48
3 changed files with 60 additions and 52 deletions

View File

@ -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

57
lib/decode9w.f90 Normal file
View File

@ -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

View File

@ -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