diff --git a/deep65.F b/deep65.F index ca969c9e2..346bc2a3b 100644 --- a/deep65.F +++ b/deep65.F @@ -145,6 +145,11 @@ C This is really weird, but do not remove the following statement! qual=0. endif decoded(22:22)=c +C Make sure everything is upper case. + do i=1,22 + if(decoded(i:i).ge.'a' .and. decoded(i:i).le.'z') + + decoded(i:i)=char(ichar(decoded(i:i))-32) + enddo return end diff --git a/flat2.f b/flat2.f index d351cd1ae..8cf75225f 100644 --- a/flat2.f +++ b/flat2.f @@ -1,8 +1,8 @@ subroutine flat2(ss,n,nsum) - real ss(1024) - real ref(1024) - real tmp(1024) + real ss(2048) + real ref(2048) + real tmp(2048) nsmo=20 base=50*(float(nsum)**1.5) @@ -11,12 +11,17 @@ do i=ia,ib call pctile(ss(i-nsmo),tmp,2*nsmo+1,50,ref(i)) enddo - call pctile(ref(ia),tmp,ib-ia+1,50,base2) + call pctile(ref(ia),tmp,ib-ia+1,68,base2) - if(base2.gt.0.1*base) then +C Don't flatten if signal is extremely low (e.g., RX is off). + if(base2.gt.0.05*base) then do i=ia,ib ss(i)=base*ss(i)/ref(i) enddo + else + do i=1,n + ss(i)=0. + enddo endif return diff --git a/gcom2.f90 b/gcom2.f90 index bb91f4c53..66a18aefd 100644 --- a/gcom2.f90 +++ b/gcom2.f90 @@ -35,6 +35,8 @@ integer mode65 !JT65 sub-mode (A/B/C ==> 1/2/4) GUI,SoundIn,Decoder integer nclip !Clipping level GUI integer ndebug !Write debugging info? GUI integer nblank !Is NB checked? GUI +integer nfmid !Center frequency of main display GUI +integer nfrange !Frequency range of main display GUI integer nport !Requested COM port number GUI integer mousedf !Mouse-selected freq offset, DF GUI integer neme !EME calls only in deep search? GUI @@ -89,7 +91,7 @@ common/gcom2/ps0(431),psavg(450),s2(64,3100),ccf(-5:540), & mousedf,neme,nsked,naggressive,ntx2,nslim2,nagain,nsavelast, & shok,sendingsh,d2a(661500),d2b(661500),b(60000),jza,jzb,ntime, & idinterval,msmax,lenappdir,ndiskdat,nlines,nflat,ntxreq,ntxnow, & - ndepth,nspecial,ndf,ss1(-224:224),ss2(-224:224), & + ndepth,nspecial,ndf,nfmid,nfrange,ss1(-224:224),ss2(-224:224), & mycall,hiscall,hisgrid,txmsg,sending,mode,fname0,fnamea, & fnameb,decodedfile,AppDir,filetokilla,filetokillb,utcdate,pttport diff --git a/spec.f90 b/spec.f90 index 89e2833af..3327c296d 100644 --- a/spec.f90 +++ b/spec.f90 @@ -22,7 +22,7 @@ subroutine spec(brightness,contrast,logmap,ngain,nspeed,a) integer b0,c0 real x(4096) !Data for FFT complex c(0:2048) !Complex spectrum - real ss(1024) !Bottom half of power spectrum + real ss(2048) !Power spectrum logical first include 'gcom1.f90' include 'gcom2.f90' @@ -36,12 +36,12 @@ subroutine spec(brightness,contrast,logmap,ngain,nspeed,a) save if(first) then - do i=1,nq - ss(i)=0. - enddo istep=2205 nfft=4096 - nq=nfft/4 + nh=nfft/2 + do i=1,nh + ss(i)=0. + enddo df=11025.0/nfft fac=2.0/10000. nsum=0 @@ -140,7 +140,7 @@ subroutine spec(brightness,contrast,logmap,ngain,nspeed,a) call xfft2(x,nfft) - do i=1,nq !Accumulate power spectrum + do i=1,nh !Accumulate power spectrum ss(i)=ss(i) + real(c(i))**2 + aimag(c(i))**2 enddo nsum=nsum+1 @@ -159,17 +159,29 @@ subroutine spec(brightness,contrast,logmap,ngain,nspeed,a) enddo endif - if(nflat.gt.0) call flat2(ss,1024,nsum) + if(nflat.gt.0) call flat2(ss,nh,nsum) - do i=1,750 !Insert new data in top row - j=i+182 ! ?? was 186 ?? - a0(i)=5*ss(j)/nsum + ia=1 + if(nfrange.eq.2000) then + i0=182 + nint((nfmid-1500)/df) + if(i0.lt.0) ia=1-i0 + else if(nfrange.eq.4000) then + i0=nint(nfmid/df - 752.0) + if(i0.lt.0) ia=1-i0/2 + endif + do i=ia,750 !Insert new data in top row + if(nfrange.eq.2000) then + a0(i)=5*ss(i+i0)/nsum + else if(nfrange.eq.4000) then + smax=max(ss(2*i+i0),ss(2*i+i0-1)) + a0(i)=5*smax/nsum + endif xdb=-40. if(a0(i).gt.0.) xdb=10*log10(a0(i)) - enddo +20 enddo nsum=0 newdat=1 !Flag for new spectrum available - do i=1,nq !Zero the accumulating array + do i=1,nh !Zero the accumulating array ss(i)=0. enddo if(jz.lt.300) jz=jz+1 diff --git a/specjt.py b/specjt.py index b0c2cdaaf..0ece1f122 100644 --- a/specjt.py +++ b/specjt.py @@ -1,5 +1,4 @@ #---------------------------------------------------- SpecJT - from Tkinter import * from tkMessageBox import showwarning import time @@ -39,6 +38,10 @@ c0=0 g0=0 g.cmap="Linrad" df=2.69165 +fmid=1500 +fmid0=1500 +frange=2000 +frange0=2000 isec0=-99 logmap=IntVar() logmap.set(0) @@ -50,6 +53,8 @@ naxis=IntVar() ncall=0 newMinute=0 nflat=IntVar() +nfr=IntVar() +nfr.set(1) nfreeze0=0 nmark=IntVar() nmark0=0 @@ -116,7 +121,8 @@ def tx_volume(): # Readout of graphical cursor location def fdf_change(event): if nspeed0.get()<6: - g.DFreq=df*(event.x-288.7) + g.DFreq=df*(event.x-288.7) + fmid - 1500 + if nfr.get()==2: g.DFreq=2*df*(event.x-375.5) + fmid - 1270.5 g.Freq=g.DFreq+1270.46 t="Freq: %5d DF: %5d (Hz)" % (int(g.Freq),int(g.DFreq)) else: @@ -133,9 +139,12 @@ def fdf_change(event): #---------------------------------------------------- set_freezedf def set_freezedf(event): if g.mode[:4]=='JT65': - n=int(df*(event.x-288.7)) - if n<-600: n=-600 - if n>600: n=600 + n=int(df*(event.x-288.7) + fmid - 1500) + if nfr.get()==2: n=int(2*df*(event.x-375.5) + fmid - 1270.5) +# if n<-600: n=-600 +# if n>600: n=600 + if n<-1270: n=-1270 + if n>3800: n=3800 Audio.gcom2.mousedf=n else: decode_request(event) @@ -156,19 +165,75 @@ def df_mark(): if g.mode[4:5]=='C': fstep=4*fstep # Mark sync tone and top JT65 tone (green) and shorthand tones (red) - if g.mode[:4]=="JT65": - color='green' - x1=(Audio.gcom2.mousedf + 6.6*fstep)/df + 288.7 - c.create_line(x1-0.5,25,x1-0.5,12,fill=color) - c.create_line(x1+0.5,25,x1+0.5,12,fill=color) - for i in range(5): - x1=(Audio.gcom2.mousedf+i*fstep)/df + 288.7 - j=12 - if i>0: j=15 - if i!=1: c.create_line(x1-0.5,25,x1-0.5,j,fill=color) - if i!=1: c.create_line(x1+0.5,25,x1+0.5,j,fill=color) - color='red' - + if(frange==2000): + dx=288.7 + (1500-fmid)/df + if g.mode[:4]=="JT65": + color='green' + x1=(Audio.gcom2.mousedf + 6.6*fstep)/df + dx + c.create_line(x1-0.5,25,x1-0.5,12,fill=color) + c.create_line(x1+0.5,25,x1+0.5,12,fill=color) + for i in range(5): + x1=(Audio.gcom2.mousedf + i*fstep)/df + dx + j=12 + if i>0: j=15 + if i!=1: c.create_line(x1-0.5,25,x1-0.5,j,fill=color) + if i!=1: c.create_line(x1+0.5,25,x1+0.5,j,fill=color) + color='red' + if(frange==4000): + dx=375 + (1270.5-fmid)/(2*df) + if g.mode[:4]=="JT65": + color='green' + x1=(Audio.gcom2.mousedf + 6.6*fstep)/(2*df) + dx + c.create_line(x1-0.5,25,x1-0.5,12,fill=color) + c.create_line(x1+0.5,25,x1+0.5,12,fill=color) + for i in range(5): + x1=(Audio.gcom2.mousedf + i*fstep)/(2*df) + dx + j=12 + if i>0: j=15 + if i!=1: c.create_line(x1-0.5,25,x1-0.5,j,fill=color) + if i!=1: c.create_line(x1+0.5,25,x1+0.5,j,fill=color) + color='red' + +#---------------------------------------------------- change_fmid +def change_fmid1(): + global fmid + fmid=fmid+100 + if fmid>5000-1000*nfr.get(): fmid=5000-1000*nfr.get() + +def change_fmid2(): + global fmid + fmid=fmid-100 + if fmid<1000*nfr.get(): fmid=1000*nfr.get() + +def set_fmid(): + global fmid + if nfr.get()==1: fmid=1200 + if nfr.get()==2: fmid=2200 + +#---------------------------------------------------- freq_range +def freq_range(event): +# Move frequency scale left or right in 100 Hz increments + global fmid + if event.num==1: + fmid=fmid+100 + else: + if event.num==3: + fmid=fmid-100 + if fmid<1000*nfr.get(): fmid=1000*nfr.get() + if fmid>5000-1000*nfr.get(): fmid=5000-1000*nfr.get() + +def set_frange(): + nfr.set(3-nfr.get()) + +#---------------------------------------------------- freq_center +##def freq_center(event): +### Move clicked location to center of frequency scale +## global fmid,frange +## n=100*int(0.01*df*(event.x-375)) +## fmid = fmid + n +## if fmid<1000: fmid=1000 +## if fmid>1700: fmid=1700 + #---------------------------------------------------- decode_request def decode_request(event): if g.mode[:4]!='JT65' and nspeed0.get()>5: @@ -192,7 +257,8 @@ def freeze_decode(event): #---------------------------------------------------- update def update(): global a,b0,c0,g0,im,isec0,line0,newMinute,nscroll,nspeed00,pim, \ - root_geom,t0,mousedf0,nfreeze0,tol0,mode0,nmark0,logm0 + root_geom,t0,mousedf0,nfreeze0,tol0,mode0,nmark0,logm0, \ + fmid,fmid0,frange,frange0 utc=time.gmtime(time.time()+0.1*Audio.gcom1.ndsec) isec=utc[5] @@ -300,35 +366,66 @@ def update(): if newdat: Audio.gcom2.ndiskdat=0 Audio.gcom2.nlines=0 Audio.gcom2.nflat=nflat.get() + frange=nfr.get()*2000 + 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() + fmid0=fmid + frange0=frange + Audio.gcom2.nfmid=int(fmid) + Audio.gcom2.nfrange=int(frange) + if g.focus==2: root.focus_set() ltime.after(200,update) #Reset the timer #-------------------------------------------------------- draw_axis def draw_axis(): - xmid=1500 + xmid=fmid if naxis.get(): xmid=xmid-1270.46 c.delete(ALL) if nspeed0.get()<6: - for ix in range(-1000,2501,20): - i=374.5 + (ix-xmid)/df - j=20 - if (ix%100)==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') +# Draw the frequency or DF tick marks + if(frange==2000): + for ix in range(-1300,5001,20): + i=374.5 + (ix-xmid)/df + j=20 + if (ix%100)==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 + y=8 + c.create_text(x,y,text=str(ix)) + c.create_line(i,25,i,j,fill='black') + if g.mode[:4]=="JT65": + dx=288.7 + (1500-fmid)/df + dff=df + if frange==4000: + dx=375 + (1270.5-fmid)/(2*df) + dff=2*df if Audio.gcom2.nfreeze==0: - x1=-600/df + 288.7 - x2=600/df + 288.7 +# x1=-600/dff + dx +# x2=600/dff + dx + x1=0 + x2=749 else: tol=Audio.gcom2.dftolerance - x1=(Audio.gcom2.mousedf-tol)/df + 288.7 - x2=(Audio.gcom2.mousedf+tol)/df + 288.7 + x1=(Audio.gcom2.mousedf-tol)/dff + dx + x2=(Audio.gcom2.mousedf+tol)/dff + dx c.create_line(x1,25,x2,25,fill='green',width=2) else: @@ -369,9 +466,6 @@ setupmenu.add_radiobutton(label='Frequency axis',command=draw_axis, setupmenu.add_radiobutton(label='JT65 DF axis',command=draw_axis, value=1,variable=naxis) setupmenu.add_separator() -#setupmenu.add_radiobutton(label='High sensitivity',value=0,variable=logmap) -#setupmenu.add_radiobutton(label='High dynamic range',value=1,variable=logmap) -#setupmenu.add_separator() setupmenu.palettes=Menu(setupmenu,tearoff=0) setupmenu.palettes.add_radiobutton(label='Gray0',command=pal_gray0, value=0,variable=npal) @@ -387,11 +481,25 @@ setupmenu.palettes.add_radiobutton(label='AFMHot',command=pal_AFMHot, value=5,variable=npal) setupmenu.add_cascade(label = 'Palette',menu=setupmenu.palettes) -lab1=Label(mbar,padx=50,bd=0) +lab1=Label(mbar,padx=40,bd=0) lab1.pack(side=LEFT) -fdf=Label(mbar,width=12,bd=0,padx=90) +fdf=Label(mbar,width=20,bd=0,padx=20) fdf.pack(side=LEFT) +lab3=Label(mbar,padx=13,bd=0) +lab3.pack(side=LEFT) +bbw=Button(mbar,text='BW',command=set_frange,padx=1,pady=1) +bbw.pack(side=LEFT) + +lab0=Label(mbar,padx=5,bd=0) +lab0.pack(side=LEFT) +bfmid1=Button(mbar,text='<',command=change_fmid1,padx=1,pady=1) +bfmid2=Button(mbar,text='>',command=change_fmid2,padx=1,pady=1) +bfmid3=Button(mbar,text='|',command=set_fmid,padx=3,pady=1) +bfmid1.pack(side=LEFT) +bfmid3.pack(side=LEFT) +bfmid2.pack(side=LEFT) + #------------------------------------------------- Speed selection buttons for i in (7, 6, 5, 4, 3, 2, 1): t=str(i) @@ -405,6 +513,11 @@ lab2.pack(side=RIGHT) iframe1 = Frame(frame, bd=1, relief=SUNKEN) c=Canvas(iframe1, bg='white', width=750, height=25,bd=0) c.pack(side=TOP) +Widget.bind(c,"",freq_range) +Widget.bind(c,"",freq_range) +Widget.bind(c,"",freq_range) +#Widget.bind(c,"",freq_center) + graph1=Canvas(iframe1, bg='black', width=750, height=300,bd=0,cursor='crosshair') graph1.pack(side=TOP) Widget.bind(graph1,"",fdf_change) @@ -462,6 +575,8 @@ try: 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) else: pass except: print 'Error reading WSJT.INI, continuing with defaults.' @@ -526,6 +641,8 @@ 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") root_geom=root_geom[root_geom.index("+"):] f.write("SpecJTGeometry " + root_geom + "\n") f.close() diff --git a/sync65.f b/sync65.f index b4f53de23..4bc8f6605 100644 --- a/sync65.f +++ b/sync65.f @@ -39,11 +39,15 @@ C Compute power spectrum for each step and get average call flat1(psavg,s2,nh,nsteps,NHMAX,NSMAX) !Flatten the spectra C Find the best frequency channel for CCF - fa= 670.46 - fb=1870.46 +! famin= 670.46 +! fbmax=1870.46 + famin=200 + fbmax=3800 + fa=famin + fb=fbmax if(NFreeze.eq.1) then - fa=max( 670.46,1270.46+MouseDF-DFTolerance) - fb=min(1870.46,1270.46+MouseDF+DFTolerance) + fa=max(famin,1270.46+MouseDF-DFTolerance) + fb=min(fbmax,1270.46+MouseDF+DFTolerance) endif ia=fa/df ib=fb/df @@ -61,7 +65,8 @@ C Find the best frequency channel for CCF do i=ia,ib call xcor(s2,i,nsteps,nsym,lag1,lag2, + ccfblue,ccf0,lagpk0,flip,0.0) - ccfred(i-i0)=ccf0 + j=i-i0 + if(j.ge.-224 .and. j.le.224) ccfred(j)=ccf0 C Find rms of the CCF, without the main peak call slope(ccfblue(lag1),lag2-lag1+1,lagpk0-lag1+1.0) diff --git a/wsjt.py b/wsjt.py index 9f753e942..6c0f26af4 100644 --- a/wsjt.py +++ b/wsjt.py @@ -1,4 +1,4 @@ -#---------------------------------------------------------------- WSJT +#----------------------------------------------------------------- WSJT # $Date$ $Revision$ # from Tkinter import * diff --git a/wsjt65.f b/wsjt65.f index 7bb9fc27f..70417041a 100644 --- a/wsjt65.f +++ b/wsjt65.f @@ -186,7 +186,7 @@ C Write the average line + avemsg1,nc1,nqual1 1023 format(a6,i3,i4,'/',i3,18x,a19,i8,i4) if(lcum .and. (avemsg1.ne.' ')) - + write(21,1011) ave1(1:57)//' ' + + write(21,1011) ave1 ns10=ns1 endif @@ -200,7 +200,7 @@ C If Monitor segment #2 is available, write that line also if(ns2.ge.100) write(ave2,1023) cfile6,2,nused2,ns2,avemsg2, + nc2,nqual2 if(lcum .and. (avemsg2.ne.' ')) - + write(21,1011) ave2(1:57)//' ' + + write(21,1011) ave2 ns20=ns2 endif