From a0eb456a4fb4630986f95330dead75ca24d20228 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 14 May 2013 17:42:25 +0000 Subject: [PATCH] 1. Minor corrections to plotter.cpop and widegraph.cpp. 2. New algorithm for 'sync9'. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3267 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/decoder.f90 | 32 ++++++++++++++------------------ lib/sync9.f90 | 24 ++++++++++++------------ mainwindow.cpp | 2 +- plotter.cpp | 3 ++- widegraph.cpp | 2 +- 5 files changed, 30 insertions(+), 33 deletions(-) diff --git a/lib/decoder.f90 b/lib/decoder.f90 index d52e8d0de..22d8396a0 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -13,9 +13,7 @@ subroutine decoder(ss,c0,nstandalone) logical ccfok(NSMAX) logical done(NSMAX) integer*1 i1SoftSymbols(207) - integer ii(1) complex c0(NDMAX) - complex c1(NDMAX) common/npar/nutc,ndiskdat,ntrperiod,nfqso,newdat,npts8,nfa,nfb,ntol, & kin,nzhsym,nsave,nagain,ndepth,nrxlog,nfsample,datetime common/tracer/limtrace,lu @@ -60,7 +58,7 @@ subroutine decoder(ss,c0,nstandalone) if(nsps.eq.0) stop 'Error: bad TRperiod' !Better: return an error code### tstep=0.5*nsps/12000.0 !Half-symbol step (seconds) - idf=ntol/df3 + 0.999 +! idf=ntol/df3 + 0.999 done=.false. do nqd=1,0,-1 @@ -74,7 +72,6 @@ subroutine decoder(ss,c0,nstandalone) limit=200000 ccflim=2.5 endif -! if(nstandalone.eq.1) ccflim=0.9*ccflim if(nqd.eq.1) then nfa1=nfqso-ntol @@ -83,22 +80,27 @@ subroutine decoder(ss,c0,nstandalone) nfa1=nfa nfb1=nfb endif + ia=max(1,nint((nfa1-1000)/df3)) + ib=min(NSMAX,nint((nfb1-1000)/df3)) + lag1=-(2.5/tstep + 0.9999) + lag2=5.0/tstep + 0.9999 call timer('sync9 ',0) ! Compute ccfred() - call sync9(ss,nzhsym,tstep,df3,nfa1,nfb1,ccfred,ia,ib,ipk) + call sync9(ss,nzhsym,lag1,lag2,ia,ib,ccfred,ipk) call timer('sync9 ',1) ccfok=.false. - ccfok(max(ipk-idf,1):min(ipk+idf,NSMAX))=.true. if(nqd.eq.1) then + ccfok(ipk)=.true. + do i=ia,ib + ccfok(i)=ccfred(i).gt.ccflim + enddo ia1=ia ib1=ib else - do i=ia+9,ib-25 - t1=ccfred(i)/(sum(ccfred(i-8:i-6)/3.0)) - t2=ccfred(i)/(sum(ccfred(i+23:i+25)/3.0)) - if(t1.ge.ccflim .and. t2.ge.ccflim) ccfok(i)=.true. + do i=ia,ib + ccfok(i)=ccfred(i).gt.ccflim enddo ccfok(ia1:ib1)=.false. endif @@ -108,9 +110,6 @@ subroutine decoder(ss,c0,nstandalone) nsps8=nsps/8 df8=1500.0/nsps8 dblim=db(864.0/nsps8) - 26.2 - i1=max(nint((nfqso-1000)/df3 - 10),ia) - i2=min(nint((nfqso-1000)/df3 + 10),ib) - ii=maxloc(ccfred(i1:i2)) do i=ia,ib f=(i-1)*df3 @@ -124,9 +123,6 @@ subroutine decoder(ss,c0,nstandalone) call timer('softsym ',0) fpk=1000.0 + df3*(i-1) -! c1(1:npts8)=conjg(c0(1:npts8)) -! call softsym(c1,npts8,nsps8,fpk,syncpk,snrdb,xdt,freq,drift, & -! i1SoftSymbols) call softsym(c0,npts8,nsps8,newdat,fpk,syncpk,snrdb,xdt,freq, & drift,i1SoftSymbols) @@ -143,8 +139,8 @@ subroutine decoder(ss,c0,nstandalone) nsnr=nint(snrdb) ndrift=nint(drift/df3) - write(38,3002) nutc,freq,ccfred(i),nlim,msg -3002 format(i4.4,2f8.1,i9,2x,a22) + write(38,3002) nutc,nsnr,i,ccfred(i),nlim,msg +3002 format(i4.4,i5,i6,f8.1,i9,2x,a22) if(msg.ne.' ') then if(nqd.eq.0) ndecodes0=ndecodes0+1 diff --git a/lib/sync9.f90 b/lib/sync9.f90 index 285c219b1..1fb73a70a 100644 --- a/lib/sync9.f90 +++ b/lib/sync9.f90 @@ -1,34 +1,34 @@ -subroutine sync9(ss,nzhsym,tstep,df3,nfa,nfb,ccfred,ia,ib,ipkbest) +subroutine sync9(ss,nzhsym,lag1,lag2,ia,ib,ccfred,ipkbest) parameter (NSMAX=22000) !Max length of saved spectra real ss(184,NSMAX) + real ss1(184) real ccfred(NSMAX) include 'jt9sync.f90' ipk=0 ipkbest=0 - ia=max(1,nint((nfa-1000)/df3)) - ib=min(NSMAX,nint((nfb-1000)/df3)) - sbest=0. - lag1=-(2.5/tstep + 0.9999) - lag2=5.0/tstep + 0.9999 ccfred=0. do i=ia,ib !Loop over freq range + ss1=ss(1:184,i) + call pctile(ss1,nzhsym,50,xmed) + ss1=ss1/xmed - 1.0 + do j=1,nzhsym + if(ss1(j).gt.3.0) ss1(j)=5.0 + enddo + smax=0. do lag=lag1,lag2 !DT = 2.5 to 5.0 s sum=0. do j=1,16 !Sum over 16 sync symbols k=ii2(j) + lag - kaa=ka(j)+lag - kbb=kb(j)+lag - if(k.ge.1 .and. k.le.nzhsym) sum=sum + ss(k,i) - & - 0.5*(ss(kaa,i)+ss(kbb,i)) + if(k.ge.1 .and. k.le.nzhsym) sum=sum + ss1(k) enddo if(sum.gt.smax) then smax=sum - ipk=i + ipk=i endif enddo ccfred(i)=smax !Best at this freq, over all lags @@ -40,7 +40,7 @@ subroutine sync9(ss,nzhsym,tstep,df3,nfa,nfb,ccfred,ia,ib,ipkbest) call pctile(ccfred(ia),ib-ia+1,50,xmed) if(xmed.le.0.0) xmed=1.0 - ccfred=ccfred/xmed + ccfred=1.33*ccfred/xmed return end subroutine sync9 diff --git a/mainwindow.cpp b/mainwindow.cpp index 53ee4bfa7..d1475d88f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,4 +1,4 @@ -//--------------------------------------------------------------- MainWindow +//-------------------------------------------------------------- MainWindow #include "mainwindow.h" #include "ui_mainwindow.h" #include "devsetup.h" diff --git a/plotter.cpp b/plotter.cpp index fc1e3ea98..e8568c1cf 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -113,7 +113,8 @@ void CPlotter::draw(float swide[], float red[], int i0) //draw() strong=true; swide[i]=-swide[i]; } - y = 10.0*log10(swide[i]); + y=0.0; + if(swide[i]>0.0) y = 10.0*log10(swide[i]); int y1 = 5.0*gain*y + 10*m_plotZero; if (y1<0) y1=0; if (y1>254) y1=254; diff --git a/widegraph.cpp b/widegraph.cpp index dae6d209f..98a55cb34 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -105,7 +105,7 @@ void WideGraph::dataSink2(float s[], float red[], float df3, int ihsym, n=0; // int w=ui->widePlot->plotWidth(); - int i0=0; //### + int i0=-1; //### int i=i0; int jz=1000.0/df3; for (int j=0; j