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