scipy.spatial.transform.RigidTransform.
__len__#
- RigidTransform.__len__()[source]#
Return the length of the leading transform dimension.
A transform can store an N-dimensional array of transforms. The length is the size of the first dimension of this array. If the transform is a single transform, the length is not defined and an error is raised.
- Returns:
- lengthint
The number of transforms in this object.
- Raises:
- TypeError
If the transform is a single transform.
Examples
>>> from scipy.spatial.transform import RigidTransform as Tf >>> import numpy as np >>> tf = Tf.identity(3) >>> len(tf) 3
An N-dimensional array of transforms returns its first dimension size:
>>> t = np.ones((5, 2, 3, 1, 3)) >>> tf = Tf.from_translation(t) >>> len(tf) 5
A single transform has no length:
>>> tf = Tf.from_translation([1, 0, 0]) >>> len(tf) Traceback (most recent call last): ... TypeError: Single transform has no len().