Closed yangcht closed 4 years ago
huh, that's annoying... those are equal to 5 decimal places... you can try hacking the decimal=
to be a smaller value and see if that skips this issue.
Changing to decimal=1 seems not working. Python 3.7 is working fine though.
thanks. This is weird. I added this assertion step to make sure we don't end up in a non-self-consistent parameter state, but I don't understand why it's going wrong.
Hi @keflavich,
I think this is because numpy.testing.assert_almost_equal
is abs(desired-actual) < 1.5 * 10**(-decimal)
being abolute error not relative error.
https://numpy.org/doc/stable/reference/generated/numpy.testing.assert_almost_equal.html with both atol
and rtol
.
I think you wanted to use https://numpy.org/doc/stable/reference/generated/numpy.allclose.html instead. AssertionErorr
should not in principle be raised outside of [unit]tests. I think https://docs.python.org/3/library/exceptions.html?highlight=assertionerror#RuntimeError RuntimeError
or UserError
would suite the case better. It also might be a good idea to define your own error for this, something like
class PyRadexInconsistencyError(UserError, RuntimeError):
pass
if you want to explicitly raise an error here.
You're right, we want a relative tolerance here because these numbers are so huge.
@SmirnGreg you've solved the problem - could you submit it as a PR?
Hi there! I am trying to run pyradex under Python 3.8.3 (with numpy version 1.19.1). However, I encountered an error regarding the decimals. It seems like that there's something related numpy version?