How to use the pyxem.libraries.structure_library.StructureLibrary 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_physical / test_orientation_mapping_phys.py View on Github external
def get_template_library(structure, rot_list, edc):
    diff_gen = pxm.DiffractionLibraryGenerator(edc)
    struc_lib = StructureLibrary(['A'], [structure], [rot_list])
    library = diff_gen.get_diffraction_library(struc_lib,
                                               calibration=1 / half_side_length,
                                               reciprocal_radius=0.8,
                                               half_shape=(half_side_length,
                                                           half_side_length),
                                               with_direct_beam=False)
    return library
github pyxem / pyxem / tests / test_physical / test_orientation_mapping_phys.py View on Github external
def get_vector_match_results(structure, rot_list, edc):
    diffraction_library = get_template_library(structure, rot_list, edc)
    peak_lists = []
    for simulation in diffraction_library['A'].values():
        peak_lists.append(simulation['pixel_coords'])
    peaks = DiffractionVectors((np.array([peak_lists, peak_lists]) - half_side_length) / half_side_length)
    peaks.axes_manager.set_signal_dimension(2)
    peaks.calculate_cartesian_coordinates(200, 0.2)
    peaks.cartesian.axes_manager.set_signal_dimension(2)
    structure_library = StructureLibrary(['A'], [structure], [[]])
    library_generator = VectorLibraryGenerator(structure_library)
    vector_library = library_generator.get_vector_library(1)
    indexation_generator = VectorIndexationGenerator(peaks, vector_library)
    return diffraction_library, indexation_generator.index_vectors(
        mag_tol=1.5 / half_side_length,
        angle_tol=1,
        index_error_tol=0.2,
        n_peaks_to_index=5,
        n_best=2,
        keys=['A'])
github pyxem / pyxem / tests / test_generators / test_library_generator.py View on Github external
def structure_library(default_structure):
    return StructureLibrary(['Si'], [default_structure], [[(0, 0, 0), (0.1, 0.1, 0)]])
github pyxem / pyxem / tests / test_library / test_diffraction_library.py View on Github external
def get_library(default_structure):
    diffraction_calculator = pxm.DiffractionGenerator(300., 0.02)
    dfl = pxm.DiffractionLibraryGenerator(diffraction_calculator)
    structure_library = StructureLibrary(['Phase'],
                                         [default_structure],
                                         [[(0, 0, 0), (0, 0.2, 0)]])

    return dfl.get_diffraction_library(structure_library,
                                       0.017, 2.4, (72, 72))
github pyxem / pyxem / pyxem / generators / structure_library_generator.py View on Github external
inplane_rotations : list
            List over identifiers of lists of inplane rotations of the
            diffraction patterns, in degrees.
        resolution : float
            Rotation list resolution in degrees.

        Returns
        -------
        structure_library : StructureLibrary
            Structure library for the given phase names, structures and crystal system.
        """
        rotation_lists = [
            rotation_list_stereographic(structure, *stereographic_corners[system], inplane_rotation, resolution)
            for phase_name, structure, system, inplane_rotation in
            zip(self.phase_names, self.structures, self.systems, inplane_rotations)]
        return StructureLibrary(self.phase_names, self.structures, rotation_lists)
github pyxem / pyxem / pyxem / generators / structure_library_generator.py View on Github external
def get_orientations_from_list(self, orientations):
        """Create a structure library from a list of rotations.

        Parameters
        ----------
        orientations : list
            A list over identifiers of lists of euler angles (as tuples) in the rzxz
            convention and in degrees.

        Returns
        -------
        structure_library : StructureLibrary
            Structure library for the given phase names, structures and orientations.
        """
        return StructureLibrary(self.phase_names, self.structures, orientations)