From 35f7f73a7a24c07696e696d01e41baddb26ef072 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sat, 9 Apr 2016 14:51:20 +0000 Subject: [PATCH] Starting to implement display of reference spectrum in plotter.cpp. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6604 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- commons.h | 3 ++- lib/refspectrum.f90 | 17 ++++++++++------- lib/symspec.f90 | 2 +- plotter.cpp | 8 +++++++- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/commons.h b/commons.h index 4ad3ac5ee..03af550a8 100644 --- a/commons.h +++ b/commons.h @@ -61,7 +61,8 @@ extern struct dec_data { extern struct { float syellow[NSMAX]; -} jt9w_; + float ref[3457]; +} spectra_; extern struct { int nclearave; diff --git a/lib/refspectrum.f90 b/lib/refspectrum.f90 index 4fab0bc8d..73f13acc3 100644 --- a/lib/refspectrum.f90 +++ b/lib/refspectrum.f90 @@ -10,15 +10,16 @@ subroutine refspectrum(id2,brefspec) real x(NFFT) real s(0:NH) complex cx(0:NH) + common/spectra/syellow(6827),ref(0:NH) equivalence(x,cx) data nsave/0/,brefspec0/.false./ - save brefspec0,nsave,s +! save brefspec0,nsave,ref + save if(brefspec) then if(.not.brefspec0) then nsave=0 s=0. - brefspec0=.true. endif x(1:NH)=0.001*id2 @@ -32,10 +33,10 @@ subroutine refspectrum(id2,brefspec) if(mod(nsave,34).eq.0) then !About 9.8 sec df=12000.0/NFFT -! ia=nint(500.0/df) -! ib=nint(2500.0/df) -! call pctile(s(ia),ib-ia+1,50,xmed) -! db0=db(xmed) + ia=nint(500.0/df) + ib=nint(2500.0/df) + call pctile(s(ia),ib-ia+1,50,xmed) + db0=db(xmed) ! nhadd=10 open(16,file='refspec.dat',status='unknown') do i=1,NH @@ -43,12 +44,14 @@ subroutine refspectrum(id2,brefspec) ! ia=max(1,i-nhadd) ! ib=min(NH,i+nhadd) ! smo=sum(s(ia:ib))/(ib-ia+1) - write(16,1000) freq,s(i),db(s(i)) + ref(i)=db(s(i)) - db0 + write(16,1000) freq,s(i),ref(i) 1000 format(f10.3,e12.3,f12.6) enddo close(16) endif endif + brefspec0=brefspec return end subroutine refspectrum diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 8e3f143a1..d7f015953 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -30,7 +30,7 @@ subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,nminw,pxdb,s, & complex cx(0:MAXFFT3/2) integer nch(7) - common/jt9w/syellow(NSMAX) + common/spectra/syellow(NSMAX),ref(0:3456) data rms/999.0/,k0/99999999/,nfft3z/0/ data nch/1,2,4,9,18,36,72/ equivalence (xc,cx) diff --git a/plotter.cpp b/plotter.cpp index 6fdd4abdf..7518aee00 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -168,11 +168,17 @@ void CPlotter::draw(float swide[], bool bScroll) //dr float sum=0.0; int j=j0+m_binsPerPixel*i; for(int k=0; k