From 30880699be91f0abf32e169b860192dbdf352e24 Mon Sep 17 00:00:00 2001 From: Walter Simson Date: Tue, 19 Nov 2024 15:16:40 -0800 Subject: [PATCH] convert uint to unsigned int to allow negative indexing instead of wraparound with unsinged ints --- kwave/utils/matlab.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kwave/utils/matlab.py b/kwave/utils/matlab.py index 2a426f40..dd44ca51 100644 --- a/kwave/utils/matlab.py +++ b/kwave/utils/matlab.py @@ -90,6 +90,9 @@ def matlab_mask(arr: np.ndarray, mask: np.ndarray, diff: Optional[int] = None) - """ + if mask.dtype == "uint8": + mask = mask.dtype("int8") + if diff is None: flat_mask = mask.ravel(order="F") else: