How to use the orix.crystal_map.Phase function in orix

To help you get started, we’ve selected a few orix 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 / orix / orix / io / plugins / orix_hdf5.py View on Github external
Parameters
    ----------
    dictionary : dict
        Dictionary with phase information.

    Returns
    -------
    Phase
    """
    dictionary = copy.deepcopy(dictionary)
    structure = dict2structure(dictionary["structure"])
    structure.title = dictionary["name"]
    symmetry = dictionary["symmetry"]
    if symmetry == "None":
        symmetry = None
    return Phase(
        name=dictionary["name"],
        color=dictionary["color"],
        symmetry=symmetry,
        structure=structure,
    )
github pyxem / orix / orix / io / plugins / emsoft_h5ebsd.py View on Github external
map_size = ny * nx

    # Some of the data needed to create a CrystalMap object
    phase_name, symmetry, structure = _get_phase(phase_group)
    data_dict = {
        # Get map coordinates ("Y Position" data set is not correct in EMsoft as of
        # 2020-04, see:
        # https://github.com/EMsoft-org/EMsoft/blob/7762e1961508fe3e71d4702620764ceb98a78b9e/Source/EMsoftHDFLib/EMh5ebsd.f90#L1093)
        "x": data_group["X Position"][:],
        # y = data_group["Y Position"][:]
        "y": np.sort(np.tile(np.arange(ny) * step_y, nx)),
        # Get phase IDs
        "phase_id": data_group["Phase"][:],
        # Get phase name, crystal symmetry and structure (lattice)
        "phase_list": PhaseList(
            Phase(name=phase_name, symmetry=symmetry, structure=structure)
        ),
        "scan_unit": "um",
    }

    # Get rotations
    if refined:
        euler = data_group["RefinedEulerAngles"][:]
    else:  # Get n top matches for each pixel
        top_match_idx = data_group["TopMatchIndices"][:][:map_size] - 1
        dictionary_size = data_group["FZcnt"][:][0]
        dictionary_euler = data_group["DictionaryEulerAngles"][:][:dictionary_size]
        euler = dictionary_euler[top_match_idx, :]
    data_dict["rotations"] = Rotation.from_euler(euler)

    # Get number of top matches kept per data point
    n_top_matches = f["NMLparameters/EBSDIndexingNameListType/nnk"][:][0]