pyxem.libraries package

Submodules

pyxem.libraries.diffraction_library module

class pyxem.libraries.diffraction_library.DiffractionLibrary(*args, **kwargs)[source]

Bases: dict

Maps crystal structure (phase) and orientation to simulated diffraction data.

identifiers

A list of phase identifiers referring to different atomic structures.

Type

list of strings/ints

structures

A list of diffpy.structure.Structure objects describing the atomic structure associated with each phase in the library.

Type

list of diffpy.structure.Structure objects.

diffraction_generator

Diffraction generator used to generate this library.

Type

DiffractionGenerator

reciprocal_radius

Maximum g-vector magnitude for peaks in the library.

Type

float

with_direct_beam

Whether the direct beam included in the library or not.

Type

bool

get_library_entry(phase=None, angle=None)[source]

Extracts a single DiffractionLibrary entry.

Parameters
  • phase (str) – Key for the phase of interest. If unspecified the choice is random.

  • angle (tuple) – The orientation of interest as a tuple of Euler angles following the Bunge convention [z, x, z] in degrees. If unspecified the choise is random (the first hit).

Returns

library_entries – Dictionary containing the simulation associated with the specified phase and orientation with associated properties.

Return type

dict

pickle_library(filename)[source]

Saves a diffraction library in the pickle format.

Parameters

filename (str) – The location in which to save the file

pyxem.libraries.diffraction_library.load_DiffractionLibrary(filename, safety=False)[source]

Loads a previously saved diffraction library.

Parameters
  • filename (str) – The location of the file to be loaded

  • safety (bool (defaults to False)) – Unpickling is risky, this variable requires you to acknowledge this.

Returns

Previously saved Library

Return type

DiffractionLibrary

pyxem.libraries.structure_library module

class pyxem.libraries.structure_library.StructureLibrary(identifiers, structures, orientations)[source]

Bases: object

A dictionary containing all the structures and their associated rotations in the .struct_lib attribute.

identifiers

A list of phase identifiers referring to different atomic structures.

Type

list of strings/ints

structures

A list of diffpy.structure.Structure objects describing the atomic structure associated with each phase in the library.

Type

list of diffpy.structure.Structure objects.

orientations

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

Type

list

pyxem.libraries.vector_library module

class pyxem.libraries.vector_library.DiffractionVectorLibrary(*args, **kwargs)[source]

Bases: dict

Maps crystal structure (phase) to diffraction vectors.

The library is a dictionary mapping from a phase name to phase information. The phase information is stored as a dictionary with the following entries:

‘indices’np.array

List of peak indices [hkl1, hkl2] as a 2D array.

‘measurements’np.array

List of vector measurements [len1, len2, angle] in the same order as the indices. Lengths in reciprocal Angstrom and angles in radians.

identifiers

A list of phase identifiers referring to different atomic structures.

Type

list of strings/ints

structures

A list of diffpy.structure.Structure objects describing the atomic structure associated with each phase in the library.

Type

list of diffpy.structure.Structure objects.

reciprocal_radius

Maximum reciprocal radius used when generating the library.

Type

float

pickle_library(filename)[source]

Saves a diffraction library in the pickle format.

Parameters

filename (str) – The location in which to save the file

pyxem.libraries.vector_library.load_VectorLibrary(filename, safety=False)[source]

Loads a previously saved vectorlibrary.

Parameters
  • filename (str) – The location of the file to be loaded

  • safety (bool (defaults to False)) – Unpickling is risky, this variable requires you to acknowledge this.

Returns

Previously saved Library

Return type

VectorLibrary

See also

VectorLibrary.pickle_library()

Module contents