Removed three disused routines.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@579 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2007-11-14 16:46:37 +00:00
parent d51ab0c22a
commit 1536952e2b
4 changed files with 1 additions and 295 deletions

View File

@ -1,52 +0,0 @@
subroutine avesp2(dat,jza,nadd,mode,NFreeze,MouseDF,
+ DFTolerance,fzap)
real dat(jza)
integer DFTolerance
real psa(1024) !Ave ps, flattened and rolled off
real ref(557) !Ref spectrum, lines excised
real birdie(557) !Birdie spectrum (ave-ref)
real variance(557)
real s2(557,323)
real fzap(200)
iz=557 !Compute the 2d spectrum
df=11025.0/2048.0
nfft=nadd*1024
jz=jza/nfft
do j=1,jz
k=(j-1)*nfft + 1
call ps(dat(k),nfft,psa)
call move(psa,s2(1,j),iz)
enddo
C Flatten s2 and get psa, ref, and birdie
call flatten(s2,557,jz,psa,ref,birdie,variance)
call zero(fzap,200)
ia=300/df
ib=2700/df
n=0
fmouse=0.
if(mode.eq.2) fmouse=1270.46+MouseDF
if(mode.eq.4) fmouse=1076.66+MouseDF
do i=ia,ib
if(birdie(i)-ref(i).gt.3.0) then
f=i*df
C Don't zap unless Freeze is OFF or birdie is outside the "Tol" range.
if(NFreeze.eq.0 .or.
+ abs(f-fmouse).gt.float(DFTolerance)) then
if(n.lt.200 .and. variance(i-1).lt.2.5 .and.
+ variance(i).lt.2.5.and.variance(i+1).lt.2.5) then
n=n+1
fzap(n)=f
endif
endif
endif
enddo
return
end

67
bzap.f
View File

@ -1,67 +0,0 @@
subroutine bzap(dat,jz,nadd,mode,fzap)
parameter (NMAX=1024*1024)
parameter (NMAXH=NMAX)
real dat(jz),x(NMAX)
real fzap(200)
complex c(NMAX)
equivalence (x,c)
xn=log(float(jz))/log(2.0)
n=xn
if((xn-n).gt.0.) n=n+1
nfft=2**n
nh=nfft/nadd
nq=nh/2
do i=1,jz
x(i)=dat(i)
enddo
if(nfft.gt.jz) call zero(x(jz+1),nfft-jz)
call xfft(x,nfft)
C This is a kludge:
df=11025.0/(nadd*nfft)
if(mode.eq.2) df=11025.0/(2*nadd*nfft)
tol=10.
itol=nint(2.0/df)
do izap=1,200
if(fzap(izap).eq.0.0) goto 10
ia=(fzap(izap)-tol)/df
ib=(fzap(izap)+tol)/df
smax=0.
do i=ia+1,ib+1
s=real(c(i))**2 + aimag(c(i))**2
if(s.gt.smax) then
smax=s
ipk=i
endif
enddo
fzap(izap)=df*(ipk-1)
do i=ipk-itol,ipk+itol
c(i)=0.
enddo
enddo
10 ia=70/df
do i=1,ia
c(i)=0.
enddo
ia=2700.0/df
do i=ia,nq+1
c(i)=0.
enddo
do i=2,nq
c(nh+2-i)=conjg(c(i))
enddo
call four2a(c,nh,1,1,-1)
fac=1.0/nfft
do i=1,jz/nadd
dat(i)=fac*x(i)
enddo
return
end

View File

@ -1,4 +1,4 @@
#--------------------------------------------------------------------- MAP65
#---------------------------------------------------------------------- MAP65
# $Date$ $Revision$
#
from Tkinter import *

175
sync65.f
View File

@ -1,175 +0,0 @@
subroutine sync65(dat,jz,DFTolerance,NFreeze,MouseDF,
+ mode65,dtx,dfx,snrx,snrsync,ccfblue,ccfred1,flip,width)
C Synchronizes JT65 data, finding the best-fit DT and DF.
C NB: at this stage, submodes ABC are processed in the same way.
parameter (NP2=60*11025) !Size of data array
parameter (NFFTMAX=2048) !Max length of FFTs
parameter (NHMAX=NFFTMAX/2) !Max length of power spectra
parameter (NSMAX=320) !Max number of half-symbol steps
integer DFTolerance !Range of DF search
real dat(jz)
real psavg(NHMAX) !Average spectrum of whole record
real s2(NHMAX,NSMAX) !2d spectrum, stepped by half-symbols
real ccfblue(-5:540) !CCF with pseudorandom sequence
C The value 450 is empirical:
real ccfred(-450:450) !Peak of ccfblue, as function of freq
real ccfred1(-224:224) !Peak of ccfblue, as function of freq
real tmp(450)
save
C Do FFTs of symbol length, stepped by half symbols. Note that we have
C already downsampled the data by factor of 2.
nsym=126
nfft=2048
nsteps=2*jz/nfft - 1
nh=nfft/2
df=0.5*11025.0/nfft
C Compute power spectrum for each step and get average
call zero(psavg,nh)
do j=1,nsteps
k=(j-1)*nh + 1
call limit(dat(k),nfft)
call ps(dat(k),nfft,s2(1,j))
if(mode65.eq.4) call smooth(s2(1,j),nh)
call add(psavg,s2(1,j),psavg,nh)
enddo
call flat1(psavg,s2,nh,nsteps,NHMAX,NSMAX) !Flatten the spectra
C Find the best frequency channel for CCF
! famin= 670.46
! fbmax=1870.46
famin=3.
fbmax=2700.
fa=famin
fb=fbmax
if(NFreeze.eq.1) then
fa=max(famin,1270.46+MouseDF-DFTolerance)
fb=min(fbmax,1270.46+MouseDF+DFTolerance)
else
fa=max(famin,1270.46+MouseDF-600)
fb=min(fbmax,1270.46+MouseDF+600)
endif
ia=fa/df
ib=fb/df
i0=nint(1270.46/df)
lag1=-5
lag2=59
syncbest=-1.e30
syncbest2=-1.e30
call zero(ccfred,745)
do i=ia,ib
call xcor(s2,i,nsteps,nsym,lag1,lag2,
+ ccfblue,ccf0,lagpk0,flip,0.0)
j=i-i0
if(j.ge.-372 .and. j.le.372) ccfred(j)=ccf0
C Find rms of the CCF, without the main peak
call slope(ccfblue(lag1),lag2-lag1+1,lagpk0-lag1+1.0)
sync=abs(ccfblue(lagpk0))
ppmax=psavg(i)-1.0
C Find the best sync value
if(sync.gt.syncbest2) then
ipk2=i
lagpk2=lagpk0
syncbest2=sync
endif
C We are most interested if snrx will be more than -30 dB.
if(ppmax.gt.0.2938) then !Corresponds to snrx.gt.-30.0
if(sync.gt.syncbest) then
ipk=i
lagpk=lagpk0
syncbest=sync
endif
endif
enddo
C If we found nothing with snrx > -30 dB, take the best sync that *was* found.
if(syncbest.lt.-10.) then
ipk=ipk2
lagpk=lagpk2
syncbest=syncbest2
endif
C Peak up in frequency to fraction of channel
base=0.25*(psavg(ipk-3)+psavg(ipk-2)+psavg(ipk+2)+psavg(ipk+3))
! call peakup(psavg(ipk-1),psavg(ipk),psavg(ipk+1),dx)
! if(dx.lt.-1.0) dx=-1.0
! if(dx.gt.1.0) dx=1.0
dx=0.
dfx=(ipk+dx-i0)*df
C Peak up in time, at best whole-channel frequency
call xcor(s2,ipk,nsteps,nsym,lag1,lag2,
+ ccfblue,ccfmax,lagpk,flip,0.0)
xlag=lagpk
if(lagpk.gt.lag1 .and. lagpk.lt.lag2) then
call peakup(ccfblue(lagpk-1),ccfmax,ccfblue(lagpk+1),dx2)
xlag=lagpk+dx2
endif
C Find rms of the CCF, without the main peak
call slope(ccfblue(lag1),lag2-lag1+1,xlag-lag1+1.0)
sq=0.
nsq=0
do lag=lag1,lag2
if(abs(lag-xlag).gt.2.0) then
sq=sq+ccfblue(lag)**2
nsq=nsq+1
endif
enddo
rms=sqrt(sq/nsq)
snrsync=abs(ccfblue(lagpk))/rms - 1.1 !Empirical
dt=2.0/11025.0
istart=xlag*nh
dtx=istart*dt
snrx=-99.0
! ppmax=psavg(ipk)/base-1.0
ppmax=psavg(ipk)-1.0
C Plus 3 dB because sync tone is on half the time. (Don't understand
C why an additional +2 dB is needed ...)
if(ppmax.gt.0.0001) snrx=db(ppmax*df/2500.0) + 5.0 !###
if(mode65.eq.4) snrx=snrx + 2.0
if(snrx.lt.-33.0) snrx=-33.0
C Compute width of sync tone to outermost -3 dB points
call pctile(ccfred(ia-i0),tmp,ib-ia+1,45,base)
jpk=ipk-i0
stest=base + 0.5*(ccfred(jpk)-base) ! -3 dB
do i=-10,0
if(jpk+i.ge.-371) then
if(ccfred(jpk+i).gt.stest) go to 30
endif
enddo
i=0
30 x1=i-1+(stest-ccfred(jpk+i-1))/(ccfred(jpk+i)-ccfred(jpk+i-1))
do i=10,0,-1
if(jpk+i.le.371) then
if(ccfred(jpk+i).gt.stest) go to 32
endif
enddo
i=0
32 x2=i+1-(stest-ccfred(jpk+i+1))/(ccfred(jpk+i)-ccfred(jpk+i+1))
width=x2-x1
if(width.gt.1.2) width=sqrt(width**2 - 1.44)
width=df*width
width=max(0.0,min(99.0,width))
do i=-224,224
ccfred1(i)=ccfred(i)
enddo
return
end