From a6406ea58f5248a8df27173907c5cf4dcc83aa01 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 8 Jan 2014 20:55:11 +0000 Subject: [PATCH] Some adjustments to usage of flat3. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3625 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/flat3.f90 | 26 +++++++++++++------------- lib/symspec.f90 | 5 +++-- mainwindow.cpp | 5 ++--- soundout.h | 2 -- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/lib/flat3.f90 b/lib/flat3.f90 index 8255fca5c..75562268d 100644 --- a/lib/flat3.f90 +++ b/lib/flat3.f90 @@ -1,9 +1,9 @@ -subroutine flat3(savg0,iz,nterms,ynoise,savg) +subroutine flat3(s0,iz,nfa,nfb,nterms,ynoise,s) implicit real*8 (a-h,o-z) parameter (NSMAX=6827) - real*4 savg0(iz) - real*4 savg(iz) + real*4 s0(iz) + real*4 s(iz) real*4 ynoise,y4 real*8 x(NSMAX) @@ -17,10 +17,11 @@ subroutine flat3(savg0,iz,nterms,ynoise,savg) df=12000.0/16384.0 do i=1,iz - y0(i)=db(savg0(i)) + y0(i)=db(s0(i)) enddo - ia=200.0/df - ib=4500.0/df + ia=(nfa+200.0)/df + ib=5000.0/df + if(nfb.gt.0) ib=nfb/df j=0 do i=ia,ib j=j+1 @@ -35,14 +36,12 @@ subroutine flat3(savg0,iz,nterms,ynoise,savg) do iter=1,99 call polfit(x,y,y,npts,nterms,mode,a,chisqr) -! print*,iter,npts,a(1:nterms) - rewind 21 do i=1,ib f=i*df - yfit(i)=0.0 - do n=1,nterms - yfit(i)=yfit(i) + a(n) * f**(n-1) + yfit(i)=a(nterms) + do n=nterms-1,1,-1 + yfit(i)=f*yfit(i) + a(n) enddo ! write(21,1010) f,y0(i),yfit(i),y0(i)-yfit(i) !1010 format(4f12.3) @@ -51,6 +50,7 @@ subroutine flat3(savg0,iz,nterms,ynoise,savg) do j=1,npts y1=y(j)-yfit(ii(j)) if(y1.lt.ynoise) then +! if(y1.lt.ynoise .and. y1.gt.-ynoise) then k=k+1 x(k)=x(j) y(k)=y(j) @@ -67,8 +67,8 @@ subroutine flat3(savg0,iz,nterms,ynoise,savg) ! enddo do i=1,ib - y4=y0(i)-yfit(i) - savg(i)=10.0**(0.1*y4) + y4=y0(i)-yfit(i) - 20.0 + s(i)=10.0**(0.1*y4) enddo end subroutine flat3 diff --git a/lib/symspec.f90 b/lib/symspec.f90 index ce1dc9504..bcd240aba 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -26,7 +26,8 @@ subroutine symspec(k,ntrperiod,nsps,ingain,slope,pxdb,s,df3,ihsym,npts8) complex cx(0:MAXFFT3/2) integer*2 id2 common/jt9com/ss(184,NSMAX),savg(NSMAX),id2(NMAX),nutc,ndiskdat, & - ntr,mousefqso,newdat,nfa,nfb,ntol,kin,nzhsym,nsynced,ndecoded + ntr,mousefqso,newdat,npts8a,nfa,nfsplit,nfb,ntol,kin,nzhsym, & + nsave,nagain,ndepth,ntxmode,nmode,junk(5) data rms/999.0/,k0/99999999/,nfft3z/0/,slope0/0.0/ equivalence (xc,cx) save @@ -108,7 +109,7 @@ subroutine symspec(k,ntrperiod,nsps,ingain,slope,pxdb,s,df3,ihsym,npts8) savg=scale*ssum/ihsym if(abs(slope+0.1).lt.0.01) then - call flat3(s,iz,3,1.0,s) + call flat3(s,iz,nfa,nfb,3,1.0,s) ! call flat3(savg,iz,3,1.0,savg) endif diff --git a/mainwindow.cpp b/mainwindow.cpp index 9111b89dc..707aed805 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -14,8 +14,6 @@ #include "getfile.h" #include "logqso.h" - - #ifdef QT5 #include #endif @@ -711,12 +709,13 @@ void MainWindow::dataSink(qint64 frames) jt9com_.ndiskdat=0; } - // Get power, spectrum, and ihsym trmin=m_TRperiod/60; slope=0.0; slope=(float)m_wideGraph->getSlope(); int k (frames - 1); + jt9com_.nfa=m_wideGraph->nStartFreq(); + jt9com_.nfb=m_wideGraph->getFmax(); symspec_(&k,&trmin,&m_nsps,&m_inGain,&slope,&px,s,&df3,&ihsym,&npts8); if(ihsym <=0) return; QString t; diff --git a/soundout.h b/soundout.h index b2d71bbc2..2ce735444 100644 --- a/soundout.h +++ b/soundout.h @@ -8,8 +8,6 @@ class QAudioDeviceInfo; -class QAudioDeviceInfo; - // An instance of this sends audio data to a specified soundcard. class SoundOutput : public QObject