WSJT-X/lib/pctile.f90
Joe Taylor 6479dce52a Add control of decoding "depth".
Improve the way pctile gets an estimate of array median.
Put info for mettab() into a data statement.
Attempt decoding near all freqs that give sync >= 1.0
Remove killbyname


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2707 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2012-10-31 18:33:56 +00:00

43 lines
623 B
Fortran

subroutine pctile(x,npts,npct,xmedian)
real x(npts)
integer hist(0:1000)
if(npts.le.0) then
xmedian=1.0
go to 900
endif
ave=sum(x)/npts
s=0.
ns=0
do i=1,npts
if(x(i).lt.3.0*ave) then
s=s+x(i)
ns=ns+1
endif
enddo
ave=s/ns
hist=0
do i=1,npts
j=nint(100.0*x(i)/ave)
if(j.lt.0) j=0
if(j.gt.1000) j=1000
hist(j)=hist(j)+1
enddo
nsum=0
ntest=nint(npts*float(npct)/100.0)
do j=0,1000
nsum=nsum+hist(j)
if(nsum.ge.ntest) exit
enddo
xmedian=j*ave/100.0
if(j.lt.10) xmedian=1.0
900 continue
return
end subroutine pctile