From 65eb0cfb0269eb80ce0d3a26f03725fc891977c0 Mon Sep 17 00:00:00 2001 From: FMarmoreo Date: Thu, 18 Jul 2024 15:13:06 +0200 Subject: [PATCH] fix boundary conditions in phase_conv2d (#66) --- cobrawap/pipeline/utils/convolve.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cobrawap/pipeline/utils/convolve.py b/cobrawap/pipeline/utils/convolve.py index 2b5d850a..2d91fdc1 100644 --- a/cobrawap/pipeline/utils/convolve.py +++ b/cobrawap/pipeline/utils/convolve.py @@ -143,7 +143,7 @@ def phase_conv2d(frame, kernel, kernel_center=None): for di,dj in itertools.product(range(dx), range(dy)): # kernelsite != 0, framesite within borders and != nan - if k[di,dj] and i+di-ci < dimx and j+dj-cj < dimy \ + if k[di,dj] and 0 <= i+di-ci < dimx and 0 <= j+dj-cj < dimy \ and np.isfinite(frame[i+di-ci,j+dj-cj]): sign = -1*np.sign(k[di,dj]) # pos = clockwise from phase to frame[..]