scipp.spatial.linear_transform#

scipp.spatial.linear_transform(*, unit=Unit(1), value)#

Constructs a zero dimensional Variable holding a single 3x3 matrix.

Parameters:
Returns:

Variable – A scalar variable of dtype linear_transform3.

See also

scipp.spatial.linear_transforms

Create multiple linear transformations.

Examples

Create an identity transformation:

>>> import numpy as np
>>> import scipp as sc
>>> identity = sc.spatial.linear_transform(value=np.identity(3))
>>> identity
<scipp.Variable> ()  linear_transform3  [dimensionless]  ((1, 0, 0), , (0, 1, 0), , (0, 0, 1), )

Create a rotation matrix (90 degrees around z-axis):

>>> rot_matrix = np.array([[0, -1, 0], [1, 0, 0], [0, 0, 1]])
>>> linear_rot = sc.spatial.linear_transform(value=rot_matrix)
>>> linear_rot
<scipp.Variable> ()  linear_transform3  [dimensionless]  ((0, -1, 0), , (1, 0, 0), , (0, 0, 1), )