Many changes. GUI version of MAP65 is beginning to tske shape.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@349 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2007-01-13 20:21:32 +00:00
parent 31a9615af5
commit 162d6499b6
9 changed files with 160 additions and 108 deletions

View File

@ -22,6 +22,7 @@ C f_stop = 750 Hz.
+ 5.89886379,1.59355187,-2.49138308,0.60910773,-0.04248129/
save
if(nmax.lt.0) go to 900
if(first) then
npatience=FFTW_ESTIMATE
! npatience=FFTW_MEASURE
@ -99,6 +100,13 @@ C Do the short reverse transform, to go back to time domain.
call sfftw_execute_(plan3)
call sfftw_execute_(plan4)
n4=min(nmax/64,NFFT2)
go to 999
return
900 call sfftw_destroy_plan_(plan1)
call sfftw_destroy_plan_(plan2)
call sfftw_destroy_plan_(plan3)
call sfftw_destroy_plan_(plan4)
call sfftw_destroy_plan_(plan5)
999 return
end

View File

@ -97,8 +97,8 @@ subroutine ftn_init
status='unknown')
#endif
! open(24,file=appdir(:iz)//'/tmp24.txt',status='unknown', &
! share='denynone')
open(24,file=appdir(:iz)//'/tmp24.txt',status='unknown', &
share='denynone')
open(26,file=appdir(:iz)//'/tmp26.txt',status='unknown', &
share='denynone')

View File

@ -2,7 +2,8 @@
subroutine ftn_quit
include 'gcom1.f90'
ngo=0
! Destroy the FFTW plans
call four2a(a,-1,1,1,1)
! @@@ Should also terminate the plans created in filbig!
call filbig(id,-1,f0,newdat,c4a,c4b,n4)
return
end subroutine ftn_quit

View File

@ -5,6 +5,7 @@ real psavg !Average spectrum Decoder
real s2 !2d spectrum for horizontal waterfall GUI
real ccf !CCF in time (blue curve) Decoder
real green !Data for green line GUI
real fselect !Specified QSO frequency GUI
integer ngreen !Length of green GUI
real dgain !Digital audio gain setting GUI
integer iter !(why is this here??)
@ -87,7 +88,7 @@ character*80 filetokillb
character*12 pttport
common/gcom2/ps0(431),psavg(450),s2(64,3100),ccf(-5:540), &
green(500),ngreen,dgain,iter,ndecoding,ndecoding0,mousebutton, &
green(500),fselect,ngreen,dgain,iter,ndecoding,ndecoding0,mousebutton, &
ndecdone,npingtime,ierr,lauto,mantx,nrestart,ntr,nmsg,nsave,nadd5, &
dftolerance,LDecoded,rxdone,monitoring,nzap,nsavecum,minsigdb, &
nclearave,nfreeze,nafc,newspec,nmode,mode65,nclip,ndebug,nblank,nport, &

View File

@ -41,6 +41,7 @@ root_geom=""
#------------------------------------------------------ Global variables
nfile=0
appdir=os.getcwd()
isync=1
isync_save=0
@ -171,8 +172,8 @@ def bandmap(event=NONE):
bm.geometry(bm_geom)
if g.Win32: bm.iconbitmap("wsjt.ico")
iframe_bm1 = Frame(bm, bd=1, relief=SUNKEN)
bmtext=Text(iframe_bm1, height=35, width=45, bg="Navy", fg="yellow")
bmtext.pack(side=LEFT, fill=X, padx=1)
bmtext=Text(iframe_bm1, height=35, width=41, bg="Navy", fg="yellow")
bmtext.pack(side=LEFT, fill=X, padx=1, pady=3)
bmsb = Scrollbar(iframe_bm1, orient=VERTICAL, command=bmtext.yview)
bmsb.pack(side=RIGHT, fill=Y)
bmtext.configure(yscrollcommand=bmsb.set)
@ -347,10 +348,6 @@ def txmute(event=NONE):
else:
lab7.configure(bg='gray85',fg='gray85')
#------------------------------------------------------ savelast
def savelast(event=NONE):
Audio.gcom2.nsavelast=1
#------------------------------------------------------ MsgBox
def MsgBox(t):
msg=Pmw.MessageDialog(root,buttons=('OK',),message_text=t)
@ -602,7 +599,6 @@ Alt+M Monitor
Alt+O Tx Stop
Alt+Q Log QSO
Alt+S Stop Monitoring or Decoding
Alt+V Save Last
Alt+X Exclude
Alt+Z Toggle Zap
Right/Left Arrow Increase/decrease Freeze DF
@ -1091,7 +1087,7 @@ def plot_yellow():
def update():
global root_geom,isec0,naz,nel,ndmiles,ndkm,nopen, \
im,pim,cmap0,isync,isync_save,idsec,first,itol,txsnrdb,tx6alt,\
bm_geom
bm_geom,nfile
utc=time.gmtime(time.time()+0.1*idsec)
isec=utc[5]
@ -1265,13 +1261,15 @@ def update():
lines=""
bmtext.configure(state=NORMAL)
bmtext.delete('1.0',END)
bmtext.insert(END,' Freq DF Pol UTC\n')
bmtext.insert(END,'--------------------------------------------\n')
bmtext.insert(END,'Freq DF Pol UTC\n')
bmtext.insert(END,'----------------------------------------\n')
for i in range(len(lines)):
bmtext.insert(END,lines[i])
bmtext.see(END)
Audio.gcom2.ndecdone=3
Audio.gcom2.ndecdone=0
nfile=nfile+1
if(nfile<11):
decode()
if g.cmap != cmap0:
im.putpalette(g.palette)
@ -1562,8 +1560,6 @@ root.bind_all('<Alt-q>',logqso)
root.bind_all('<Alt-Q>',logqso)
root.bind_all('<Alt-s>',stopmon)
root.bind_all('<Alt-S>',stopmon)
root.bind_all('<Alt-v>',savelast)
root.bind_all('<Alt-V>',savelast)
root.bind_all('<Alt-x>',decode_exclude)
root.bind_all('<Alt-X>',decode_exclude)
root.bind_all('<Alt-z>',toggle_zap)
@ -1594,8 +1590,6 @@ bstop=Button(iframe4c, text='Stop',underline=0,command=stopmon,
padx=1,pady=1)
bmonitor=Button(iframe4c, text='Monitor',underline=0,command=monitor,
padx=1,pady=1)
bsavelast=Button(iframe4c, text='Save',underline=2,command=savelast,
padx=1,pady=1)
bdecode=Button(iframe4c, text='Decode',underline=0,command=decode,
padx=1,pady=1)
berase=Button(iframe4c, text='Erase',underline=0,command=erase,
@ -1613,7 +1607,6 @@ blogqso.pack(side=LEFT,expand=1,fill=X)
#bplay.pack(side=LEFT,expand=1,fill=X)
bstop.pack(side=LEFT,expand=1,fill=X)
bmonitor.pack(side=LEFT,expand=1,fill=X)
bsavelast.pack(side=LEFT,expand=1,fill=X)
bdecode.pack(side=LEFT,expand=1,fill=X)
berase.pack(side=LEFT,expand=1,fill=X)
bclravg.pack(side=LEFT,expand=1,fill=X)
@ -1682,7 +1675,7 @@ ldsec.grid(column=0,row=4,ipadx=3,padx=2,pady=5,sticky='EW')
Widget.bind(ldsec,'<Button-1>',incdsec)
Widget.bind(ldsec,'<Button-3>',decdsec)
f5b.pack(side=LEFT,expand=0,fill=BOTH)
f5b.pack(side=LEFT,expand=1,fill=BOTH)
#------------------------------------------------------ Tx params and msgs
f5c=Frame(iframe5,bd=2,relief=GROOVE)
@ -1700,7 +1693,6 @@ f5c2.grid(column=0,row=1,sticky='W',padx=4)
sked.grid(column=0,row=3,sticky='W',padx=4)
genmsg.grid(column=0,row=4,sticky='W',padx=4)
auto.grid(column=0,row=5,sticky='EW',padx=4)
#txstop.grid(column=0,row=6,sticky='EW',padx=4)
ntx=IntVar()
tx1=Entry(f5c,width=24)
@ -1745,7 +1737,7 @@ tx6.grid(column=1,row=5)
rb6.grid(column=2,row=5)
b6.grid(column=3,row=5)
f5c.pack(side=LEFT,fill=BOTH)
f5c.pack(side=LEFT,expand=1,fill=BOTH)
iframe5.pack(expand=1, fill=X, padx=4)
#------------------------------------------------------------ Status Bar

View File

@ -20,7 +20,7 @@ subroutine map65a
logical done(MAXMSG)
integer rfile3
character decoded*22,blank*22,cbad*1
common/spcom/ss(4,322,NFFT) !169 MB: half-symbol spectra
common/spcom/ip0,ss(4,322,NFFT) !169 MB: half-symbol spectra
data blank/' '/
data shmsg0/'ATT','RO ','RRR','73 '/
data nfile/0/
@ -30,17 +30,30 @@ subroutine map65a
rewind 11
rewind 12
nfile=nfile+1
1 nfile=nfile+1
nutc=0744+nfile
if(nutc.eq.0747) go to 1
if(nutc.eq.0749) go to 1
if(nutc.eq.0751) go to 1
if(nutc.eq.0753) go to 1
infile='061111.0745'
write(infile(8:11),1001) nutc
1001 format(i4.4)
! read(infile(8:11),*) nutc
tskip=0.
fselect=0.
fselect=104.5303
nmin=1
! fselect=126.0 + 1.6 + 0.290
! nflip=-1
! ip0=1
fselect=128.0 + 1.6 + 0.220
nflip=1
ip0=3
! fselect=155.0 + 1.6 + 0.454
! nflip=1
! ip0=2
! fselect=103 + 1.6 - 0.07
! nflip=-1 !May need to try both +/- 1
! ip0=4 !Try all four?
open(23,file='CALL3.TXT',status='unknown')
@ -60,16 +73,14 @@ subroutine map65a
if(fselect.gt.0.0) then
! nfilt=2 should be faster (but doesn't work right?)
nfilt=1 !nfilt=2 is faster for selected freq
! freq=fselect+1.600
nfilt=2 !nfilt=2 is faster for selected freq
freq=fselect
nflip=-1 !May need to try both +/- 1
ipol=4 !Try all four?
dt=2.314240 !Not needed?
call decode1a(id,newdat,nfilt,freq,nflip,ipol,sync2, &
call decode1a(id,newdat,nfilt,freq,nflip,ip0,sync2, &
a,dt,pol,nkv,nhist,qual,decoded)
nsync1=0
nsync2=nint(10.0*log10(sync2)) - 40 !### empirical ###
ndf=nint(a(1))
nw=0
! Insert 'OOO' if flip<0.
write(11,1010) nutc,nsync1,nsync2,dt,ndf,nw,decoded, &
@ -181,6 +192,8 @@ subroutine map65a
nflip=nint(flipk)
call decode1a(id,newdat,nfilt,freq,nflip,ipol, &
sync2,a,dt,pol,nkv,nhist,qual,decoded)
! i9=index(decoded,'AA1YN')
! if(i9.gt.0) print*,i,i9,fselect,freq,decoded
kk=kk+1
sig(kk,1)=nfile
sig(kk,2)=nutc
@ -273,8 +286,8 @@ subroutine map65a
! + nkv,nqual
! endif
write(19,1012) f0,ndf,npol,nutc,decoded
1012 format(f7.3,i5,i4,i5.4,2x,a22)
! write(19,1012) f0,ndf,npol,nutc,decoded
!1012 format(f7.3,i5,i4,i5.4,2x,a22)
write(26,1014) f0,ndf,ndf0,ndf1,ndf2,dt,npol,nsync1, &
nsync2,nutc,decoded,nkv,nqual,nhist

View File

@ -1,4 +1,4 @@
subroutine spec(brightness,contrast,logmap,ngain,nspeed,a)
subroutine spec(brightness,contrast,ngain,nspeed,a,a2)
parameter (NX=750,NY=130,NTOT=NX*NY,NFFT=32768)
@ -9,58 +9,77 @@ subroutine spec(brightness,contrast,logmap,ngain,nspeed,a)
! Output:
integer*2 a(NTOT) !Pixel values for NX x NY array
integer*2 a2(NTOT) !Pixel values for NX x NY array
logical first
integer nstep(4)
integer nstep(5)
integer b0,c0
real s(NX,NY)
common/spcom/ss(4,322,NFFT) !169 MB: half-symbol spectra
real s(NFFT,NY)
common/spcom/ip0,ss(4,322,NFFT) !169 MB: half-symbol spectra
include 'gcom1.f90'
include 'gcom2.f90'
include 'gcom3.f90'
include 'gcom4.f90'
data first/.true./
data nstep/16,10,5,3/ !Integration limits
data nstep/40,20,10,5,3/ !Integration limits
save
if(first) then
df=96000.0/nfft
call zero(a,NX*NY/2)
call zero(a2,NX*NY/2)
first=.false.
endif
nadd=nstep(nspeed)
nlines=322/nadd
call zero(s,NX*NY)
call zero(s,NFFT*NY)
k=0
ia=9001
ib=9750
imid=nint(1000.0*(fselect-125.0+48.0)/df)
ia=imid-374
ib=ia+749
do n=1,nadd
do j=1,nlines
k=k+1
do i=ia,ib
s(i,j)=s(i,j) + ss(1,k,i) + ss(3,k,i)
do i=1,NFFT
s(i,j)=s(i,j) + ss(3,k,i)
enddo
enddo
enddo
newpts=NX*nlines
do i=newpts+1,NX*NY
a(i)=a(i-newpts)
a2(i)=a2(i-newpts)
enddo
gain=40*sqrt(nstep(nspeed)/5.0) * 5.0**(0.01*contrast)
gamma=1.3 + 0.01*contrast
offset=(brightness+64.0)/2
k=0
fac=20.0/nadd
nbpp=NFFT/NX !Bins per pixel in wide waterfall
do j=1,nlines
do i=ia,ib
do i=1,NX
k=k+1
n=0
x=s(i,j)
! if(s(i).gt.0.0 .and. logmap.eq.1) n=gain*log10(0.001*s(i)) &
! + offset + 20
if(x.gt.0.0 .and. logmap.eq.0) n=(20.0*x)**gamma + offset
x=0.
do ii=(i-1)*nbpp+1,i*nbpp
x=max(x,s(ii,j))
enddo
x=fac*x
if(x.gt.0.0) n=(2.0*x)**gamma + offset
n=min(252,max(0,n))
a(k)=n
n=0
x=fac*s(ia+i-1,j)
if(x.gt.0.0) n=(3.0*x)**gamma + offset
n=min(252,max(0,n))
a2(k)=n
enddo
enddo

102
specjt.py
View File

@ -41,10 +41,6 @@ fmid0=1500
frange=2000
frange0=2000
isec0=-99
logmap=IntVar()
logmap.set(0)
logm0=0
minsep=IntVar()
mode0=""
mousedf0=0
naxis=IntVar()
@ -86,21 +82,27 @@ balloon=Pmw.Balloon(root)
def pal_gray0():
g.cmap="gray0"
im.putpalette(Colormap2Palette(colormapgray0),"RGB")
im2.putpalette(Colormap2Palette(colormapgray0),"RGB")
def pal_gray1():
g.cmap="gray1"
im.putpalette(Colormap2Palette(colormapgray1),"RGB")
im2.putpalette(Colormap2Palette(colormapgray1),"RGB")
def pal_linrad():
g.cmap="Linrad"
im.putpalette(Colormap2Palette(colormapLinrad),"RGB")
im2.putpalette(Colormap2Palette(colormapLinrad),"RGB")
def pal_blue():
g.cmap="blue"
im.putpalette(Colormap2Palette(colormapblue),"RGB")
im2.putpalette(Colormap2Palette(colormapblue),"RGB")
def pal_Hot():
g.cmap="Hot"
im.putpalette(Colormap2Palette(colormapHot),"RGB")
im2.putpalette(Colormap2Palette(colormapHot),"RGB")
def pal_AFMHot():
g.cmap="AFMHot"
im.putpalette(Colormap2Palette(colormapAFMHot),"RGB")
im2.putpalette(Colormap2Palette(colormapAFMHot),"RGB")
#--------------------------------------------------- Command button routines
#---------------------------------------------------- fdf_change
@ -224,8 +226,9 @@ def freeze_decode(event):
#---------------------------------------------------- update
def update():
global a,b0,c0,g0,im,isec0,line0,newMinute,nscroll,pim, \
root_geom,t0,mousedf0,nfreeze0,tol0,mode0,nmark0,logm0, \
global a,a2,b0,c0,g0,im,im2,isec0,line0,line02,newMinute,\
nscroll,pim,pim2, \
root_geom,t0,mousedf0,nfreeze0,tol0,mode0,nmark0, \
fmid,fmid0,frange,frange0
utc=time.gmtime(time.time()+0.1*Audio.gcom1.ndsec)
@ -245,47 +248,55 @@ def update():
nspeed=nspeed0.get() #Waterfall update rate
brightness=sc1.get()
contrast=sc2.get()
logm=logmap.get()
g0=sc3.get()
newspec=Audio.gcom2.newspec #True if new data available
if newspec:
Audio.spec(brightness,contrast,logm,g0,nspeed,a) #Call Fortran routine spec
pass
Audio.spec(brightness,contrast,g0,nspeed,a,a2) #Call Fortran routine spec
if newspec or brightness!=b0 or contrast!=c0 or logm!=logm0:
if brightness==b0 and contrast==c0 and logm==logm0:
if newspec or brightness!=b0 or contrast!=c0:
if brightness==b0 and contrast==c0:
n=Audio.gcom2.nlines
box=(0,0,NX,300-n) #Define region
box=(0,0,NX,130-n) #Define region
region=im.crop(box) #Get all but last line(s)
region2=im2.crop(box) #Get all but last line(s)
try:
im.paste(region,(0,n)) #Move waterfall down
im2.paste(region2,(0,n)) #Move waterfall down
except:
print "Images did not match, continuing anyway."
for i in range(n):
line0.putdata(a[NX*i:NX*(i+1)]) #One row of pixels to line0
im.paste(line0,(0,i)) #Paste in new top line
im.paste(line0,(0,i)) #Paste in new top line(s)
line02.putdata(a2[NX*i:NX*(i+1)])#One row of pixels to line0
im2.paste(line02,(0,i)) #Paste in new top line(s)
nscroll=nscroll+n
else: #A scale factor has changed
im.putdata(a) #Compute whole new image
im2.putdata(a2) #Compute whole new image
b0=brightness #Save scale values
c0=contrast
logm0=logm
if newspec:
if Audio.gcom2.monitoring:
if minsep.get() and newMinute:
if newMinute:
draw.line((0,0,749,0),fill=128) #Draw the minute separator
draw2.line((0,0,749,0),fill=128) #Draw the minute separator
if nscroll == 13:
draw.text((5,2),t0[0:5],fill=253) #Insert time label
draw2.text((5,2),t0[0:5],fill=253) #Insert time label
else:
if minsep.get():
draw.line((0,0,749,0),fill=128) #Draw the minute separator
draw2.line((0,0,749,0),fill=128) #Draw the minute separator
pim=ImageTk.PhotoImage(im) #Convert Image to PhotoImage
graph1.delete(ALL)
pim2=ImageTk.PhotoImage(im2) #Convert Image to PhotoImage
graph2.delete(ALL)
#For some reason, top two lines are invisible, so we move down 2
graph1.create_image(0,0+2,anchor='nw',image=pim)
graph2.create_image(0,0+2,anchor='nw',image=pim2)
newMinute=0
Audio.gcom2.newspec=0
@ -328,30 +339,20 @@ def update():
#-------------------------------------------------------- draw_axis
def draw_axis():
xmid=fmid
if naxis.get(): xmid=xmid-1270.46
c.delete(ALL)
# Draw the frequency or DF tick marks
if(frange==2000):
for ix in range(-1300,5001,20):
i=374.5 + (ix-xmid)/df
xmid=125.0
bw=96.0
x1=int(xmid-0.5*bw)
x2=int(xmid+0.5*bw)
xdf=bw/NX
for ix in range(x1,x2,1):
i=0.5*NX + (ix-xmid)/xdf
j=20
if (ix%100)==0 :
if (ix%5)==0: j=16
if (ix%10)==0 :
j=16
x=i-2
if ix<1000 : x=x+2
y=8
c.create_text(x,y,text=str(ix))
c.create_line(i,25,i,j,fill='black')
if(frange==4000):
for ix in range(-2600,5401,50):
i=374.5 + (ix-xmid)/(2*df)
j=20
if (ix%200)==0 :
j=16
x=i-2
if ix<1000 : x=x+2
x=i-1
if ix<100: x=x+1
y=8
c.create_text(x,y,text=str(ix))
c.create_line(i,25,i,j,fill='black')
@ -370,6 +371,26 @@ def draw_axis():
x2=(Audio.gcom2.mousedf+tol)/dff + dx
c.create_line(x1,25,x2,25,fill='green',width=2)
c2.delete(ALL)
xmid2=0
bw2=750.0*96000.0/32768.0 #approx 2197.27 Hz
x1=int(xmid-0.5*bw2)/100 - 1
x1=100*x1
x2=int(xmid+0.5*bw2)
xdf2=bw2/NX
for ix in range(x1,x2,20):
i=0.5*NX + (ix-xmid2)/xdf2
j=20
# if (ix%5)==0: j=16
if (ix%100)==0 :
j=16
x=i-1
if ix<1000: x=x+2
if ix<0: x=x-2
y=8
c2.create_text(x,y,text=str(ix))
c2.create_line(i,25,i,j,fill='black')
#-------------------------------------------------------- Create GUI widgets
#-------------------------------------------------------- Menu bar
@ -384,7 +405,6 @@ setupbutton = Menubutton(mbar, text = 'Options', )
setupbutton.pack(side = LEFT)
setupmenu = Menu(setupbutton, tearoff=1)
setupbutton['menu'] = setupmenu
setupmenu.add_checkbutton(label = 'Mark T/R boundaries',variable=minsep)
setupmenu.add_checkbutton(label='Flatten spectra',variable=nflat)
setupmenu.add_checkbutton(label='Mark JT65 tones only if Freeze is checked',
variable=nmark)
@ -429,7 +449,7 @@ bfmid3.pack(side=LEFT)
bfmid2.pack(side=LEFT)
#------------------------------------------------- Speed selection buttons
for i in (4, 3, 2, 1):
for i in (5, 4, 3, 2, 1):
t=str(i)
Radiobutton(mbar,text=t,value=i,variable=nspeed0).pack(side=RIGHT)
nspeed0.set(1)
@ -508,11 +528,9 @@ try:
elif key == 'Brightness': sc1.set(value)
elif key == 'Contrast': sc2.set(value)
elif key == 'DigitalGain': sc3.set(value)
elif key == 'MinuteSeparators': minsep.set(value)
elif key == 'AxisLabel': naxis.set(value)
elif key == 'MarkTones': nmark.set(value)
elif key == 'Flatten': nflat.set(value)
elif key == 'LogMap': logmap.set(value)
elif key == 'Palette': g.cmap=value
elif key == 'Frange': nfr.set(value)
elif key == 'Fmid': fmid=int(value)
@ -574,11 +592,9 @@ f.write("UpdateInterval " + str(nspeed0.get()) + "\n")
f.write("Brightness " + str(b0)+ "\n")
f.write("Contrast " + str(c0)+ "\n")
f.write("DigitalGain " + str(g0)+ "\n")
f.write("MinuteSeparators " + str(minsep.get()) + "\n")
f.write("AxisLabel " + str(naxis.get()) + "\n")
f.write("MarkTones " + str(nmark.get()) + "\n")
f.write("Flatten " + str(nflat.get()) + "\n")
f.write("LogMap " + str(logmap.get()) + "\n")
f.write("Palette " + g.cmap + "\n")
f.write("Frange " + str(nfr.get()) + "\n")
f.write("Fmid " + str(fmid) + "\n")

View File

@ -19,8 +19,10 @@ c = -1 means sort x in decreasing order (ignoring y)
c = -2 means sort x in decreasing order and carry y along.
integer kflag, n
real x(n), y(n)
real r, t, tt, tty, ty
! real x(n), y(n)
! real r, t, tt, tty, ty
integer x(n), y(n)
integer r, t, tt, tty, ty
integer i, ij, j, k, kk, l, m, nn
integer il(21), iu(21)