Skip to content

Commit

Permalink
Guard against an empty list.
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Nov 16, 2023
1 parent ff9c05d commit 97801c5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion histomicstk/features/compute_morphometry_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ def boxcount(arr, k):
# Fit the successive log(sizes) with log (counts)
with warnings.catch_warnings():
warnings.simplefilter('ignore', np.RankWarning)
coeffs = np.polyfit(np.log(sizes), np.log(counts), 1)
try:
coeffs = np.polyfit(np.log(sizes), np.log(counts), 1)
except TypeError:
coeffs = [0]

return -coeffs[0]

0 comments on commit 97801c5

Please sign in to comment.