How to use the pyxem.signals.crystallographic_map.CrystallographicMap function in pyxem

To help you get started, we’ve selected a few pyxem examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyxem / pyxem / tests / test_signals / test_crystallographic_map.py View on Github external
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
github pyxem / pyxem / tests / test_signals / test_crystallographic_map.py View on Github external
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
github pyxem / pyxem / tests / test_signals / test_crystallographic_map.py View on Github external
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
github pyxem / pyxem / tests / test_signals / test_crystallographic_map.py View on Github external
'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
github pyxem / pyxem / tests / test_signals / test_crystallographic_map.py View on Github external
def test_get_metric_map_no_method(self):
        crystal_map = CrystallographicMap(np.array([[1]]))
        metric_map = crystal_map.get_metric_map('no metric')
github pyxem / pyxem / pyxem / utils / io_utils.py View on Github external
from pyxem.signals.diffraction_vectors import DiffractionVectors
from pyxem.signals.indexation_results import TemplateMatchingResults

from pyxem.signals.diffraction1d import LazyDiffraction1D
from pyxem.signals.diffraction2d import LazyDiffraction2D
from pyxem.signals.electron_diffraction1d import LazyElectronDiffraction1D
from pyxem.signals.electron_diffraction2d import LazyElectronDiffraction2D

signal_dictionary = {'diffraction1d': Diffraction1D,
                     'diffraction2d': Diffraction2D,
                     'electron_diffraction1d': ElectronDiffraction1D,
                     'electron_diffraction2d': ElectronDiffraction2D,
                     'vdf_image': VDFImage,
                     'template_matching': TemplateMatchingResults,
                     'diffraction_vectors': DiffractionVectors,
                     'crystallographic_map': CrystallographicMap}

lazy_signal_dictionary = {'diffraction1d': LazyDiffraction1D,
                          'diffraction2d': LazyDiffraction2D,
                          'electron_diffraction1d': LazyElectronDiffraction1D,
                          'electron_diffraction2d': LazyElectronDiffraction2D}


def load(filename, lazy=False):
    """Load data into pyxem objects.

    Parameters
    ----------
    filename : str
        A single filename of a previously saved pyxem object. Other arguments may
        succeed, but will have fallen back on hyperspy load and warn accordingly
    lazy : bool
github pyxem / pyxem / pyxem / signals / crystallographic_map.py View on Github external
Crystallographic map loaded from the specified file.

    """
    load_array = np.loadtxt(filename, delimiter='\t')
    # Add one for zero indexing
    x_max = np.max(load_array[:, 5]).astype(int) + 1
    y_max = np.max(load_array[:, 6]).astype(int) + 1
    crystal_data = np.empty((y_max, x_max, 3), dtype='object')
    for y in range(y_max):
        for x in range(x_max):
            load_index = y * x_max + x
            crystal_data[y, x] = [
                load_array[load_index, 0],
                load_array[load_index, 1:4],
                {'correlation': load_array[load_index, 4]}]
    return CrystallographicMap(crystal_data)