spectrochempy.concatenate
- concatenate(*datasets, **kwargs)[source][source]
Concatenation of
NDDataset
objects along a given axis.Any number of
NDDataset
objects can be concatenated (by default the last on the last dimension). For this operation to be defined the following must be true :all inputs must be valid
NDDataset
objects;units of data must be compatible
concatenation is along the axis specified or the last one;
along the non-concatenated dimensions, shapes must match.
- Parameters:
*datasets (positional
NDDataset
arguments) – The dataset(s) to be concatenated to the current dataset. The datasets must have the same shape, except in the dimension corresponding to axis (the last, by default).**kwargs – Optional keyword parameters (see Other Parameters).
- Returns:
out – A
NDDataset
created from the contenations of theNDDataset
input objects.- Other Parameters:
dims (str, optional, default=’x’) – The dimension along which the operation is applied.
axis (int, optional) – The axis along which the operation is applied.
Examples
>>> A = scp.read('irdata/nh4y-activation.spg', protocol='omnic') >>> B = scp.read('irdata/nh4y-activation.scp') >>> C = scp.concatenate(A[10:], B[3:5], A[:10], axis=0) >>> A[10:].shape, B[3:5].shape, A[:10].shape, C.shape ((45, 5549), (2, 5549), (10, 5549), (57, 5549))
or
>>> D = A.concatenate(B, B, axis=0) >>> A.shape, B.shape, D.shape ((55, 5549), (55, 5549), (165, 5549))
>>> E = A.concatenate(B, axis=1) >>> A.shape, B.shape, E.shape ((55, 5549), (55, 5549), (55, 11098))