coords.Coords.concatenate#
- classmethod Coords.concatenate(L, axis=0)#
Concatenate a list of
Coordsobjects.Class method to concatenate a list of Coords along the given axis.
Parameters#
- L: list of Coords objects
The Coords objects to be concatenated. All should have the same shape except for the length of the specified axis.
Returns#
- Coords
A Coords with at least two dimensions, even when the list contains only a single Coords with a single point, or is empty.
Raises#
- ValueError
If the shape of the Coords in the list do not match or if concatenation along the last axis is attempted.
Notes#
This is a class method. It is commonly invoked as
Coords.concatenate, and if used as a method on a Coords object, that object will not be included in the list.It is like
numpy.concatenate()(which it uses internally), but makes sure to returnCoordsobject, and sets the first axis as default instead of the last (which would not make sense).See Also#
append(): append a Coords to self
Examples#
>>> X = Coords([1.,1.,0.]) >>> Y = Coords([[2.,2.,0.],[3.,3.,0.]]) >>> print(Coords.concatenate([X,Y])) [[1. 1. 0.] [2. 2. 0.] [3. 3. 0.]] >>> print(Coords.concatenate([X,X])) [[1. 1. 0.] [1. 1. 0.]] >>> print(Coords.concatenate([X])) [[1. 1. 0.]] >>> print(Coords.concatenate([Y])) [[2. 2. 0.] [3. 3. 0.]] >>> print(X.concatenate([Y])) [[2. 2. 0.] [3. 3. 0.]] >>> Coords.concatenate([]) Coords([], shape=(0, 3)) >>> Coords.concatenate([[Y],[Y]],axis=1) Coords([[[2., 2., 0.], [3., 3., 0.], [2., 2., 0.], [3., 3., 0.]]])