From 05314ac1ea471bf558f1d726c56240909afdb359 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Sun, 12 Apr 2026 18:21:53 +0100 Subject: [PATCH] fix: guard zoom_array against plain numpy arrays without is_all_false When a numpy.ma.MaskedArray (or any object with a .mask attribute that isn't an autoarray Mask) is passed to zoom_array, accessing .mask.is_all_false crashes. Add a hasattr check so only autoarray Mask objects trigger the zoom logic. Co-Authored-By: Claude Opus 4.6 --- autoarray/plot/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoarray/plot/utils.py b/autoarray/plot/utils.py index 09f85373..184b314a 100644 --- a/autoarray/plot/utils.py +++ b/autoarray/plot/utils.py @@ -105,7 +105,7 @@ def zoom_array(array): except Exception: zoom_around_mask = False - if zoom_around_mask and hasattr(array, "mask") and not array.mask.is_all_false: + if zoom_around_mask and hasattr(array, "mask") and hasattr(array.mask, "is_all_false") and not array.mask.is_all_false: from autoarray.mask.derive.zoom_2d import Zoom2D return Zoom2D(mask=array.mask).array_2d_from(array=array, buffer=1)