Skip to content

Commit

Permalink
fix: guard against divison by 0 (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
carrascomj authored Oct 27, 2020
1 parent 0770669 commit ad372e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cameo/flux_analysis/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,9 +637,9 @@ def mass_yield(self):
try:
source, source_flux = single_flux(self.source, consumption=True)
product, product_flux = single_flux(self.product_reaction, consumption=False)
except ValueError:
mol_prod_mol_src = product_flux / source_flux
except (ValueError, ZeroDivisionError):
return numpy.nan
mol_prod_mol_src = product_flux / source_flux
return (mol_prod_mol_src * product.formula_weight) / source.formula_weight

def __call__(self, points):
Expand Down

0 comments on commit ad372e0

Please sign in to comment.