From db254d4e321f46a063aa2039b77236ae1befdd49 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Fri, 8 Sep 2006 20:54:59 +0000 Subject: [PATCH] Changes to make it possible to decode JT65 over a much wider range of DF. Sync tone can now be anywhere in the range 200-4300 Hz (approx). NB: this is experimental, needs thorough testing! git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@290 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- decode3.F90 | 2 +- gcom2.f90 | 5 ++-- lpf1.f | 71 +++++++++++++++++++++++++++++++++++++++++++---------- specjt.py | 6 ++--- wsjt.py | 10 +++++--- wsjt1.F | 9 ++++--- wsjt65.f | 4 +-- 7 files changed, 78 insertions(+), 29 deletions(-) diff --git a/decode3.F90 b/decode3.F90 index bceaf930f..6bf94962c 100644 --- a/decode3.F90 +++ b/decode3.F90 @@ -59,7 +59,7 @@ subroutine decode3(d2,jz,istart,filename) endif call wsjt1(d2d,jz,istart,samfacin,FileID,ndepth,MinSigdB, & NQRN,DFTolerance,MouseButton,NClearAve, & - nMode,NFreeze,NAFC,NZap,mode65, & + nMode,NFreeze,NAFC,NZap,mode65,idf, & MyCall,HisCall,HisGrid,neme,nsked,ntx2,s2, & ps0,npkept,lumsg,basevb,rmspower,nslim2,psavg,ccf,Nseg, & MouseDF,NAgain,LDecoded,nspecial,ndf,ss1,ss2) diff --git a/gcom2.f90 b/gcom2.f90 index 1d3cc6ee4..128e608a5 100644 --- a/gcom2.f90 +++ b/gcom2.f90 @@ -58,6 +58,7 @@ integer ntime !Integer Unix time (now) SoundIn integer idinterval !Interval between CWIDs, minutes GUI integer msmax !(why is this here?) integer lenappdir !Length of Appdir string GUI +integer idf !Frequency offset in Hz Decoder integer ndiskdat !1 if data read from disk, 0 otherwise GUI integer nlines !Available lines of waterfall data GUI integer nflat !Is waterfall to be flattened? GUI @@ -67,7 +68,7 @@ integer ndepth !Requested "depth" of JT65 decoding GUI integer nspecial !JT65 shorthand msg#: RO=2 RRR=3 73=4 Decoder integer ndf !Measured DF in Hz Decoder real ss1 !Magenta curve for JT65 shorthand msg Decoder -real ss2 !Orange curve for JT65 shorthand msg Decoder +real ss2 !Orange curve for JT65 shorthand msg Decoder character mycall*12 !My call sign GUI character hiscall*12 !His call sign GUI character hisgrid*6 !His grid locator GUI @@ -91,7 +92,7 @@ common/gcom2/ps0(431),psavg(450),s2(64,3100),ccf(-5:540), & nclearave,nfreeze,nafc,nmode,mode65,nclip,ndebug,nblank,nport, & 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, & + idinterval,msmax,lenappdir,idf,ndiskdat,nlines,nflat,ntxreq,ntxnow, & 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/lpf1.f b/lpf1.f index a97648d49..2883c8d53 100644 --- a/lpf1.f +++ b/lpf1.f @@ -1,19 +1,64 @@ - subroutine lpf1(data,n,nz) + subroutine lpf1(dat,jz,nz,mousedf,mousedf2) -C Half-band lowpass filter and decimate by 2. + parameter (NMAX=1024*1024) + parameter (NMAXH=NMAX) + real dat(jz),x(NMAX) + complex c(0:NMAXH) + equivalence (x,c) - real data(n) +C Find FFT length + xn=log(float(jz))/log(2.0) + n=xn + if((xn-n).gt.0.) n=n+1 + nfft=2**n + nh=nfft/2 - nz=n/2 -10 - do i=1,nz - j=2*i+8 - data(i)=0.047579*(data(j-9)+data(j+9)) - + - 0.073227*(data(j-7)+data(j+7)) - + + 0.113449*(data(j-5)+data(j+5)) - + - 0.204613*(data(j-3)+data(j+3)) - + + 0.633339*(data(j-1)+data(j+1)) - + + data(j) +C Load data into real array x; pad with zeros up to nfft. + do i=1,jz + x(i)=dat(i) enddo + if(nfft.gt.jz) call zero(x(jz+1),nfft-jz) +C Do the FFT + call xfft(x,nfft) + df=11025.0/nfft + + ia=70/df + do i=0,ia + c(i)=0. + enddo + ia=5000.0/df + do i=ia,nh + c(i)=0. + enddo + +C See if frequency needs to be shifted: + ndf=0 + if(mousedf.lt.-600) ndf=-670 + if(mousedf.gt.600) ndf=1000 + if(mousedf.gt.1600) ndf=2000 + if(mousedf.gt.2600) ndf=3000 + + if(ndf.ne.0) then +C Shift frequency up or down by ndf Hz: + i0=nint(ndf/df) + if(i0.lt.0) then + do i=nh,-i0,-1 + c(i)=c(i+i0) + enddo + else + do i=0,nh-i0 + c(i)=c(i+i0) + enddo + endif + endif + + mousedf2=mousedf-ndf !Adjust mousedf + call four2a(c,nh,1,1,-1) !Return to time domain + fac=1.0/nfft + nz=jz/2 + do i=1,nz + dat(i)=fac*x(i) + enddo + return end - diff --git a/specjt.py b/specjt.py index c7ede2363..946a19bdc 100644 --- a/specjt.py +++ b/specjt.py @@ -413,10 +413,8 @@ def draw_axis(): dx=375 + (1270.5-fmid)/(2*df) dff=2*df if Audio.gcom2.nfreeze==0: -# x1=-600/dff + dx -# x2=600/dff + dx - x1=0 - x2=749 + x1=(Audio.gcom2.mousedf-600)/dff + dx + x2=(Audio.gcom2.mousedf+600)/dff + dx else: tol=Audio.gcom2.dftolerance x1=(Audio.gcom2.mousedf-tol)/dff + dx diff --git a/wsjt.py b/wsjt.py index 7002fdcc2..4dc1e5dfc 100644 --- a/wsjt.py +++ b/wsjt.py @@ -998,7 +998,8 @@ def dtdf_change(event): elif (event.y>=40 and event.y<95) or \ (event.y<95 and Audio.gcom2.nspecial>0): lab1.configure(text='DF (Hz)',bg='red') - t="%d" % int(1200.0*event.x/500.0-600.0,) + idf=Audio.gcom2.idf + t="%d" % int(idf+1200.0*event.x/500.0-600.0,) lab6.configure(text=t,bg="red") else: lab1.configure(text='Time (s)',bg='green') @@ -1389,8 +1390,11 @@ def update(): msg1.configure(text="%6.4f %6.4f" % (samfac_in,samfac_out)) msg2.configure(text=mode.get()) - t="Freeze DF:%4d" % (int(Audio.gcom2.mousedf),) - msg3.configure(text=t) + t="FrzDF:%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 diff --git a/wsjt1.F b/wsjt1.F index 310891cf5..f0eeba1c4 100644 --- a/wsjt1.F +++ b/wsjt1.F @@ -1,6 +1,6 @@ subroutine wsjt1(d,jz0,istart,samfacin,FileID,ndepth,MinSigdB, + NQRN,DFTolerance,MouseButton,NClearAve, - + Mode,NFreeze,NAFC,NZap,mode65, + + Mode,NFreeze,NAFC,NZap,mode65,idf, + MyCall,HisCall,HisGrid,neme,nsked,ntx2,s2, + ps0,npkept,lumsg,basevb,rmspower,nslim2,psavg,ccf,Nseg, + MouseDF,NAgain,LDecoded,nspecial,ndf,ss1,ss2) @@ -171,11 +171,12 @@ C Intentionally degrade SNR by -nclip dB. + DFTolerance,mode65,nspecial,nstest,dfsh,iderrsh, + idriftsh,snrsh,ss1,ss2,nwsh) ! Lowpass filter and decimate by 2 - call lpf1(dat,jz,jz2) + call lpf1(dat,jz,jz2,MouseDF,MouseDF2) + idf=mousedf-mousedf2 jz=jz2 nadd=1 fzap(1)=0. - if(nzap.eq.1) call avesp2(dat,jz,nadd,mode,NFreeze,MouseDF, + if(nzap.eq.1) call avesp2(dat,jz,nadd,mode,NFreeze,MouseDF2, + DFTolerance,fzap) if(nzap.eq.1.and.nstest.eq.0) call bzap(dat,jz,nadd,mode,fzap) @@ -189,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, - + MouseDF,NAgain,ndepth,neme,nsked, + + MouseDF2,NAgain,ndepth,neme,nsked,idf, + mycall,hiscall,hisgrid,lumsg,lcum,nspecial,ndf, + nstest,dfsh,snrsh, + NSyncOK,ccf,psavg,ndiag,nwsh) diff --git a/wsjt65.f b/wsjt65.f index faef1c80a..3a25bfa00 100644 --- a/wsjt65.f +++ b/wsjt65.f @@ -1,6 +1,6 @@ subroutine wsjt65(dat,npts,cfile6,NClearAve,MinSigdB, + DFTolerance,NFreeze,NAFC,mode65,Nseg,MouseDF,NAgain, - + ndepth,neme,nsked,mycall,hiscall,hisgrid, + + ndepth,neme,nsked,idf,mycall,hiscall,hisgrid, + lumsg,lcum,nspecial,ndf,nstest,dfsh, + snrsh,NSyncOK,ccfblue,ccfred,ndiag,nwsh) @@ -127,7 +127,7 @@ 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, + write(line,1010) cfile6,nsync,nsnr,dtx-1.0,ndf+idf, + 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)