from_align_vectors#
- classmethod Orientation.from_align_vectors(other: Miller, initial: Vector3d, weights: Optional[ndarray] = None, return_rmsd: bool = False, return_sensitivity: bool = False) Union[Orientation, Tuple[Orientation, float], Tuple[Orientation, ndarray], Tuple[Orientation, float, ndarray]][source]#
Return an estimated orientation to optimally align vectors in the crystal and sample reference frames.
This method wraps
align_vectors(). See that method for further explanations of parameters and returns.- Parameters:
- other
Crystal directions of shape
(n,)in the crystal reference frame.- initial
Sample directions of shape
(n,)in the sample reference frame.- weights
Relative importance of the different vectors.
- return_rmsd
Whether to return the (weighted) root mean square distance between
otherandinitialafter alignment. Default isFalse.- return_sensitivity
Whether to return the sensitivity matrix. Default is
False.
- Returns:
estimated_orientationBest estimate of the orientation that transforms
initialtoother. The symmetry of the orientation is inferred from the point group of the phase ofother, if given.rmsdReturned when
return_rmsd=True.sensitivityReturned when
return_sensitivity=True.
- Raises:
ValueErrorIf
otheris not a Miller instance.
Examples
>>> from orix.quaternion import Orientation >>> from orix.vector import Vector3d, Miller >>> from orix.crystal_map import Phase >>> uvw = Miller(uvw=[[0, 1, 0], [1, 0, 0]], phase=Phase(point_group="m-3m")) >>> v_sample = Vector3d([[0, -1, 0], [0, 0, 1]]) >>> ori = Orientation.from_align_vectors(uvw, v_sample) >>> ori * v_sample Vector3d (2,) [[0. 1. 0.] [1. 0. 0.]]