pyextal.acom.plotting¶
Visualising an orientation solve.
Two views: the indexed pattern itself, and a symmetry-reduced map of how every candidate zone axis scored. The second matters because the orientation is only ever determined up to the Laue symmetry of the crystal – plotting the raw candidate list shows the same solution several times over, which reads as ambiguity that is not really there.
Functions¶
Rotation parts of the crystal's symmetry operators, plus inversion. |
|
|
Canonical representative of a zone axis under the symmetry. |
|
Stereographic projection of unit vectors from the southern pole. |
|
Plots candidate zone axes on a symmetry-reduced stereographic map. |
|
Overlays the indexed reflections on the diffraction pattern. |
Module Contents¶
- pyextal.acom.plotting.symmetry_operators()¶
Rotation parts of the crystal’s symmetry operators, plus inversion.
Read from the Fortran spgr common block, so the space group must already have been parsed. Inversion is appended when the group is centrosymmetric, which is what makes the map a Laue-symmetry map rather than a point-group one.
- Returns:
(n, 3, 3) integer rotation matrices.
- Return type:
np.ndarray
- Raises:
ValueError – If no space group has been parsed yet.
- pyextal.acom.plotting.reduce_zone(uvw, ops, D=None)¶
Canonical representative of a zone axis under the symmetry.
With a direct-space frame the representative is the equivalent pointing furthest along +z, then +y, then +x, which for a cubic crystal lands <100> on [001] and <110> on [011] – the usual inverse-pole-figure triangle. Without one the lexicographic maximum is used, which groups correctly but scatters the representatives around the projection.
- Parameters:
uvw (array-like) – Zone axis, direct-space indices.
ops (np.ndarray) – (n, 3, 3) symmetry rotations.
D (np.ndarray, optional) – Direct basis matrix from cartesian_frames.
- Returns:
The group label.
- Return type:
tuple[int, int, int]
- pyextal.acom.plotting.stereographic(vectors)¶
Stereographic projection of unit vectors from the southern pole.
- Parameters:
vectors (np.ndarray) – (n, 3) Cartesian vectors; need not be normalised.
- Returns:
(n, 2) projected coordinates inside the unit circle.
- Return type:
np.ndarray
- pyextal.acom.plotting.plot_zone_map(result, param, ax=None, annotate=6, cmap='viridis', show_all=False)¶
Plots candidate zone axes on a symmetry-reduced stereographic map.
Every zone axis in result.ranking is folded onto its symmetry representative and the best score of each group is kept, so a cubic crystal shows one point for <100> rather than three. Zones in result.failed, tried but left without a mapping, are drawn as grey crosses so the map shows every axis the search tested.
A wide search packs its axes closely: to index 15 a cubic crystal gives 624 distinct orientations inside the fundamental triangle, and neighbouring high-index axes sit a fraction of a degree apart. The view is zoomed to the region the points occupy, and each marker is sized to its nearest neighbour, so close axes stay separate instead of hiding under one another.
- Parameters:
result (AcomResult) – A solved orientation carrying ranking.
param (SimParams) – Parsed parameters, for the direct-space frame.
ax (matplotlib.axes.Axes, optional) – Axes to draw on; created if None.
annotate (int, optional) – Label this many top groups. Defaults to 6.
cmap (str, optional) – Colormap for the score. Defaults to ‘viridis’.
show_all (bool, optional) – Draw every equivalent instead of reducing. Defaults to False.
- Returns:
(ax, groups)where groups maps representative zone to score.- Return type:
tuple
- pyextal.acom.plotting.plot_indexed(image, result, ax=None, max_label=12, vmax_pct=99.5, include_holz=True)¶
Overlays the indexed reflections on the diffraction pattern.
Predicted reflections are drawn whether or not a peak was detected there, which is the point: the weak ones are exactly what a peak finder misses and what the integration still needs.
- Parameters:
image (np.ndarray) – The averaged pattern that was indexed.
result (AcomResult) – The solved orientation.
ax (matplotlib.axes.Axes, optional) – Axes to draw on.
max_label (int, optional) – Label this many of the strongest predicted reflections. Defaults to 12.
vmax_pct (float, optional) – Display ceiling percentile. Defaults to 99.5.
include_holz (bool, optional) – Include HOLZ. Defaults to True.
- Returns:
The axes drawn on.
- Return type:
matplotlib.axes.Axes