Skip to content

Commit

Permalink
more handling of divisions
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-eyes committed Oct 28, 2024
1 parent b0cb3b6 commit fe02979
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/snipe/api/snipe_sig.py
Original file line number Diff line number Diff line change
Expand Up @@ -1450,8 +1450,10 @@ def total_abundance(self) -> int:
"""
self._validate_abundance_operation(None, "calculate total abundance")

total = int(np.sum(self._abundances))
self.logger.debug("Total abundance: %d", total)
total = self.total_abundance
if total == 0:
self.logger.error("Total abundance is zero, which may lead to division by zero.")
raise ZeroDivisionError("Total abundance is zero.")
return total

@property
Expand Down

0 comments on commit fe02979

Please sign in to comment.