fix: guard zoom_array against non-autoarray mask objects#270
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
zoom_arrayinautoarray/plot/utils.pyto handle objects that have a.maskattribute but aren't autoarrayMaskinstances (e.g.numpy.ma.MaskedArray). Previously, passing such an array would crash withAttributeError: 'numpy.ndarray' object has no attribute 'is_all_false'.This was the root cause of ~200 cascading failures in the Apr 10 release build — workspace simulator scripts that produce plain numpy arrays for plotting triggered this crash, which prevented dataset generation, which caused all downstream scripts to fail with missing data.
Relates to #269.
API Changes
None — internal changes only.
Test Plan
test_autoarray/— 727 passedFull API Changes (for automation & release notes)
No public API changes. Internal guard added to
zoom_array()inautoarray/plot/utils.py.🤖 Generated with Claude Code