Skip to content

Commit 05314ac

Browse files
Jammy2211claude
authored andcommitted
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 <noreply@anthropic.com>
1 parent 78d06fd commit 05314ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

autoarray/plot/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def zoom_array(array):
105105
except Exception:
106106
zoom_around_mask = False
107107

108-
if zoom_around_mask and hasattr(array, "mask") and not array.mask.is_all_false:
108+
if zoom_around_mask and hasattr(array, "mask") and hasattr(array.mask, "is_all_false") and not array.mask.is_all_false:
109109
from autoarray.mask.derive.zoom_2d import Zoom2D
110110

111111
return Zoom2D(mask=array.mask).array_2d_from(array=array, buffer=1)

0 commit comments

Comments
 (0)