2012-10-15 13:43:49 -04:00
|
|
|
subroutine redsync(ss,ntrperiod,ihsym,iz,red)
|
|
|
|
|
2013-04-22 11:43:02 -04:00
|
|
|
! Compute the red curve (approx JT9 sync amplitude).
|
|
|
|
! NB: red() is used for real-time display only. A better ccfred() is
|
|
|
|
! computed during the decode procedure.
|
|
|
|
|
2012-10-15 13:43:49 -04:00
|
|
|
Parameter (NSMAX=22000)
|
|
|
|
real*4 ss(184,NSMAX)
|
|
|
|
real*4 red(NSMAX)
|
2012-10-22 15:18:24 -04:00
|
|
|
include 'jt9sync.f90'
|
2012-10-15 13:43:49 -04:00
|
|
|
|
|
|
|
lagmax=9
|
|
|
|
if(ntrperiod.eq.2) lagmax=5
|
|
|
|
if(ntrperiod.eq.5) lagmax=2
|
|
|
|
if(ntrperiod.eq.10) lagmax=1
|
|
|
|
if(ntrperiod.eq.30) lagmax=1
|
|
|
|
|
2013-04-22 11:43:02 -04:00
|
|
|
do i=1,iz !Loop over frequency range
|
2012-10-15 13:43:49 -04:00
|
|
|
smax=0.
|
2013-04-22 11:43:02 -04:00
|
|
|
do lag=-lagmax,lagmax !Loop over DT lags
|
2012-10-15 13:43:49 -04:00
|
|
|
sig=0.
|
|
|
|
do j=1,16
|
2012-10-22 15:18:24 -04:00
|
|
|
k=ii2(j)+lag
|
2012-11-14 12:02:54 -05:00
|
|
|
if(k.ge.5 .and. k.le.ihsym) then
|
|
|
|
sig=sig + ss(k,i) - 0.5*(ss(k-2,i)+ss(k-4,i))
|
2012-10-15 13:43:49 -04:00
|
|
|
endif
|
|
|
|
enddo
|
2012-11-14 12:02:54 -05:00
|
|
|
if(sig.gt.smax) smax=sig
|
2012-10-15 13:43:49 -04:00
|
|
|
enddo
|
2012-10-22 15:28:47 -04:00
|
|
|
red(i)=smax
|
2012-10-15 13:43:49 -04:00
|
|
|
enddo
|
2013-04-03 17:32:21 -04:00
|
|
|
call pctile(red,iz,40,xmed)
|
2012-11-14 12:02:54 -05:00
|
|
|
if(xmed.le.0.0) xmed=1.0
|
|
|
|
red=red/xmed
|
2012-11-14 12:17:02 -05:00
|
|
|
smax=0.
|
|
|
|
do i=1,iz
|
2012-11-19 18:46:44 -05:00
|
|
|
red(i)=0.2*db(red(i))
|
2012-11-14 12:17:02 -05:00
|
|
|
smax=max(smax,red(i))
|
|
|
|
enddo
|
2012-11-14 13:19:36 -05:00
|
|
|
h=10.
|
2012-11-14 12:17:02 -05:00
|
|
|
if(smax.gt.h) red=red*(h/smax)
|
2012-10-15 13:43:49 -04:00
|
|
|
|
|
|
|
return
|
|
|
|
end subroutine redsync
|