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) → RigidTransformSummary
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_likeSpecifies 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` instanceContains
a single transform, if
indexeris a single indexa stack of transform(s), if
indexeris a slice, or an index array.
Raises
: TypeErrorIf 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)✓
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__