cf.List.allclose

List.allclose(y, atol=None, rtol=None)[source]

Test whether all data are element-wise equal to other, broadcastable data.

Two real numbers x and y are considered equal if |x-y|<=atol+rtol|y|, where atol (the tolerance on absolute differences) and rtol (the tolerance on relative differences) are positive, typically very small numbers. See the atol and rtol parameters.

See also

all, any, isclose

Parameters
y:

The object to be compared with the data array. y must be broadcastable to the data array and if y has units then they must be compatible. May be any object that can be converted to a Data object (which includes numpy array and Data objects).

atol: float, optional

The tolerance on absolute differences between real numbers. The default value is set by the atol function.

rtol: float, optional

The tolerance on relative differences between real numbers. The default value is set by the rtol function.

Returns
bool

Returns True if the data are equal within the given tolerance; False otherwise.

Examples

>>> x = f.allclose(g)