from_scipy_rotation#

classmethod Rotation.from_scipy_rotation(rotation: Rotation) Rotation[source]#

Return rotations(s) from scipy.spatial.transform.Rotation.

Parameters:
rotation

SciPy rotation(s).

Returns:
rotation_out

Rotation(s).

Notes

The SciPy rotation is inverted to be consistent with the orix framework of passive rotations.

While orix represents quaternions with the scalar as the first parameter, SciPy has the scalar as the last parameter.

Examples

SciPy and orix rotate vectors differently since the SciPy rotation is inverted when creating an orix rotation

>>> from orix.quaternion import Rotation
>>> from orix.vector import Vector3d
>>> from scipy.spatial.transform import Rotation as SciPyRotation
>>> r_scipy = SciPyRotation.from_euler("ZXZ", [90, 0, 0], degrees=True)
>>> r_orix = Rotation.from_scipy_rotation(r_scipy)
>>> v = [1, 1, 0]
>>> r_scipy.apply(v)
array([-1.,  1.,  0.])
>>> r_orix * Vector3d(v)
Vector3d (1,)
[[ 1. -1.  0.]]
>>> ~r_orix * Vector3d(v)
Vector3d (1,)
[[-1.  1.  0.]]