示例#1
0
def get_sample_fundamental(resolution=2, point_group=None, space_group=None):
    """
    Generates an equispaced grid of rotations within a fundamental zone.

    Parameters
    ----------
    resolution : float, optional
        The characteristic distance between a rotation and its neighbour (degrees)
    point_group : orix.quaternion.symmetry.Symmetry, optional
        One of the 11 proper point groups, defaults to None
    space_group: int, optional
        Between 1 and 231, defaults to None

    Returns
    -------
    q : orix.quaternion.rotation.Rotation
        Grid of rotations lying within the specified fundamental zone

    See Also
    --------
    orix.sampling.utils.uniform_SO3_sample

    Examples
    --------
    >>> from orix.quaternion.symmetry import C2,C4
    >>> grid = get_sample_fundamental(1, point_group=C2)
    """
    if point_group is None:
        point_group = get_point_group(space_group, proper=True)

    q = uniform_SO3_sample(resolution)
    fundamental_region = OrientationRegion.from_symmetry(point_group)
    return q[q < fundamental_region]
示例#2
0
def test_RotationPlot_methods():
    """ This code is lifted from demo-3-v0.1 """
    misori = Misorientation([1, 1, 1, 1])  # any will do
    fig = plt.figure(figsize=(6, 3))
    gridspec = plt.GridSpec(1, 1, left=0, right=1, bottom=0, top=1, hspace=0.05)
    ax_misori = fig.add_subplot(gridspec[0], projection='axangle', proj_type='ortho', aspect='equal')
    ax_misori.scatter(misori)
    ax_misori.plot(misori)
    ax_misori.plot_wireframe(OrientationRegion.from_symmetry(D6, D6))
    plt.close('all')

    # clear the edge case
    ax_misori.transform(np.asarray([1, 1, 1]))
    return None
示例#3
0
    def set_symmetry(self, Gl, Gr, verbose=False):
        """Assign symmetries to this misorientation.

        Computes equivalent transformations which have the smallest angle of
        rotation and assigns these in-place.

        Parameters
        ----------
        Gl, Gr : Symmetry

        Returns
        -------
        Misorientation
            A new misorientation object with the assigned symmetry.

        Examples
        --------
        >>> from orix.quaternion.symmetry import C4, C2
        >>> data = np.array([[0.5, 0.5, 0.5, 0.5], [0, 1, 0, 0]])
        >>> m = Misorientation(data).set_symmetry(C4, C2)
        >>> m
        Misorientation (2,) 4, 2
        [[-0.7071  0.     -0.7071  0.    ]
         [ 0.      0.7071 -0.7071  0.    ]]

        """
        symmetry_pairs = iproduct(Gl, Gr)
        if verbose:
            import tqdm

            symmetry_pairs = tqdm.tqdm(symmetry_pairs, total=Gl.size * Gr.size)
        orientation_region = OrientationRegion.from_symmetry(Gl, Gr)
        o_inside = self.__class__.identity(self.shape)
        outside = np.ones(self.shape, dtype=bool)
        for gl, gr in symmetry_pairs:
            o_transformed = gl * self[outside] * gr
            o_inside[outside] = o_transformed
            outside = ~(o_inside < orientation_region)
            if not np.any(outside):
                break
        o_inside._symmetry = (Gl, Gr)
        return o_inside
示例#4
0
def test_full_region_plot():
    empty = OrientationRegion.from_symmetry(C1, C1)
    _ = empty.get_plot_data()
示例#5
0
def test_coverage_on_faces():
    o = OrientationRegion(Orientation([1, 1, 1, 1]))
    f = o.faces()
    return None