How to use the orix.quaternion.rotation.Rotation.from_euler 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 / __init__.py View on Github external
----------
    file_string : str
        Path to the ``.ctf`` file. This file is assumed to list the Euler
        angles in the Bunge convention in the columns 5, 6, and 7.

    Returns
    -------
    Rotation

    """

    from orix.quaternion.rotation import Rotation

    data = np.loadtxt(file_string, skiprows=17)[:, 5:8]
    euler = np.radians(data)
    rotation = Rotation.from_euler(euler)
    return rotation
github pyxem / orix / orix / io / plugins / emsoft_h5ebsd.py View on Github external
# 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]

    data_dict["prop"] = _get_properties(
        data_group=data_group, n_top_matches=n_top_matches, map_size=map_size,
    )

    f.close()

    return CrystalMap(**data_dict)
github pyxem / orix / orix / io / __init__.py View on Github external
Parameters
    ----------
    file_string : str
        Path to the ``.ang`` file. This file is assumed to list the Euler
        angles in the Bunge convention in the first three columns.

    Returns
    -------
    Rotation

    """
    from orix.quaternion.rotation import Rotation

    data = np.loadtxt(file_string)
    euler = data[:, :3]
    rotation = Rotation.from_euler(euler)
    return rotation
github pyxem / orix / orix / io / plugins / orix_hdf5.py View on Github external
dictionary : dict
        Dictionary with crystal map information.

    Returns
    -------
    CrystalMap
    """
    dictionary = copy.deepcopy(dictionary)

    data = dictionary["data"]
    header = dictionary["header"]

    # New dictionary with CrystalMap initialization arguments as keys
    crystal_map_dict = {
        # Use dstack and squeeze to allow more rotations per data point
        "rotations": Rotation.from_euler(
            np.dstack((data.pop("phi1"), data.pop("Phi"), data.pop("phi2"))).squeeze(),
        ),
        "scan_unit": header["scan_unit"],
        "phase_list": dict2phaselist(header["phases"]),
        "phase_id": data.pop("phase_id"),
        "is_in_data": data.pop("is_in_data"),
    }
    # Add standard items by updating the new dictionary
    for direction in ["z", "y", "x"]:
        this_direction = data.pop(direction)
        if hasattr(this_direction, "__iter__") is False:
            this_direction = None
        crystal_map_dict[direction] = this_direction
    _ = [data.pop(i) for i in ["id"]]
    # What's left should be properties like quality metrics etc.
    crystal_map_dict.update({"prop": data})
github pyxem / orix / orix / io / plugins / ang.py View on Github external
)

    # Set which data points are not indexed
    if vendor == "tsl":
        data_dict["phase_id"][np.where(data_dict["prop"]["ci"] == -1)] = -1
    # TODO: Add not-indexed convention for INDEX ASTAR

    # Set scan unit
    if vendor in ["tsl", "emsoft"]:
        scan_unit = "um"
    else:  # NanoMegas
        scan_unit = "nm"
    data_dict["scan_unit"] = scan_unit

    # Create rotations
    data_dict["rotations"] = Rotation.from_euler(
        np.column_stack(
            (data_dict.pop("euler1"), data_dict.pop("euler2"), data_dict.pop("euler3"))
        )
    )

    return CrystalMap(**data_dict)