Protect against possible bounds error in q65_sync.f90.

This commit is contained in:
Joe Taylor 2023-01-02 13:21:42 -05:00
parent dd243da82a
commit 53bbf4bf23

View File

@ -25,12 +25,14 @@ subroutine q65_sync(ss,i0,nts_q65,sync_ok,snr,xdt)
endif
m=nts_q65/2
i1=max(1,i0-m)
i2=min(NFFT,i0+m)
ccf=0.
do lag=0,LAGMAX !Search over range of DT
do j=1,22 !Test for Q65 sync
k=isync(j) + lag
ccf(lag)=ccf(lag) + sum(ss(k,i0-m:i0+m)) + sum(ss(k+1,i0-m:i0+m)) &
+ sum(ss(k+2,i0-m:i0+m))
ccf(lag)=ccf(lag) + sum(ss(k,i1:i2)) + sum(ss(k+1,i1:i2)) &
+ sum(ss(k+2,i1:i2))
! Q: Should we use weighted sums, perhaps a Lorentzian peak?
enddo
enddo