nessai.utils.testing

Utilities for the test suite.

Module Contents

Classes

IntegrationTestModel

Complete nessai model for use with integration tests

Functions

assert_structured_arrays_equal(x, y[, atol, rtol])

Assert structured arrays are equal.

class nessai.utils.testing.IntegrationTestModel(dims=2)

Bases: nessai.model.Model

Complete nessai model for use with integration tests

log_prior(x)

Returns log-prior, must be defined by the user.

log_likelihood(x)

Returns the log-likelihood, must be defined by the user.

to_unit_hypercube(x)

Map from the prior space to the unit hypercube.

Not implemented by default.

from_unit_hypercube(x)

Map from the unit hypercube to the priors.

Not implemented by default.

nessai.utils.testing.assert_structured_arrays_equal(x, y, atol=0.0, rtol=0.0)

Assert structured arrays are equal.

Supports NaNs by checking each field individually.

Parameters:
xnp.ndarray

Array to check.

ynp.ndarray

Array to compare to.

atolfloat

The absolute tolerance parameter. See the numpy documentation for all numpy.allclose.

rtolfloat

The relative tolerance parameter. See the numpy documentation for all numpy.allclose.

Raises:
AssertionError

If dtype or values in each field are not equal.