larray.AxisCollection.align
- AxisCollection.align(*other, join='outer', axes=None) Tuple[AxisCollection][source]
Align this AxisCollection with (an)other AxisCollection(s).
This ensures all common axes are compatible.
- Parameters:
- *otherAxisCollection
AxisCollection(s) to align with this one.
- join{‘outer’, ‘inner’, ‘left’, ‘right’, ‘exact’}, optional
Defaults to ‘outer’.
- axesAxisReference or sequence of them, optional
Axes to align. Need to be valid in all axis collections. Defaults to None (all common axes). This must be specified when mixing anonymous and non-anonymous axes.
- Returns:
- tuple of AxisCollection
Aligned collections
See also
Examples
>>> col1 = AxisCollection("a=a0..a1;b=b0..b2") >>> col1 AxisCollection([ Axis(['a0', 'a1'], 'a'), Axis(['b0', 'b1', 'b2'], 'b') ]) >>> col2 = AxisCollection("a=a0..a2;c=c0..c0;b=b0..b1") >>> col2 AxisCollection([ Axis(['a0', 'a1', 'a2'], 'a'), Axis(['c0'], 'c'), Axis(['b0', 'b1'], 'b') ]) >>> aligned1, aligned2 = col1.align(col2) >>> aligned1 AxisCollection([ Axis(['a0', 'a1', 'a2'], 'a'), Axis(['b0', 'b1', 'b2'], 'b') ]) >>> aligned2 AxisCollection([ Axis(['a0', 'a1', 'a2'], 'a'), Axis(['c0'], 'c'), Axis(['b0', 'b1', 'b2'], 'b') ])
Using anonymous axes
>>> col1 = AxisCollection("a0..a1;b0..b2") >>> col1 AxisCollection([ Axis(['a0', 'a1'], None), Axis(['b0', 'b1', 'b2'], None) ]) >>> col2 = AxisCollection("a0..a2;b0..b1;c0..c0") >>> col2 AxisCollection([ Axis(['a0', 'a1', 'a2'], None), Axis(['b0', 'b1'], None), Axis(['c0'], None) ]) >>> aligned1, aligned2 = col1.align(col2) >>> aligned1 AxisCollection([ Axis(['a0', 'a1', 'a2'], None), Axis(['b0', 'b1', 'b2'], None) ]) >>> aligned2 AxisCollection([ Axis(['a0', 'a1', 'a2'], None), Axis(['b0', 'b1', 'b2'], None), Axis(['c0'], None) ])