Skip to content

Commit

Permalink
cached computed Graphicle.final #174
Browse files Browse the repository at this point in the history
  • Loading branch information
jacanchaplais committed Mar 1, 2024
1 parent 6402157 commit 1871a6a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion graphicle/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2748,11 +2748,16 @@ def hard_mask(self) -> MaskGroup:
"""
return self.particles.status.hard_mask

@property
@fn.cached_property
def final(self) -> MaskArray:
"""Boolean array indicating final state in particle set."""
data = self.particles.final
if (not data) and self.adj:
warnings.warn(
"Explicit final mask missing. Computing from adjacency. "
"This result will be cached for the Graphicle object, but not "
"the underlying ParticleSet."
)
return self.adj.leaves
return data

Expand Down

0 comments on commit 1871a6a

Please sign in to comment.