RectGrid.approx_contains

RectGrid.approx_contains(self, other, atol)[source]

Test if other belongs to this grid up to a tolerance.

Parameters
otherarray-like or float

The object to test for membership in this grid

atolfloat

Allow deviations up to this number in absolute value per vector entry.

Examples

>>> g = RectGrid([0, 1], [-1, 0, 2])
>>> g.approx_contains([0, 0], atol=0.0)
True
>>> [0, 0] in g  # equivalent
True
>>> g.approx_contains([0.1, -0.1], atol=0.0)
False
>>> g.approx_contains([0.1, -0.1], atol=0.15)
True