Cleaned up a number of details related to the new 5 kHz spectral range.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@299 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2006-09-19 18:55:21 +00:00
parent 532a93e7e3
commit c9500abcf8
8 changed files with 61 additions and 47 deletions

View File

@ -2,7 +2,7 @@
real psavg(nh)
real s2(nhmax,nsmax)
real x(4096),tmp(33)
real x(8192),tmp(33)
nsmo=33
ia=nsmo/2 + 1

3
lpf1.f
View File

@ -45,6 +45,9 @@ C Shift frequency up or down by ndf Hz:
do i=nh,-i0,-1
c(i)=c(i+i0)
enddo
do i=0,-i0-1
c(i)=0.
enddo
else
do i=0,nh-i0
c(i)=c(i+i0)

View File

@ -1,6 +1,6 @@
subroutine short65(data,jz,NFreeze,MouseDF,DFTolerance,
+ mode65,nspecialbest,nstest,dfsh,iderrbest,idriftbest,
+ snrdb,ss1a,ss2a,nwsh)
+ snrdb,ss1a,ss2a,nwsh,idfsh)
C Checks to see if this might be a shorthand message.
C This is done before zapping, downsampling, or normal decoding.
@ -8,19 +8,18 @@ C This is done before zapping, downsampling, or normal decoding.
parameter (NP2=60*11025) !Size of data array
parameter (NFFT=16384) !FFT length
parameter (NH=NFFT/2) !Step size
parameter (NQ=NFFT/4) !Saved spectral points
parameter (MAXSTEPS=60*11025/NH) !Max # of steps
real data(jz)
integer DFTolerance
real s2(NH,MAXSTEPS) !2d spectrum
real ss(NQ,4) !Save spectra in four phase bins
real psavg(NQ)
real ss(NH,4) !Save spectra in four phase bins
real psavg(NH)
real sigmax(4) !Peak of spectrum at each phase
real ss1a(-224:224) !Lower magenta curve
real ss2a(-224:224) !Upper magenta curve
real ss1(-473:1227) !Lower magenta curve (temp)
real ss2(-473:1227) !Upper magenta curve (temp)
real ss1(-473:1784) !Lower magenta curve (temp)
real ss2(-473:1784) !Upper magenta curve (temp)
real ssavg(-10:10)
integer ipk(4) !Peak bin at each phase
save
@ -30,38 +29,37 @@ C This is done before zapping, downsampling, or normal decoding.
df=11025.0/NFFT
C Do 16 k FFTs, stepped by 8k. (*** Maybe should step by 4k? ***)
call zero(psavg,NQ)
call zero(psavg,NH)
nsteps=(jz-NH)/(4*NH)
nsteps=4*nsteps !Number of steps
do j=1,nsteps
k=(j-1)*NH + 1
call ps(data(k),NFFT,s2(1,j)) !Get power spectra
if(mode65.eq.4) then
call smooth(s2(1,j),NQ)
call smooth(s2(1,j),NQ)
call smooth(s2(1,j),NH)
call smooth(s2(1,j),NH)
endif
call add(psavg,s2(1,j),psavg,NQ)
call add(psavg,s2(1,j),psavg,NH)
enddo
call flat1(psavg,s2,NQ,nsteps,NH,MAXSTEPS)
call flat1(psavg,s2,NH,nsteps,NH,MAXSTEPS)
nfac=40*mode65
dtstep=0.5/df
fac=dtstep/(60.0*df)
C Define range of frequencies to be searched
fa= 670.46
fb=1870.46
fa=max(200.0,1270.46+MouseDF-600.0)
fb=min(4800.0,1270.46+MouseDF+600.0)
ia=fa/df
ib=fb/df + 4.1*nfac !Upper tone is above sync tone by 4*nfac*df Hz
if(ib.gt.NQ) ib=NQ
if(NFreeze.eq.1) then
fa=max( 670.46,1270.46+MouseDF-DFTolerance)
fb=min(1870.46,1270.46+MouseDF+DFTolerance)
fa=max(200.0,1270.46+MouseDF-DFTolerance)
fb=min(4800.0,1270.46+MouseDF+DFTolerance)
endif
ia2=fa/df
ib2=fb/df + 4.1*nfac !Upper tone is above sync tone by 4*nfac*df Hz
if(ib2.gt.NQ) ib2=NQ
if(ib2.gt.NH) ib2=NH
C Find strongest line in each of the 4 phases, repeating for each drift rate.
sbest=0.
@ -69,7 +67,7 @@ C Find strongest line in each of the 4 phases, repeating for each drift rate.
idz=6.0/df !Is this the right drift range?
do idrift=-idz,idz
drift=idrift*df*60.0/49.04
call zero(ss,4*NQ) !Clear the accumulating array
call zero(ss,4*NH) !Clear the accumulating array
do j=1,nsteps
n=mod(j-1,4)+1
k=nint((j-nsteps/2)*drift*fac) + ia
@ -139,8 +137,8 @@ C Find strongest line in each of the 4 phases, repeating for each drift rate.
ipk2=ntmp
endif
call zero(ss1,1701)
call zero(ss2,1701)
call zero(ss1,2258)
call zero(ss2,2258)
do i=ia2,ib2,4
f=df*i
k=nint((f-1270.46)/df4)
@ -175,9 +173,17 @@ C Find strongest line in each of the 4 phases, repeating for each drift rate.
nwsh=nint(x*df4)
endif
C See if orange/magenta curves need to be shifted:
idfsh=0
if(mousedf.lt.-600) idfsh=-670
if(mousedf.gt.600) idfsh=1000
if(mousedf.gt.1600) idfsh=2000
if(mousedf.gt.2600) idfsh=3000
i0=nint(idfsh/df4)
do i=-224,224
ss1a(i)=ss1(i)
ss2a(i)=ss2(i)
ss1a(i)=ss1(i+i0)
ss2a(i)=ss2(i+i0)
enddo
return

View File

@ -367,7 +367,8 @@ def update():
if(fmid<>fmid0 or frange<>frange0):
if fmid<1000*nfr.get(): fmid=1000*nfr.get()
if fmid>5000-1000*nfr.get(): fmid=5000-1000*nfr.get()
draw_axis()
# draw_axis()
df_mark()
fmid0=fmid
frange0=frange
Audio.gcom2.nfmid=int(fmid)
@ -454,9 +455,9 @@ setupmenu.add_separator()
setupmenu.add('command', label = 'Rx volume control', command = rx_volume)
setupmenu.add('command', label = 'Tx volume control', command = tx_volume)
setupmenu.add_separator()
setupmenu.add_radiobutton(label='Frequency axis',command=draw_axis,
setupmenu.add_radiobutton(label='Frequency axis',command=df_mark,
value=0,variable=naxis)
setupmenu.add_radiobutton(label='JT65 DF axis',command=draw_axis,
setupmenu.add_radiobutton(label='JT65 DF axis',command=df_mark,
value=1,variable=naxis)
setupmenu.add_separator()
setupmenu.palettes=Menu(setupmenu,tearoff=0)

View File

@ -40,13 +40,14 @@ C Compute power spectrum for each step and get average
C Find the best frequency channel for CCF
famin= 670.46
fbmax=1870.46
! famin=200
! fbmax=3800
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

28
wsjt.py
View File

@ -1,4 +1,4 @@
#------------------------------------------------------------------ WSJT
#------------------------------------------------------------------- WSJT
# $Date$ $Revision$
#
from Tkinter import *
@ -48,8 +48,8 @@ isync6m=-10
isync65=1
isync_save=0
iclip=0
itol=5
ntol=(10,25,50,100,200,400) #List of available tolerances
itol=5 #Default tol=400 Hz
ntol=(10,25,50,100,200,400,600) #List of available tolerances
idsec=0
#irdsec=0
lauto=0
@ -523,7 +523,7 @@ def ModeFSK441(event=NONE):
report.configure(state=NORMAL)
shmsg.configure(state=NORMAL)
graph2.configure(bg='black')
itol=5
itol=4
inctol()
ntx.set(1)
GenStdMsgs()
@ -552,7 +552,7 @@ def ModeJT65():
report.configure(state=DISABLED)
shmsg.configure(state=DISABLED)
graph2.configure(bg='#66FFFF')
itol=5
itol=4
inctol()
nfreeze.set(0)
ntx.set(1)
@ -857,7 +857,7 @@ def decclip(event):
#------------------------------------------------------ inctol
def inctol(event=NONE):
global itol
if itol<5: itol=itol+1
if itol<6: itol=itol+1
ltol.configure(text='Tol '+str(ntol[itol]))
#------------------------------------------------------ dectol
@ -1011,7 +1011,7 @@ def mouse_click_g1(event):
global nopen
if not nopen:
if mode.get()[:4]=="JT65":
Audio.gcom2.mousedf=int((event.x-250)*2.4)
Audio.gcom2.mousedf=int(Audio.gcom2.idf+(event.x-250)*2.4)
else:
if Audio.gcom2.ndecoding==0: #If decoder is busy, ignore
Audio.gcom2.nagain=1
@ -1168,7 +1168,7 @@ def plot_large():
else:
y1=[]
y2=[]
for i in range(446): #Find ymax for red curve
for i in range(446): #Find ymax for magenta/orange curves
ss1=Audio.gcom2.ss1[i+1]
y1.append(ss1)
ss2=Audio.gcom2.ss2[i+1]
@ -1179,7 +1179,7 @@ def plot_large():
xy1=[]
xy2=[]
fac=500.0/446.0
for i in range(446): #Make xy list for red curve
for i in range(446): #Make xy list for magenta/orange curves
x=i*fac
ss1=Audio.gcom2.ss1[i+1]
n=int(90.0-yfac*ss1)
@ -1386,14 +1386,14 @@ def update():
msg1.configure(text="%6.4f %6.4f" % (samfac_in,samfac_out))
msg2.configure(text=mode.get())
t="FreezeDF:%4d" % (int(Audio.gcom2.mousedf),)
t="Freeze DF:%4d" % (int(Audio.gcom2.mousedf),)
if abs(int(Audio.gcom2.mousedf))>600:
msg3.configure(text=t,fg='black',bg='red')
else:
msg3.configure(text=t,fg='black',bg='gray85')
bdecode.configure(bg='gray85')
if Audio.gcom2.ndecoding: #Set button bg=light_blue
bdecode.configure(bg='#66FFFF') #while decoding
bdecode.configure(bg='gray85',highlightbackground='red')
if Audio.gcom2.ndecoding: #Set button bg=light_blue while decoding
bdecode.configure(bg='#66FFFF',highlightbackground='red')
if mode.get()[:2]=="CW":
msg5.configure(text="TR Period: %d s" % (Audio.gcom1.trperiod,), \
bg='white')
@ -2018,7 +2018,6 @@ lauto=0
isync=1
ntx.set(1)
ndepth.set(1)
import options
options.defaults()
ModeFSK441()
@ -2167,6 +2166,7 @@ Audio.gcom2.appdir=(appdir+'
Audio.gcom2.ndepth=ndepth.get()
Audio.ftn_init()
GenStdMsgs()
print 'D ',itol,ntol[itol]
Audio.gcom4.addpfx=(options.addpfx.get().lstrip()+' ')[:8]
stopmon()
first=1

View File

@ -169,7 +169,7 @@ C Intentionally degrade SNR by -nclip dB.
nstest=0
if(ntx2.ne.1) call short65(dat,jz,NFreeze,MouseDF,
+ DFTolerance,mode65,nspecial,nstest,dfsh,iderrsh,
+ idriftsh,snrsh,ss1,ss2,nwsh)
+ idriftsh,snrsh,ss1,ss2,nwsh,idfsh)
! Lowpass filter and decimate by 2
call lpf1(dat,jz,jz2,MouseDF,MouseDF2)
idf=mousedf-mousedf2
@ -190,7 +190,7 @@ C Intentionally degrade SNR by -nclip dB.
! Offset data by about 1 s.
if(jz.ge.126*2048) call wsjt65(dat(4097),jz-4096,cfile6,
+ NClearAve,MinSigdB,DFTolerance,NFreeze,NAFC,mode65,Nseg,
+ MouseDF2,NAgain,ndepth,neme,nsked,idf,
+ MouseDF2,NAgain,ndepth,neme,nsked,idf,idfsh,
+ mycall,hiscall,hisgrid,lumsg,lcum,nspecial,ndf,
+ nstest,dfsh,snrsh,
+ NSyncOK,ccf,psavg,ndiag,nwsh)

View File

@ -1,6 +1,6 @@
subroutine wsjt65(dat,npts,cfile6,NClearAve,MinSigdB,
+ DFTolerance,NFreeze,NAFC,mode65,Nseg,MouseDF,NAgain,
+ ndepth,neme,nsked,idf,mycall,hiscall,hisgrid,
+ ndepth,neme,nsked,idf,idfsh,mycall,hiscall,hisgrid,
+ lumsg,lcum,nspecial,ndf,nstest,dfsh,
+ snrsh,NSyncOK,ccfblue,ccfred,ndiag,nwsh)
@ -80,7 +80,7 @@ C Attempt to synchronize: look for sync tone, get DF and DT.
C Good Sync takes precedence over a shorthand message:
if(nsync.ge.MinSigdB .and. nsnr.ge.nsnrlim .and.
+ nsync.gt.nstest) nstest=0
+ nsync.ge.nstest) nstest=0
if(nstest.gt.0) then
dfx=dfsh
@ -95,6 +95,7 @@ C Good Sync takes precedence over a shorthand message:
NSyncOK=1 !Mark this RX file as good (for "Save Decoded")
if(NFreeze.eq.0 .or. DFTolerance.ge.200) special(5:5)='?'
width=nwsh
idf=idfsh
go to 200
endif
@ -127,7 +128,9 @@ C If we get here, we have achieved sync!
c1=decoded(i:i)
if(c1.ge.'a' .and. c1.le.'z') decoded(i:i)=char(ichar(c1)-32)
enddo
write(line,1010) cfile6,nsync,nsnr,dtx-1.0,ndf+idf,
jdf=ndf+idf
if(nstest.gt.0) jdf=ndf
write(line,1010) cfile6,nsync,nsnr,dtx-1.0,jdf,
+ nint(width),csync,special,decoded(1:19),cooo,kvqual,nqual
1010 format(a6,i3,i5,f5.1,i5,i3,1x,a1,1x,a5,a19,1x,a3,i4,i4)