Skip to content

Commit

Permalink
use min instead of comparison (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
brisvag authored Sep 6, 2024
1 parent 3ac64b1 commit 104cab9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/fidder/erase/sparse_local_mean.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ def estimate_local_mean(
# get a random set of foreground pixels for the background fit
foreground_sample_idx = np.argwhere(mask == 1)

if n_background_samples := len(foreground_sample_idx) < n_samples_for_fit:
n_samples_for_fit = n_background_samples
n_samples_for_fit = min(n_samples_for_fit, len(foreground_sample_idx))
selection = np.random.choice(
foreground_sample_idx.shape[0], size=n_samples_for_fit, replace=False
)
Expand Down

0 comments on commit 104cab9

Please sign in to comment.