From 22e45c24e6bb42464d5329ef888636aeb7906543 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 17 May 2017 13:30:32 +0000 Subject: [PATCH] Fix snr calculation; remove diagnostic write. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7683 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/fsk4hf/spec8.f90 | 8 ++++---- lib/fsk4hf/wspr_fsk8d.f90 | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/fsk4hf/spec8.f90 b/lib/fsk4hf/spec8.f90 index 3c984fa03..43fbc7ee2 100644 --- a/lib/fsk4hf/spec8.f90 +++ b/lib/fsk4hf/spec8.f90 @@ -22,10 +22,10 @@ subroutine spec8(c,s,savg) enddo s=s/NZ savg=savg/(NN*NZ) - do i=0,NH2 - write(31,3101) i*df,savg(i) -3101 format(f10.3,f12.3) - enddo +! do i=0,NH2 +! write(31,3101) i*df,savg(i) +!3101 format(f10.3,f12.3) +! enddo return end subroutine spec8 diff --git a/lib/fsk4hf/wspr_fsk8d.f90 b/lib/fsk4hf/wspr_fsk8d.f90 index 67fc809f3..0dbd7f10d 100644 --- a/lib/fsk4hf/wspr_fsk8d.f90 +++ b/lib/fsk4hf/wspr_fsk8d.f90 @@ -27,6 +27,7 @@ program wspr_fsk8d real s(0:NH2,NN) real savg(0:NH2) real ss(0:N7) + real ss0(0:N7) real ps(0:7) integer ihdr(11) integer*2 iwave(NMAX) !Generated full-length waveform @@ -100,7 +101,6 @@ program wspr_fsk8d call four2a(c1,2*N7,1,-1,1) call four2a(c2,2*N7,1,-1,1) do i=0,N7 - f=1500.0 + i*df1 p=1.e-9*(real(c1(i))**2 + aimag(c1(i))**2 + & real(c2(i))**2 + aimag(c2(i))**2) ss(i)=p @@ -110,15 +110,16 @@ program wspr_fsk8d jpk=j0 endif enddo + if(jpk.eq.j0) ss0=ss enddo f0=ipk*df1 xdt=jpk*dt - 1.0 - sp3n=(ss(ipk-1)+ss(ipk)+ss(ipk+1)) !Sig + 3*noise - call pctile(ss,N7,45,base) - psig=sp3n-3*base !Sig only - pnoise=(2500.0/df1)*base !Noise in 2500 Hz - xsnr=db(psig/pnoise) !SNR from sync tones + sp3n=(ss0(ipk-1)+ss0(ipk)+ss0(ipk+1)) !Sig + 3*noise + call pctile(ss0,N7,45,base) + psig=sp3n-3*base !Sig only + pnoise=(2500.0/df1)*base !Noise in 2500 Hz + xsnr=db(psig/pnoise) !SNR from sync tones if(jpk.ge.0) c(0:NMAXD-1-jpk)=c(jpk:NMAX-1)