code snippet: assert all close or large
April 2015
6:27 p.m.
Sorry, hit the wrong key just an example that I think is not covered by numpy.testing assert absolute tolerance for `inf`: "assert x and y are allclose or x is large if y is inf" On Thu, Apr 30, 2015 at 2:24 PM, <josef.pktd@gmail.com> wrote:
def assert_allclose_large(x, y, rtol=1e-6, atol=0, ltol=1e30): """ assert x and y are allclose or x is large if y is inf """ mask_inf = np.isinf(y) & ~np.isinf(x) assert_allclose(x[~mask_inf], y[~mask_inf], rtol=rtol, atol=atol) assert_array_less(ltol, x[mask_inf]) Josef
3550
Age (days ago)
3550
Last active (days ago)
1 comments
1 participants
participants (1)
-
josef.pktd@gmail.com