Skip to content

Commit

Permalink
Fix ZeroDivisionError
Browse files Browse the repository at this point in the history
When there are no fusion events at all, FuMa crashes because the progress is
calculated relative to the total number of fusion events.

This fixes issue yhoogstrate#43
  • Loading branch information
Redmar-van-den-Berg committed Jun 11, 2020
1 parent dac3af2 commit 31b1480
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fuma/ComparisonTriangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ def prune_duplicates(self,merged_fusions):

def log_progress(self,n_total, passed, previous_percentage):
# Print percentage - doesn't entirely fit yet
percentage = 100.0 * (float(passed) / float(n_total))
try:
percentage = 100.0 * (float(passed) / float(n_total))
except ZeroDivisionError:
percentage = 100.0
if percentage >= previous_percentage + 5.0 or passed == n_total:# Repport each 5%
self.logger.debug(str(round(percentage,1))+"% completed")
previous_percentage = percentage
Expand Down

0 comments on commit 31b1480

Please sign in to comment.