Skip to content

Migrate to npt.assert_allclose #1175

Description

@seanlaw

According to the NumPy docs fornpt.assert_almost_equal:

It is recommended to use one of assert_allclose, assert_array_almost_equal_nulp or assert_array_max_ulp instead of this function for more consistent floating point comparisons.

Perhaps, we should migrate our tests accordingly?

To Do List

  • Each test file correctly replaces all uses of npt.assert_almost_equal with its equivalent npt.assert_allclose
  • When rtol=0 for npt.assert_allclose, simply omit this paramter and value since this is the default
  • Ensure that npt.assert_allclose(actual, desired) always has the stumpy computed value as "actual" and the naive computation as "desired"
  • Use atol=1.5e-07 rather than atol=1.5*10**-07
  • Eventually, replace the ugly 1.5*10**-config.STUMPY_TEST_PRECISION with config.STUMPY_TEST_PRECISION = 1.5e-07 (in config.py)
  • Replace comp with cmp
  • Rename naive outputs to ref_ and stumpy-computed outputs to cmp_ (applies to npt.assert_array_equal too)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions