stack

Contents

stack#

class saiunit.math.stack(arrays, axis=0, dtype=None, **kwargs)#

Join a sequence of quantities or arrays along a new axis.

Parameters:
  • arrays (Union[Sequence[Array | ndarray | number | bool], Sequence[saiunit.Quantity]]) – The arrays must have the same shape.

  • axis (int) – The axis in the result array along which the input arrays are stacked.

  • dtype (Union[str, type[Any], dtype, SupportsDType, None]) – If provided, the concatenation will be done using this dtype. Otherwise, the array with the highest precision will be used.

Returns:

res – The stacked array has one more dimension than the input arrays.

Return type:

Union[Array, saiunit.Quantity]

Examples

>>> import saiunit as u
>>> a = [1, 2, 3] * u.second
>>> b = [4, 5, 6] * u.second
>>> u.math.stack([a, b])