scipp.identical#

scipp.identical(x, y, *, equal_nan=False)#

Full comparison of x and y.

Parameters:
  • x (VariableLike) – Left input.

  • y (VariableLike) – Right input.

  • equal_nan (bool, default: False) – If true, non-finite values at the same index in (x, y) are treated as equal. Signbit must match for infs.

Returns:

bool – True if x and y have identical values, variances, dtypes, units, dims, shapes, coords, and masks. Else False.

Examples

Compare two identical arrays:

>>> import scipp as sc
>>> x = sc.array(dims=['x'], values=[1.0, 2.0, 3.0], unit='m')
>>> y = sc.array(dims=['x'], values=[1.0, 2.0, 3.0], unit='m')
>>> sc.identical(x, y)
True

Arrays with different units are not identical:

>>> z = sc.array(dims=['x'], values=[1.0, 2.0, 3.0], unit='cm')
>>> sc.identical(x, z)
False