bundles / scipy 1.17.1 / scipy / spatial / transform / _rotation / Rotation / concatenate
staticmethod
scipy.spatial.transform._rotation:Rotation.concatenate
Signature
def concatenate ( rotations : Rotation | Iterable[Rotation] ) → Rotation Summary
Concatenate a sequence of Rotation objects into a single object.
Extended Summary
This is useful if you want to, for example, take the mean of a set of rotations and need to pack them into a single object to do so.
Parameters
rotations: sequence of `Rotation` objectsThe rotations to concatenate. If a single Rotation object is passed in, a copy is returned.
Returns
concatenated: `Rotation` instanceThe concatenated rotations.
Notes
Array API Standard Support
concatenate has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.
==================== ==================== ==================== Library CPU GPU ==================== ==================== ==================== NumPy ✅ n/a CuPy n/a ✅ PyTorch ✅ ✅ JAX ✅ ✅ Dask ⛔ n/a ==================== ==================== ====================
See
dev-arrayapifor more information.
Examples
from scipy.spatial.transform import Rotation as R r1 = R.from_rotvec([0, 0, 1]) r2 = R.from_rotvec([0, 0, 2]) rc = R.concatenate([r1, r2]) rc.as_rotvec()✓
rc.mean().as_rotvec()
✗rs = [r for r in rc] R.concatenate(rs).as_rotvec()✓
R.from_rotvec([[0, 0, 1], [0, 0, 2]]).as_rotvec()
✓Aliases
-
scipy.spatial.transform.Rotation.concatenate