Skip to content

Commit

Permalink
Add default_factory to mutable data class default
Browse files Browse the repository at this point in the history
  • Loading branch information
fdeguire03 authored Jan 29, 2025
1 parent fd75275 commit fb5e014
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions suite2p/detection/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class ROI:
lam: np.ndarray
med: np.ndarray
do_crop: bool
rsort: np.ndarray = field(default=np.sort(distance_kernel(radius=30).flatten()),
repr=False)
rsort: np.ndarray = field(default_factory=lambda: np.sort(distance_kernel(radius=30).flatten()), repr=False)

def __post_init__(self):
"""Validate inputs."""
Expand Down

0 comments on commit fb5e014

Please sign in to comment.