Skip to content

Delay mask evaluation more#91

Merged
kyleaoman merged 14 commits intomainfrom
streamline_lazymask
Apr 7, 2026
Merged

Delay mask evaluation more#91
kyleaoman merged 14 commits intomainfrom
streamline_lazymask

Conversation

@kyleaoman
Copy link
Copy Markdown
Member

@kyleaoman kyleaoman commented Apr 4, 2026

This PR (re-)streamlines accessing the mask attribute of a LazyMask so that it no longer requires an argument and can be a @property. It then adds features in masks.py to allow lazily combining two MaskCollections via lazy merging of LazyMasks, and significantly reduces the number of references to SWIFTGalaxy objects that we need to keep around attached to masks. LazyMask and MaskCollection now mostly don't need to know about SWIFTGalaxy, except to retrieve a particle count from the metadata when combining masks, which now just asks for the relevant SWIFTGalaxy at the relevant time.

Tests have been fleshed out and confirm that we can now delay evaluating masks (and therefore reading any data needed to evaluate them) indefinitely - only when a data read of the relevant particle type is triggered is the mask actually evaluated. Previously we could trigger reading data to evaluate masks for all types when applying a second mask because the masks could not be combined lazily. The implementation is also such that we don't end up with an insane function stack when we combine masks, just a chain of masks applied to np.arange(num_part).

Closes #79

@kyleaoman kyleaoman self-assigned this Apr 4, 2026
@kyleaoman kyleaoman added the enhancement New feature or request label Apr 4, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9a4eb5a) to head (258a1dd).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #91   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines         2287      2319   +32     
  Branches       261       261           
=========================================
+ Hits          2287      2319   +32     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kyleaoman kyleaoman merged commit 62a0226 into main Apr 7, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mask evaluation can be further delayed

1 participant