From d2254f03106ceacc7d1a45afc6cdab22444d639f Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 24 Jul 2006 14:30:15 +0000 Subject: [PATCH] fivehz.F90: Added function gran() wsjt1.F: Option to intentionally degrade SNR for test purposes deep65.F: Tweaked parameters for computing qual git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@200 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- deep65.F | 17 ++++++----------- fivehz.F90 | 17 +++++++++++++---- wsjt.py | 2 +- wsjt1.F | 18 +++++++++++++++++- 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/deep65.F b/deep65.F index 9e9e8830b..69a1cb5bf 100644 --- a/deep65.F +++ b/deep65.F @@ -73,7 +73,8 @@ callgrid(icall)=callsign(1:j2) mz=1 - if(n.eq.1 .and. j3.lt.1 .and. j4.lt.1) mz=MAXRPT+1 + if(n.eq.1 .and. j3.lt.1 .and. j4.lt.1 .and. + + flip.gt.0.0) mz=MAXRPT+1 do m=1,mz if(m.gt.1) grid=rpt(m-1) if(j3.lt.1 .and.j4.lt.1) @@ -135,25 +136,19 @@ C If sync=OOO, no CQ messages if(pp(ntot-i).ne.pp(ntot)) go to 40 enddo 40 iref=min(ntot-i,nint(0.68*ntot)) - pbias=1.04*pp(ntot-i) -! pbias=1.40*pp(iref) - qual=50.0*(p1-pbias) + pbias=1.08*pp(ntot-i) + qual=100.0*(p1-pbias) + ! if(mode65.eq.1) qual=100.0*(p1-0.335) ! if(mode65.eq.4) qual=100.0*(p1-0.505) decoded=' ' c=' ' if(qual.gt.1.0) then - if(qual.lt.4.0) c='?' + if(qual.lt.6.0) c='?' decoded=testmsg(ip1) endif decoded(22:22)=c - -! write(71,1010) mycall,qual,nhard1,p1,p1/pp(ntot-i), -! + p1/pp(iref),nint(sum1),nint(ref0),nint(ref1),i,decoded -! write(*,1010) mycall,qual,nhard1,p1,p1/pp(ntot-i), -! + p1/pp(iref),nint(sum1),nint(ref0),nint(ref1),i,decoded -! 1010 format(a6,f6.1,i3,f6.3,2f6.2,4i5,1x,a22) if(qual.lt.0.) qual=0. if(qual.gt.10.) qual=10. diff --git a/fivehz.F90 b/fivehz.F90 index c18e70a1b..2fd15acc3 100644 --- a/fivehz.F90 +++ b/fivehz.F90 @@ -212,9 +212,9 @@ end subroutine fivehztx subroutine addnoise(n) integer*2 n - real r(12) real*8 txsnrdb0 include 'gcom1.f90' + data idum/0/ save if(txsnrdb.gt.40.0) return @@ -224,9 +224,7 @@ subroutine addnoise(n) if(snr.gt.1.0) fac=3000.0/snr txsnrdb0=txsnrdb endif - call random_number(r) - x=sum(r)-6.0 - i=fac*(x + n*snr/32768.0) + i=fac*(gran(idum) + n*snr/32768.0) if(i>32767) i=32767; if(i<-32767) i=-32767; n=i @@ -234,3 +232,14 @@ subroutine addnoise(n) return end subroutine addnoise +real function gran(idum) + real r(12) + integer nseed(1) + data nseed/714478811/ + if(idum.lt.0) then + call random_seed(PUT=nseed) + idum=0 + endif + call random_number(r) + gran=sum(r)-6.0 +end function gran diff --git a/wsjt.py b/wsjt.py index fe59afdeb..d258710eb 100644 --- a/wsjt.py +++ b/wsjt.py @@ -1,4 +1,4 @@ -#------------------------------------------------------------------ WSJT +#------------------------------------------------------------------- WSJT from Tkinter import * from tkFileDialog import * import Pmw diff --git a/wsjt1.F b/wsjt1.F index 9f8d6e210..f5e6c3d8a 100644 --- a/wsjt1.F +++ b/wsjt1.F @@ -90,7 +90,7 @@ if(mode.eq.4 .and. jz.gt.330750) jz=330750 !### Fix this! sum=0. - do j=1,jz !Convert raw data from byte to real, remove DC + do j=1,jz !Convert raw data from i*2 to real, remove DC dat(j)=0.1*d(j) sum=sum + dat(j) enddo @@ -112,6 +112,21 @@ endif + if(ndiag.ne.0 .and. nclip.lt.0) then +C Intentionally degrade SNR by -nclip dB. + sq=0. + do i=1,jz + sq=sq + dat(i)**2 + enddo + p0=sq/jz + p1=p0*10.0**(-0.1*nclip) + dnoise=sqrt(p1-p0) + idum=-1 + do i=1,jz + dat(i)=dat(i) + dnoise*gran(idum) + enddo + endif + if(mode.ne.2 .and. nzap.ne.0) then if(jz.gt.100000) call avesp2(dat,jz,2,f0a,NFreeze,MouseDF, + DFTolerance,fzap) @@ -306,3 +321,4 @@ C Now the multi-tone decoding return end +