numpy.ma.allclose

numpy.ma.allclose(a, b, masked_equal=True, rtol=1.0000000000000001e-05, atol=1e-08, fill_value=None)

Returns True if two arrays are element-wise equal within a tolerance.

The tolerance values are positive, typically very small numbers. The relative difference (rtol * b) and the absolute difference (atol) are added together to compare against the absolute difference between a and b.

Parameters:

a, b : array_like

Input arrays to compare.

fill_value : boolean, optional

Whether masked values in a or b are considered equal (True) or not (False).

rtol : Relative tolerance

The relative difference is equal to rtol * b.

atol : Absolute tolerance

The absolute difference is equal to atol.

Returns:

y : bool

Returns True if the two arrays are equal within the given tolerance; False otherwise. If either array contains NaN, then False is returned.

See also

all, any, alltrue, sometrue

Notes

If the following equation is element-wise True, then allclose returns True.

absolute(a - b) <= (atol + rtol * absolute(b))

Return True if all elements of a and b are equal subject to given tolerances.

Previous topic

numpy.ma.allequal

Next topic

numpy.ma.apply_along_axis

This Page

Quick search