[BUG] check_mass_balance
fails for floating point coefficients
#1435
Labels
check_mass_balance
fails for floating point coefficients
#1435
Is there an existing issue for this?
Problem description
The
check_mass_balance
function for reactions gives an incorrect result for reactions with floating point coefficients.Specifically, scaling the coefficients by a float (like in the example below) returns a dictionary of near-zero values. A non-empty dictionary implies the reaction is unbalanced, when it's really just a floating-point error.
A simple fix is to filter out near-zero values with something like
numpy.isclose
.Code sample
Code run:
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: