larray.Axis.iscompatible

Axis.iscompatible(self, other)[source]

Checks if self is compatible with another axis.

  • Two non-wildcard axes are compatible if they have the same name and labels.

  • A wildcard axis of length 1 is compatible with any other axis sharing the same name.

  • A wildcard axis of length > 1 is compatible with any axis of the same length or length 1 and sharing the same name.

Parameters
otherAxis

Axis to compare with.

Returns
bool

True if input axis is compatible with self, False otherwise.

Examples

>>> a10  = Axis(range(10), 'a')
>>> wa10 = Axis(10, 'a')
>>> wa1  = Axis(1, 'a')
>>> b10  = Axis(range(10), 'b')
>>> a10.iscompatible(b10)
False
>>> a10.iscompatible(wa10)
True
>>> a10.iscompatible(wa1)
True
>>> wa1.iscompatible(b10)
False