Skip to content

Commit

Permalink
fix divide by zero warning (#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
rieder committed Jul 6, 2023
1 parent 22122f8 commit f9b21bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/amuse/ic/brokenimf.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def calculate_fraction_per_bin(self):

result.append(factor)
total = sum(result, 0.0)
return numpy.array(result)/total
return numpy.array(result)/total if bool(total) else numpy.array(result)

def mass_mean(self):
result = 0 | units.MSun
Expand Down

0 comments on commit f9b21bf

Please sign in to comment.