This is a pre-release version (latest).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy latest / scipy / spatial / transform / _rigid_transform / RigidTransform / __getitem__

function

scipy.spatial.transform._rigid_transform:RigidTransform.__getitem__

source: build-install/usr/lib/python3.14/site-packages/scipy/spatial/transform/_rigid_transform.py:1336

Signature

def __getitem__(self, indexer: int | slice | EllipsisType | None | ArrayLike) → RigidTransform

Summary

Extract transform(s) at given index(es) from this object.

Extended Summary

Creates a new RigidTransform instance containing a subset of transforms stored in this object.

Parameters

indexer : int or slice or array_like

Specifies which transform(s) to extract. A single indexer must be specified, i.e. as if indexing a 1 dimensional array or list.

Returns

transform : `RigidTransform` instance

Contains

  • a single transform, if indexer is a single index

  • a stack of transform(s), if indexer is a slice, or an index array.

Raises

: TypeError

If the transform is a single transform.

Examples

from scipy.spatial.transform import RigidTransform as Tf
t = [[0, 0, 0], [1, 0, 0], [2, 0, 0]]  # 3 translations
tf = Tf.from_translation(t)
✓
A single index returns a single transform:
tf[0].as_matrix()
✓
array([[1., 0., 0., 0.],
       [0., 1., 0., 0.],
       [0., 0., 1., 0.],
       [0., 0., 0., 1.]])
A slice returns a stack of transforms:
tf[1:3].translation
✓
array([[1., 0., 0.],
       [2., 0., 0.]])
An index array returns a stack of transforms:
tf[[0, 2]].translation
✓
array([[0., 0., 0.],
       [2., 0., 0.]])

Aliases

  • scipy.spatial.transform.RigidTransform.__getitem__