Skip to content

Support for numpy.allclose #978

@SimonBoothroyd

Description

@SimonBoothroyd

It seems pint > 0.10 loses support for numpy.allclose. Running

from pint import Unit
import numpy as np

x = np.array([1, 2, 3]) * Unit("kelvin")
np.allclose(x, x)

yields

TypeError: no implementation found for 'numpy.allclose' on types that implement __array_function__: [<class 'pint.quantity.build_quantity_class.<locals>.Quantity'>]

I'm guessing this was just missed by #905? Happy to submit a PR / test if this is the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions