diff options
| author | Iain R. Learmonth <irl@debian.org> | 2015-10-18 18:51:00 +0100 |
|---|---|---|
| committer | Iain R. Learmonth <irl@debian.org> | 2015-10-18 18:51:00 +0100 |
| commit | d63dd8d081a6fcd0715cd13f26df59fb831769d2 (patch) | |
| tree | b9c1f6245147a310aac3762630bad389bbb57335 /lib/symspec.f90 | |
| parent | c720a3d55c5ec832c29cb7ce50b6fb4b70c55b11 (diff) | |
Imported Upstream version 1.5.0upstream/1.5.0
Diffstat (limited to 'lib/symspec.f90')
| -rw-r--r-- | lib/symspec.f90 | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 2facb490..8a9c1d7a 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -1,4 +1,4 @@ -subroutine symspec(k,ntrperiod,nsps,ingain,slope,pxdb,s,df3,ihsym,npts8) +subroutine symspec(k,ntrperiod,nsps,ingain,nflatten,pxdb,s,df3,ihsym,npts8) ! Input: ! k pointer to the most recent new data @@ -20,14 +20,16 @@ subroutine symspec(k,ntrperiod,nsps,ingain,slope,pxdb,s,df3,ihsym,npts8) include 'constants.f90' real*4 w3(MAXFFT3) real*4 s(NSMAX) - real*4 scale(NSMAX) real*4 ssum(NSMAX) real*4 xc(0:MAXFFT3-1) + real*4 tmp(NSMAX) 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 - data rms/999.0/,k0/99999999/,nfft3z/0/,slope0/0.0/ + ntr,mousefqso,newdat,npts8a,nfa,nfsplit,nfb,ntol,kin,nzhsym, & + nsave,nagain,ndepth,ntxmode,nmode,junk(5) + common/jt9w/syellow(NSMAX) + data rms/999.0/,k0/99999999/,nfft3z/0/ equivalence (xc,cx) save @@ -40,18 +42,15 @@ subroutine symspec(k,ntrperiod,nsps,ingain,slope,pxdb,s,df3,ihsym,npts8) go to 900 !Wait for enough samples to start endif - if(nfft3.ne.nfft3z .or. slope.ne.slope0) then !New nfft3, compute window + if(nfft3.ne.nfft3z) then +! Compute new window pi=4.0*atan(1.0) + width=0.25*nsps do i=1,nfft3 - w3(i)=2.0*(sin(i*pi/nfft3))**2 !Window for nfft3 spectrum + z=(i-nfft3/2)/width + w3(i)=exp(-z*z) enddo nfft3z=nfft3 - nh=NSMAX/2 - do i=1,NSMAX - x=slope*float(i)/nh - 1.0 + 2.6 - scale(i)=10.0**x - enddo - slope0=slope endif if(k.lt.k0) then !Start a new data block @@ -60,19 +59,18 @@ subroutine symspec(k,ntrperiod,nsps,ingain,slope,pxdb,s,df3,ihsym,npts8) ihsym=0 if(ndiskdat.eq.0) id2(k+1:)=0 !Needed to prevent "ghosts". Not sure why. endif - gain=10.0**(0.05*ingain) + gain=10.0**(0.1*ingain) sq=0. do i=k0+1,k x1=id2(i) sq=sq + x1*x1 enddo - sq=sq * gain**2 + sq=sq * gain rms=sqrt(sq/(k-k0)) pxdb=0. if(rms.gt.0.0) pxdb=20.0*log10(rms) if(pxdb.gt.60.0) pxdb=60.0 - k0=k ja=ja+jstep !Index of first sample @@ -100,12 +98,24 @@ subroutine symspec(k,ntrperiod,nsps,ingain,slope,pxdb,s,df3,ihsym,npts8) sx=fac*(real(cx(j))**2 + aimag(cx(j))**2) ss(n,i)=sx ssum(i)=ssum(i) + sx - s(i)=gain*sx + s(i)=1000.0*gain*sx enddo -! s=0.05*s/ref - s=scale*s - savg=scale*ssum/ihsym + savg=ssum/ihsym + + if(mod(n,10).eq.0) then + mode4=36 + nsmo=min(10*mode4,150) + nsmo=4*nsmo + call flat1(savg,iz,nsmo,syellow) + if(mode4.ge.9) call smo(syellow,iz,tmp,mode4) + ia=500./df3 + ib=2700.0/df3 + smin=minval(syellow(ia:ib)) + smax=maxval(syellow(1:iz)) + syellow=(50.0/(smax-smin))*(syellow-smin) + where(syellow<0) syellow=0. + endif 900 npts8=k/8 |
