You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
715 B
Python
32 lines
715 B
Python
from typing import Any
|
|
|
|
import numpy
|
|
from numpy.typing import NDArray
|
|
|
|
|
|
PRNG = numpy.random.RandomState(12345)
|
|
|
|
|
|
def assert_fields_close(
|
|
x: NDArray,
|
|
y: NDArray,
|
|
*args: Any,
|
|
**kwargs: Any,
|
|
) -> None:
|
|
numpy.testing.assert_allclose(
|
|
x, y, verbose=False, # type: ignore
|
|
err_msg='Fields did not match:\n{}\n{}'.format(numpy.moveaxis(x, -1, 0),
|
|
numpy.moveaxis(y, -1, 0)),
|
|
*args,
|
|
**kwargs,
|
|
)
|
|
|
|
def assert_close(
|
|
x: NDArray,
|
|
y: NDArray,
|
|
*args: Any,
|
|
**kwargs: Any,
|
|
) -> None:
|
|
numpy.testing.assert_allclose(x, y, *args, **kwargs)
|
|
|