Exemple #1
0
    def test_get_metric_map_no_method(self):
        crystal_map = CrystallographicMap(np.array([[1]]))

        with pytest.raises(
                ValueError,
                match="crystallographic mapping method must be specified"):
            metric_map = crystal_map.get_metric_map("no metric")
Exemple #2
0
def mod_cryst_map():
    """
    Generates a Crystallographic Map with (5,17,6) as the modal angle
    """
    base = np.empty((6, 3), dtype="object")
    base[0] = [
        0,
        np.array([5, 17, 6]),
        {
            "correlation": 5e-17,
            "orientation_reliability": 0.5
        },
    ]
    base[1] = [
        0,
        np.array([5, 17, 6]),
        {
            "correlation": 5e-17,
            "orientation_reliability": 0.5
        },
    ]
    base[2] = [
        0,
        np.array([6, 19, 6]),
        {
            "correlation": 5e-17,
            "orientation_reliability": 0.5
        },
    ]
    base[3] = [
        0,
        np.array([7, 19, 6]),
        {
            "correlation": 5e-17,
            "orientation_reliability": 0.5
        },
    ]
    base[4] = [
        0,
        np.array([8, 19, 6]),
        {
            "correlation": 5e-17,
            "orientation_reliability": 0.5
        },
    ]
    base[5] = [
        0,
        np.array([9, 19, 6]),
        {
            "correlation": 5e-17,
            "orientation_reliability": 0.5
        },
    ]
    crystal_map = CrystallographicMap(base.reshape((3, 2, 3)))
    crystal_map.method = "template_matching"
    return crystal_map
Exemple #3
0
def dp_cryst_map_vector():
    """
    Generates a Crystallographic Map with two phases from vector matching
    """
    base = np.empty((4, 3), dtype="object")
    base[0] = [
        0,
        np.array([5, 17, 6]),
        {
            "match_rate": 0.5,
            "ehkls": np.array([0.1, 0.05, 0.2]),
            "total_error": 0.1,
            "orientation_reliability": 13.2,
            "phase_reliability": 42.0,
        },
    ]
    base[1] = [
        1,
        np.array([6, 17, 6]),
        {
            "match_rate": 0.5,
            "ehkls": np.array([0.1, 0.05, 0.2]),
            "total_error": 0.1,
            "orientation_reliability": 13.2,
            "phase_reliability": 42.0,
        },
    ]
    base[2] = [
        0,
        np.array([12, 3, 6]),
        {
            "match_rate": 0.5,
            "ehkls": np.array([0.1, 0.05, 0.2]),
            "total_error": 0.1,
            "orientation_reliability": 13.2,
            "phase_reliability": 42.0,
        },
    ]
    base[3] = [
        0,
        np.array([12, 3, 5]),
        {
            "match_rate": 0.5,
            "ehkls": np.array([0.1, 0.05, 0.2]),
            "total_error": 0.1,
            "orientation_reliability": 13.2,
            "phase_reliability": 42.0,
        },
    ]
    crystal_map = CrystallographicMap(base.reshape((2, 2, 3)))
    crystal_map.method = "vector_matching"
    return crystal_map
Exemple #4
0
def dp_cryst_map_vector():
    """
    Generates a Crystallographic Map with two phases from vector matching
    """
    base = np.empty((4, 3), dtype='object')
    base[0] = [
        0,
        np.array([5, 17, 6]), {
            'match_rate': 0.5,
            'ehkls': np.array([0.1, 0.05, 0.2]),
            'total_error': 0.1,
            'orientation_reliability': 13.2,
            'phase_reliability': 42.0
        }
    ]
    base[1] = [
        1,
        np.array([6, 17, 6]), {
            'match_rate': 0.5,
            'ehkls': np.array([0.1, 0.05, 0.2]),
            'total_error': 0.1,
            'orientation_reliability': 13.2,
            'phase_reliability': 42.0
        }
    ]
    base[2] = [
        0,
        np.array([12, 3, 6]), {
            'match_rate': 0.5,
            'ehkls': np.array([0.1, 0.05, 0.2]),
            'total_error': 0.1,
            'orientation_reliability': 13.2,
            'phase_reliability': 42.0
        }
    ]
    base[3] = [
        0,
        np.array([12, 3, 5]), {
            'match_rate': 0.5,
            'ehkls': np.array([0.1, 0.05, 0.2]),
            'total_error': 0.1,
            'orientation_reliability': 13.2,
            'phase_reliability': 42.0
        }
    ]
    crystal_map = CrystallographicMap(base.reshape((2, 2, 3)))
    crystal_map.method = 'vector_matching'
    return crystal_map
Exemple #5
0
def dp_cryst_map():
    """
    Generates a Crystallographic Map with two phases
    """
    base = np.empty((4, 3), dtype="object")
    base[0] = [
        0,
        np.array([5, 17, 6]),
        {
            "correlation": 3e-17,
            "orientation_reliability": 0.5,
            "phase_reliability": 0.6,
        },
    ]
    base[1] = [
        1,
        np.array([6, 17, 6]),
        {
            "correlation": 2e-17,
            "orientation_reliability": 0.4,
            "phase_reliability": 0.7,
        },
    ]
    base[2] = [
        0,
        np.array([12, 3, 6]),
        {
            "correlation": 4e-17,
            "orientation_reliability": 0.3,
            "phase_reliability": 0.1,
        },
    ]
    base[3] = [
        0,
        np.array([12, 3, 5]),
        {
            "correlation": 8e-16,
            "orientation_reliability": 0.2,
            "phase_reliability": 0.8,
        },
    ]
    crystal_map = CrystallographicMap(base.reshape((2, 2, 3)))
    crystal_map.method = "template_matching"
    return crystal_map
Exemple #6
0
def zero_modal_map():
    """
    Generates a crystallographic map, modal angle (0,0,0)
    """
    base = np.zeros((4, 7))
    base[0] = [0, 2, 0, 4, 3e-17, 0.5, 0.6]
    base[1] = [0, 0, 0, 0, 2e-17, 0.4, 0.7]
    base[2] = [0, 0, 0, 0, 4e-17, 0.3, 0.1]
    base[3] = [0, 0, 0, 0, 8e-16, 0.2, 0.8]
    crystal_map = CrystallographicMap(base.reshape((2, 2, 7)))
    return crystal_map
Exemple #7
0
def dp_cryst_map():
    """
    Generates a Crystallographic Map with two phases
    """
    base = np.zeros((4, 7))
    base[0] = [0, 5, 17, 6, 3e-17, 0.5, 0.6]
    base[1] = [1, 6, 17, 6, 2e-17, 0.4, 0.7]
    base[2] = [0, 12, 3, 6, 4e-17, 0.3, 0.1]
    base[3] = [0, 12, 3, 5, 8e-16, 0.2, 0.8]
    crystal_map = CrystallographicMap(base.reshape((2, 2, 7)))
    return crystal_map
Exemple #8
0
def sp_cryst_map():
    """
    Generates a single phase Crystallographic Map
    """
    base = np.zeros((4, 6))
    base[0] = [0, 5, 17, 6, 3e-17, 0.5]
    base[1] = [0, 6, 17, 6, 2e-17, 0.4]
    base[2] = [0, 12, 3, 6, 4e-17, 0.3]
    base[3] = [0, 12, 3, 5, 8e-16, 0.2]
    crystal_map = CrystallographicMap(base.reshape((2, 2, 6)))
    return crystal_map
Exemple #9
0
def dp_cryst_map():
    """
    Generates a Crystallographic Map with two phases
    """
    base = np.empty((4, 3), dtype='object')
    base[0] = [
        0,
        np.array([5, 17, 6]), {
            'correlation': 3e-17,
            'orientation_reliability': 0.5,
            'phase_reliability': 0.6
        }
    ]
    base[1] = [
        1,
        np.array([6, 17, 6]), {
            'correlation': 2e-17,
            'orientation_reliability': 0.4,
            'phase_reliability': 0.7
        }
    ]
    base[2] = [
        0,
        np.array([12, 3, 6]), {
            'correlation': 4e-17,
            'orientation_reliability': 0.3,
            'phase_reliability': 0.1
        }
    ]
    base[3] = [
        0,
        np.array([12, 3, 5]), {
            'correlation': 8e-16,
            'orientation_reliability': 0.2,
            'phase_reliability': 0.8
        }
    ]
    crystal_map = CrystallographicMap(base.reshape((2, 2, 3)))
    crystal_map.method = 'template_matching'
    return crystal_map
Exemple #10
0
def sp_cryst_map():
    """
    Generates a single phase Crystallographic Map
    """
    base = np.empty((4, 3), dtype="object")
    base[0] = [
        0,
        np.array([5, 17, 6]),
        {
            "correlation": 3e-17,
            "orientation_reliability": 0.5
        },
    ]
    base[1] = [
        0,
        np.array([6, 17, 6]),
        {
            "correlation": 2e-17,
            "orientation_reliability": 0.4
        },
    ]
    base[2] = [
        0,
        np.array([12, 3, 6]),
        {
            "correlation": 4e-17,
            "orientation_reliability": 0.3
        },
    ]
    base[3] = [
        0,
        np.array([12, 3, 5]),
        {
            "correlation": 8e-16,
            "orientation_reliability": 0.2
        },
    ]
    crystal_map = CrystallographicMap(base.reshape((2, 2, 3)))
    crystal_map.method = "template_matching"
    return crystal_map
Exemple #11
0
def mod_cryst_map():
    """
    Generates a Crystallographic Map with (5,17,6) as the modal angle
    """
    base = np.zeros((6, 6))
    base[0] = [0, 5, 17, 6, 5e-17, 0.5]
    base[1] = [0, 5, 17, 6, 5e-17, 0.5]
    base[2] = [0, 6, 19, 6, 5e-17, 0.5]
    base[3] = [0, 7, 19, 6, 5e-17, 0.5]
    base[4] = [0, 8, 19, 6, 5e-17, 0.5]
    base[5] = [0, 9, 19, 6, 5e-17, 0.5]
    crystal_map = CrystallographicMap(base.reshape((3, 2, 6)))
    return crystal_map
Exemple #12
0
def sp_cryst_map():
    """
    Generates a single phase Crystallographic Map
    """
    base = np.empty((4, 3), dtype='object')
    base[0] = [
        0,
        np.array([5, 17, 6]), {
            'correlation': 3e-17,
            'orientation_reliability': 0.5
        }
    ]
    base[1] = [
        0,
        np.array([6, 17, 6]), {
            'correlation': 2e-17,
            'orientation_reliability': 0.4
        }
    ]
    base[2] = [
        0,
        np.array([12, 3, 6]), {
            'correlation': 4e-17,
            'orientation_reliability': 0.3
        }
    ]
    base[3] = [
        0,
        np.array([12, 3, 5]), {
            'correlation': 8e-16,
            'orientation_reliability': 0.2
        }
    ]
    crystal_map = CrystallographicMap(base.reshape((2, 2, 3)))
    crystal_map.method = 'template_matching'
    return crystal_map
Exemple #13
0
 def test_get_metric_map_no_method(self):
     crystal_map = CrystallographicMap(np.array([[1]]))
     metric_map = crystal_map.get_metric_map('no metric')