From 767a9452e60ccfa60176ed16e0be8eea2faf5dc7 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Fri, 18 Mar 2016 20:17:17 +0000 Subject: [PATCH] 1. Use Lorentzian profile for smoothing (but not yet for message averaging). 2. Add ability to set ndepth and do message averaging ti fer65. 3. Correct SNR values for measured Doppler width. 4. Comment out the "write(62..." diagnostics. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6537 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- CMakeLists.txt | 1 + lib/decode65a.f90 | 14 ++++++------ lib/fer65.f90 | 44 +++++++++++++++++++++++------------- lib/jt65_decode.f90 | 54 ++++++++++++++++++++++----------------------- lib/smolorentz.f90 | 42 +++++++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+), 49 deletions(-) create mode 100644 lib/smolorentz.f90 diff --git a/CMakeLists.txt b/CMakeLists.txt index 03dc1a977..6a39c2030 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -388,6 +388,7 @@ set (wsjt_FSRCS lib/slope.f90 lib/smo.f90 lib/smo121.f90 + lib/smolorentz.f90 lib/softsym.f90 lib/softsym9f.f90 lib/shell.f90 diff --git a/lib/decode65a.f90 b/lib/decode65a.f90 index 714966e4e..4ba248640 100644 --- a/lib/decode65a.f90 +++ b/lib/decode65a.f90 @@ -13,6 +13,7 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & complex cx1(NMAX/8) !Data at 1378.125 sps, offset by 355.3 Hz complex c5x(NMAX/32) !Data at 344.53125 Hz complex c5a(512) + real s1a(-255:256,126) real s2(66,126) real a(5) logical first @@ -90,16 +91,15 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & maxsmo=2*minsmo endif nn=0 - do ismo=minsmo,maxsmo + do ismo=0,3 if(ismo.gt.0) then + w=width/df + if(ismo.eq.2) w=1.414*w + if(ismo.eq.3) w=2.0*w do j=1,126 - call smo121(s1(-255,j),512) - if(j.eq.1) nn=nn+1 - if(nn.ge.4) then - call smo121(s1(-255,j),512) - if(j.eq.1) nn=nn+1 - endif + call smolorentz(s1(-255,j),512,w,s1a(-255,j)) enddo + s1=s1a endif do i=1,66 diff --git a/lib/fer65.f90 b/lib/fer65.f90 index e56c75829..1b2222bd7 100644 --- a/lib/fer65.f90 +++ b/lib/fer65.f90 @@ -19,13 +19,13 @@ program fer65 implicit real*8 (a-h,o-z) real*8 s(6),sq(6) - character arg*12,cmnd*100,decoded*22,submode*1,csync*1 + character arg*12,cmnd*100,decoded*22,submode*1,csync*1,f1*15,f2*15 logical syncok nargs=iargc() - if(nargs.ne.5) then - print*,'Usage: fer65 submode fspread snr1 snr2 iters' - print*,'Example: fer65 C 3.0 -28 -12 1000' + if(nargs.ne.6) then + print*,'Usage: fer65 submode fspread snr1 snr2 depth iters' + print*,'Example: fer65 C 3.0 -28 -12 5 1000' go to 999 endif @@ -37,6 +37,8 @@ program fer65 call getarg(4,arg) read(arg,*) snr2 call getarg(5,arg) + read(arg,*) ndepth + call getarg(6,arg) read(arg,*) iters dfmax=min(d,0.5*2.69) @@ -46,13 +48,15 @@ program fer65 ntrials=1000 naggressive=10 + nfiles=1 + if(ndepth.eq.4) nfiles=4 open(20,file='fer65.20',status='unknown') open(21,file='fer65.21',status='unknown') - write(20,1000) submode,iters,ntrials,naggressive,d -1000 format(/'JT65',a1,' Iters:',i6,' T:',i7,' Aggressive:',i3, & - ' Doppler:',f6.1) + write(20,1000) submode,iters,ntrials,naggressive,d,ndepth,nfiles +1000 format(/'JT65',a1,' Iters:',i5,' T:',i6,' Aggressive:',i3, & + ' Doppler:',f5.1,' Depth:',i2,' Navg:',i3) write(20,1002) 1002 format(/' dB nsync ngood nbad sync dsnr ', & 'DT Freq Drift Width'/85('-')) @@ -67,11 +71,19 @@ program fer65 s=0. sq=0. do iter=1,iters - write(cmnd,1010) submode,d,snr -1010 format('./jt65sim -n 1 -m ',a1,' -d',f6.1,' -s \\',f5.1,' >devnull') - call unlink('000000_0001.wav') -! print*,cmnd + write(cmnd,1010) submode,d,snr,nfiles +1010 format('./jt65sim -n 1 -m ',a1,' -d',f6.1,' -s \\',f5.1,' -f',i3,' >devnull') + call unlink('000000_????.wav') call system(cmnd) + if(nfiles.gt.1) then + do i=nfiles,2,-1 + j=2*i-1 + write(f1,1011) i + write(f2,1011) j +1011 format('000000_',i4.4,'.wav') + call rename(f1,f2) + enddo + endif call unlink('decoded.txt') call unlink('fort.13') isync=0 @@ -80,14 +92,16 @@ program fer65 nfreq=0 ndrift=0 nwidth=0 - cmnd='./jt65 -m A -a 10 -f 1500 -n 1000 -d 3 -s -X 32 000000_0001.wav > decoded.txt' + cmnd='./jt65 -m A -a 10 -c K1ABC -f 1500 -n 1000 -d 5 -s -X 32 000000_????.wav > decoded.txt' cmnd(11:11)=submode -! print*,cmnd + write(cmnd(47:47),'(i1)') ndepth call system(cmnd) open(13,file='fort.13',status='old',err=20) - read(13,1012) nutc,isync,nsnr,dt,nfreq,ndrift,nwidth,decoded, & + do i=1,nfiles + read(13,1012) nutc,isync,nsnr,dt,nfreq,ndrift,nwidth,decoded, & nft,nsum,nsmo -1012 format(i4,i4,i5,f6.2,i5,i4,i3,1x,a22,5x,3i3) +1012 format(i4,i4,i5,f6.2,i5,i4,i3,1x,a22,5x,3i3) + enddo close(13) syncok=abs(dt).lt.0.2 .and. float(abs(nfreq-1500)).lt.dfmax csync=' ' diff --git a/lib/jt65_decode.f90 b/lib/jt65_decode.f90 index 6d996ba15..f47d37bbf 100644 --- a/lib/jt65_decode.f90 +++ b/lib/jt65_decode.f90 @@ -204,7 +204,7 @@ contains ! s2db=10.0*log10(sync2) - 35 !### empirical ### ! if(width.gt.3) s2db=s2db + 2.1*sqrt(width-3.0) + 1.5 + & ! 0.11*(width-7.0) !### empirical^2 ### - s2db=sync1 - 30.0 + s2db=sync1 - 30.0 + db(width/3.3) nsnr=nint(s2db) if(nsnr.lt.-30) nsnr=-30 if(nsnr.gt.-1) nsnr=-1 @@ -307,7 +307,7 @@ contains integer nfsave(MAXAVE) integer listutc(10) integer nflipsave(MAXAVE) -! real s1b(-255:256,126) +! real s1a(-255:256,126) ! real s1save(-255:256,126,MAXAVE) real s3save(64,63,MAXAVE) real s3b(64,63) @@ -380,31 +380,31 @@ contains enddo if(nsum.lt.2) go to 900 - rewind 62 - sqt=0. - sqf=0. - do j=1,64 - i=iused(j) - if(i.eq.0) exit - csync='*' - if(nflipsave(i).lt.0) csync='#' - write(62,3001) i,iutc(i),syncsave(i),dtsave(i),nfsave(i),csync -3001 format(i3,i6.4,f6.1,f6.2,i6,1x,a1) - sqt=sqt + (dtsave(i)-dtave)**2 - sqf=sqf + (nfsave(i)-fave)**2 - enddo - rmst=0. - rmsf=0. - if(nsum.ge.2) then - rmst=sqrt(sqt/(nsum-1)) - rmsf=sqrt(sqf/(nsum-1)) - endif - write(62,3002) -3002 format(16x,'----- -----') - write(62,3003) dtave,nint(fave) - write(62,3003) rmst,nint(rmsf) -3003 format(15x,f6.2,i6) - flush(62) +! rewind 62 +! sqt=0. +! sqf=0. +! do j=1,64 +! i=iused(j) +! if(i.eq.0) exit +! csync='*' +! if(nflipsave(i).lt.0) csync='#' +! write(62,3001) i,iutc(i),syncsave(i),dtsave(i),nfsave(i),csync +!3001 format(i3,i6.4,f6.1,f6.2,i6,1x,a1) +! sqt=sqt + (dtsave(i)-dtave)**2 +! sqf=sqf + (nfsave(i)-fave)**2 +! enddo +! rmst=0. +! rmsf=0. +! if(nsum.ge.2) then +! rmst=sqrt(sqt/(nsum-1)) +! rmsf=sqrt(sqf/(nsum-1)) +! endif +! write(62,3002) +!3002 format(16x,'----- -----') +! write(62,3003) dtave,nint(fave) +! write(62,3003) rmst,nint(rmsf) +!3003 format(15x,f6.2,i6) +! flush(62) nadd=nsum*mode65 nftt=0 diff --git a/lib/smolorentz.f90 b/lib/smolorentz.f90 new file mode 100644 index 000000000..70132f598 --- /dev/null +++ b/lib/smolorentz.f90 @@ -0,0 +1,42 @@ +!program smolorentz +subroutine smolorentz(s1,nz,w,s2) + +! parameter (nz=512) + real s1(nz),s2(nz) + real y(-50:50) +! character*8 arg + +! s1=0. +! s1(256)=1. + +! call getarg(1,arg) +! read(arg,*) w + + do i=-50,50 + x=i + z=x/(0.5*w) + y(i)=0. + if(abs(z).lt.3.0) then + d=1.0 + z*z + y(i)=(1.0/d - 0.1)*10.0/9.0 + endif + enddo + + jz=nint(1.5*w) + if(jz.gt.50) jz=50 + do i=1,nz + s=0. + sy=0. + do j=-jz,jz + k=i+j + if(k.ge.1 .and. k.le.nz) then + s=s + s1(k)*y(j) + sy=sy+y(j) + endif + enddo + s2(i)=s/sy +! write(52,3002) i-256,s1(i),s2(i) +!3002 format(i5,2f10.4) + enddo + +end subroutine smolorentz