scipp.any#
- scipp.any(x, dim=None)#
Logical OR over input values.
- Parameters:
x (
scipp.typing.VariableLike) – Input data.dim (
Union[str,Iterable[str],None], default:None) – Dimension(s) along which to calculate the OR. If not given, the OR over all dimensions is calculated.
- Returns:
TypeVar(VariableLikeType,Variable,DataArray,Dataset,DataGroup[Any]) – A variable containingTrueif any input values (along the given dimension) areTrue.
See also
scipp.allLogical AND.
Examples
>>> import scipp as sc >>> x = sc.array(dims=['x'], values=[False, False, False]) >>> sc.any(x) <scipp.Variable> () bool <no unit> False >>> y = sc.array(dims=['x'], values=[False, True, False]) >>> sc.any(y) <scipp.Variable> () bool <no unit> True
Along a dimension:
>>> x = sc.array(dims=['x', 'y'], values=[[False, True], [False, False]]) >>> sc.any(x, 'y') <scipp.Variable> (x: 2) bool <no unit> [True, False]