larray.Axis.iscompatible

Axis.iscompatible(other) bool[source]

Check if this axis is compatible with another axis.

  • two axes are compatible if they have compatible names and labels

  • names are compatible if they are the same or missing

  • non-wildcard labels are compatible if they are the same

  • 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