Avoid making object arrays for mask in cubeviz to speed up loading large cubes#3787
Merged
Merged
Conversation
a635d60 to
5896970
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3787 +/- ##
==========================================
- Coverage 86.52% 86.52% -0.01%
==========================================
Files 180 180
Lines 24706 24708 +2
==========================================
+ Hits 21377 21378 +1
- Misses 3329 3330 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kecnry
approved these changes
Sep 17, 2025
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.
Description
Before this PR, if the mask was None as returned by the
NDData's.maskattribute,np.logical_orwas returning object arrays:Object arrays are very memory and CPU inefficient. This PR avoids this by only doing a logical OR if the original mask is not None. This speeds up the initial loading of large cubes into cubeviz by a factor of 3x on my machine (I tested this for a 3.4GB cube).
Change log entry
CHANGES.rst? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rstbefore merge. If no, maintainershould add a
no-changelog-entry-neededlabel.Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
triviallabel.cache-download.ymlworkflow?