예제 #1
0
def get_grid_streographic(crystal_system, resolution, equal='angle'):
    """
    Creates a rotation list by determining the beam directions within the symmetry reduced
    region of the inverse pole figure, corresponding to the specified crystal system, and
    combining this with rotations about the beam direction at a given resolution.

    Parameters
    ----------
    crytal_system : str
        'cubic','hexagonal','trigonal','tetragonal','orthorhombic','monoclinic' and 'triclinic'

    resolution : float
        The maximum misorientation between rotations in the list, as defined according to
        the parameter 'equal'. Specified as an angle in degrees.
    equal : str
        'angle' or 'area'. If 'angle', the misorientation is calculated between each beam direction
        and its nearest neighbour(s). If 'area', the density of points is as in the equal angle case
        but each point covers an equal area.

    Returns
    -------
    rotation_list : list of tuples
        List of rotations
    """
    beam_directions_rzxz = beam_directions_to_euler_angles(
        get_beam_directions(crystal_system, resolution, equal=equal))
    beam_directions_szxz = beam_directions_rzxz.to_AxAngle().to_Euler(
        axis_convention='szxz')  # convert to high speed convention

    # drop in all the inplane rotations to form z
    alpha = beam_directions_szxz.data[:, 0]
    beta = beam_directions_szxz.data[:, 1]
    in_plane = np.arange(0, 360, resolution)

    ipalpha = np.asarray(list(product(alpha, np.asarray(in_plane))))
    ipbeta = np.asarray(list(product(beta, np.asarray(in_plane))))
    z = np.hstack((ipalpha[:, 0].reshape((-1, 1)), ipbeta))

    raw_grid = Euler(z, axis_convention='szxz')
    grid_rzxz = raw_grid.to_AxAngle().to_Euler(
        axis_convention='rzxz')  # convert back Bunge convention to return
    rotation_list = grid_rzxz.to_rotation_list(round_to=2)
    return rotation_list
예제 #2
0
def test_equal_area_same_as_equal_angle(crystal_system):
    z_angle = get_beam_directions(crystal_system, 1, equal='angle')
    z_area = get_beam_directions(crystal_system, 1, equal='area')
    assert np.all(z_angle.shape == z_area.shape)
예제 #3
0
def test_beam_directions_cubic():
    # Following "Orientation precision of TEM-based orientation mapping techniques" - Morawiec et al, Ultramicroscopy 136,2014
    z = get_beam_directions('cubic', 1.6)
    assert z.shape[0] > 950
    assert z.shape[0] < 1050
예제 #4
0
def test_get_beam_directions_equal_area(crystal_system, expected_corners):
    z = get_beam_directions(crystal_system, 1, equal='area')
    assert np.allclose(np.linalg.norm(z, axis=1), 1)
    for corner in expected_corners:
        norm_corner = np.divide(corner, np.linalg.norm(corner))
        assert np.any(np.isin(z, norm_corner))