From 993705d581015a8c7b12a63001d0957e1850b2e7 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 26 Feb 2024 17:15:37 -0500 Subject: [PATCH] Don't call peakup if we're too close to the edge. --- lib/superfox/sfox_sync.f90 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/superfox/sfox_sync.f90 b/lib/superfox/sfox_sync.f90 index 4768b1bb8..c20b341ff 100644 --- a/lib/superfox/sfox_sync.f90 +++ b/lib/superfox/sfox_sync.f90 @@ -95,10 +95,16 @@ subroutine sfox_sync(iwave,fsample,isync,f,t) ipeak=maxloc(ccf) ipk=ipeak(1)-1+ia jpk=ipeak(2)-1+lag1 - - call peakup(ccf(ipk-1,jpk),ccf(ipk,jpk),ccf(ipk+1,jpk),dxi) - call peakup(ccf(ipk,jpk-1),ccf(ipk,jpk),ccf(ipk,jpk+1),dxj) - + + dxi=0. + dxj=0. + if(ipk.gt.ia .and. ipk.lt.ib) then + call peakup(ccf(ipk-1,jpk),ccf(ipk,jpk),ccf(ipk+1,jpk),dxi) + endif + if(jpk.gt.lag1 .and. jpk.lt.lag2) then + call peakup(ccf(ipk,jpk-1),ccf(ipk,jpk),ccf(ipk,jpk+1),dxj) + endif + f=ibest*df + bw/2 + dxi*df t=lagbest*dtstep + dxj*dtstep ! write(*,4100) ibest,lagbest,f,dxi*df,t,dxj*dtstep