from_align_vectors#

classmethod Rotation.from_align_vectors(other: , initial: , weights: = None, return_rmsd: bool = False, return_sensitivity: bool = False) [source]#

Estimate a quaternion to optimally align two sets of vectors.

This method wraps align_vectors(). See that method for further explanations of parameters and returns.

Parameters:
other

Vectors of shape (n,) in the other reference frame.

initial

Vectors of shape (n,) in the initial reference frame.

weights

Relative importance of the different vectors.

return_rmsd

Whether to return the (weighted) root mean square distance between other and initial after alignment. Default is False.

return_sensitivity

Whether to return the sensitivity matrix. Default is False.

Returns:
estimated_quaternion

Best estimate of the quaternion that transforms initial to other.

rmsd

Returned when return_rmsd=True.

sensitivity

Returned when return_sensitivity=True.

Examples

>>> from orix.quaternion import Quaternion
>>> from orix.vector import Vector3d
>>> v1 = Vector3d([[1, 0, 0], [0, 1, 0]])
>>> v2 = Vector3d([[0, -1, 0], [0, 0, 1]])
>>> Q12 = Quaternion.from_align_vectors(v2, v1)
>>> Q12 * v1
Vector3d (2,)
[[ 0. -1.  0.]
[ 0.  0.  1.]]
>>> Q21, dist = Quaternion.from_align_vectors(v1, v2, return_rmsd=True)
>>> dist
0.0
>>> Q21 * v2
Vector3d (2,)
[[1. 0. 0.]
[0. 1. 0.]]


Examples using Rotation.from_align_vectors#

Misorientation from aligning directions

Misorientation from aligning directions

Orientation from aligning directions

Orientation from aligning directions

Rotating z-vector to high-symmetry crystal directions

Rotating z-vector to high-symmetry crystal directions