PhaseList#
- class orix.crystal_map.PhaseList(phases: Phase | list[Phase] | dict[int, Phase] | None = None, names: str | list[str] | None = None, space_groups: int | SpaceGroup | list[int | SpaceGroup] | None = None, point_groups: str | int | Symmetry | list[str | int | Symmetry] | None = None, colors: str | list[str] | None = None, ids: int | list[int] | ndarray | None = None, structures: Structure | list[Structure] | None = None)[source]#
Bases:
object
A list of phases in a crystallographic map.
Each phase in the list must have a unique phase id and name.
- Parameters:
- phases
A list or dict of phases or a single phase. The other arguments are ignored if this is passed.
- names
Phase names. Overwrites the names in the
structure
objects.- space_groups
Space groups.
- point_groups
Point groups.
- colors
Phase colors.
- ids
Phase IDs.
- structures
Unit cells with atoms and a lattice of each phase. If not given, a default
diffpy.structure.Structure
is created for each phase.
Examples
>>> from diffpy.structure import Atom, Lattice, Structure >>> from orix.crystal_map import Phase, PhaseList >>> pl = PhaseList( ... names=["al", "cu"], ... space_groups=[225] * 2, ... structures=[ ... Structure( ... atoms=[Atom("al", [0] * 3)], ... lattice=Lattice(0.405, 0.405, 0.405, 90, 90, 90) ... ), ... Structure( ... atoms=[Atom("cu", [0] * 3)], ... lattice=Lattice(0.361, 0.361, 0.361, 90, 90, 90) ... ), ... ] ... ) >>> pl Id Name Space group Point group Proper point group Color 0 al Fm-3m m-3m 432 tab:blue 1 cu Fm-3m m-3m 432 tab:orange >>> pl["al"].structure [al 0.000000 0.000000 0.000000 1.0000]
A phase list can be indexed in multiple ways:
Return a phase if only one phase matches the key
>>> pl[0] # Index with a single phase id <name: al. space group: Fm-3m. point group: m-3m. proper point group: 432. color: tab:blue> >>> pl["cu"] # Index with a phase name <name: cu. space group: Fm-3m. point group: m-3m. proper point group: 432. color: tab:orange> >>> pl[:1] <name: al. space group: Fm-3m. point group: m-3m. proper point group: 432. color: tab:blue>
Return a phase list
>>> pl[0:] # Index with slices Id Name Space group Point group Proper point group Color 0 al Fm-3m m-3m 432 tab:blue 1 cu Fm-3m m-3m 432 tab:orange >>> pl["al", "cu"] # Index with a tuple of phase names Id Name Space group Point group Proper point group Color 0 al Fm-3m m-3m 432 tab:blue 1 cu Fm-3m m-3m 432 tab:orange >>> pl[0, 1] # Index with a tuple of phase phase_ids Id Name Space group Point group Proper point group Color 0 al Fm-3m m-3m 432 tab:blue 1 cu Fm-3m m-3m 432 tab:orange >>> pl[[0, 1]] # Index with a list of phase_ids Id Name Space group Point group Proper point group Color 0 al Fm-3m m-3m 432 tab:blue 1 cu Fm-3m m-3m 432 tab:orange
Attributes
Return the phases' colors.
Return the phases' RGB color values.
Return the unique phase IDs in the list of phases.
Return the phases' names.
Return the phases' point groups.
Return the number of phases in the list.
Return the phases' space groups.
Return the phases' structures.
Methods
PhaseList.add
(value)Add phases to the end of a phase list in-place, incrementing the phase IDs.
Add a dummy phase to assign to not indexed data points.
Return a deep copy using
copy.deepcopy()
function.PhaseList.id_from_name
(name)Return the phase ID from a phase name or raise an error if the phase is not in the list.
Sort the list according to phase ID in-place.