Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a31bca1
Correct C2v to match ITOC
argerlt Jun 30, 2025
ca5a391
matching symmetry lists and names to ITOC
argerlt Jun 30, 2025
37a9db7
update _get_laue_group_name to be proceedural instead of a name-based…
argerlt Jun 30, 2025
445435f
expand symmetry marker and add example
argerlt Jul 1, 2025
8e3e490
formatting
argerlt Jul 1, 2025
c9d17ab
make tables sphinx-compatable
argerlt Jul 1, 2025
c01f09b
formatting
argerlt Jul 1, 2025
ecf5a5a
add suggestions from #563 review
argerlt Jul 3, 2025
228a7dc
Merge branch 'develop' into UpdatingSymmetryWithExamples
argerlt Jul 3, 2025
a9af706
moving plot_symmetry_operations algo to Symmetry function
argerlt Jul 4, 2025
b46e977
formatting
argerlt Jul 4, 2025
d9bbfd5
create PointGroups class, improve Symmetry.plot, and fix example
argerlt Jul 9, 2025
fed56bc
formatting
argerlt Jul 9, 2025
da8269d
finishing symmetry.plot and adding to PointGroups
argerlt Jul 9, 2025
46e8663
typos
argerlt Jul 9, 2025
19b6e47
formatting
argerlt Jul 10, 2025
276d456
more formatting
argerlt Jul 10, 2025
085be4a
Correct C2v to match ITOC
argerlt Jun 30, 2025
5c6a8f7
matching symmetry lists and names to ITOC
argerlt Jun 30, 2025
daf7b65
update _get_laue_group_name to be proceedural instead of a name-based…
argerlt Jun 30, 2025
5e1f8cd
expand symmetry marker and add example
argerlt Jul 1, 2025
9fc91d6
formatting
argerlt Jul 1, 2025
54cd0a1
make tables sphinx-compatable
argerlt Jul 1, 2025
70adbc7
formatting
argerlt Jul 1, 2025
18d9005
add suggestions from #563 review
argerlt Jul 3, 2025
ec32242
moving plot_symmetry_operations algo to Symmetry function
argerlt Jul 4, 2025
9478f33
formatting
argerlt Jul 4, 2025
e71059e
create PointGroups class, improve Symmetry.plot, and fix example
argerlt Jul 9, 2025
c35bc06
formatting
argerlt Jul 9, 2025
f472f11
finishing symmetry.plot and adding to PointGroups
argerlt Jul 9, 2025
1c381b3
typos
argerlt Jul 9, 2025
c541b31
formatting
argerlt Jul 10, 2025
8e38b67
more formatting
argerlt Jul 10, 2025
1460020
Documentation improvements
argerlt Jul 17, 2025
154405f
Merge branch 'UpdatingSymmetryWithExamples' of https://github.com/arg…
argerlt Jul 17, 2025
ae62fcf
Addressing feedback on #563
argerlt Jul 18, 2025
3e9aa80
fix broken reference to old class feature
argerlt Jul 18, 2025
396972c
fix D3h name and improve explination on plot_symmetry_operations.py
argerlt Jul 18, 2025
af9d177
Merge remote-tracking branch 'upstream/develop' into UpdatingSymmetry…
argerlt Feb 28, 2026
ed1a829
fixing errors from 0.14 merge
argerlt Feb 28, 2026
56e5d48
more merge fixes, add example, address review comments
argerlt Feb 28, 2026
28ab862
passing tests.
argerlt Feb 28, 2026
eabf431
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion doc/tutorials/clustering_misorientations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"from orix.quaternion.symmetry import D6\n",
"from orix.vector import Vector3d\n",
"\n",
"\n",
"plt.rcParams.update({\"font.size\": 20, \"figure.figsize\": (10, 10)})\n",
"\n",
"register_projections()"
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/clustering_orientations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"from orix.quaternion.symmetry import D6\n",
"from orix.vector import AxAngle, Vector3d\n",
"\n",
"\n",
"plt.rcParams.update(\n",
" {\"font.size\": 20, \"figure.figsize\": (10, 10), \"figure.facecolor\": \"w\"}\n",
")"
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/crystal_directions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"from orix.quaternion import Orientation, Rotation, symmetry\n",
"from orix.vector import Miller, Vector3d\n",
"\n",
"\n",
"plt.rcParams.update(\n",
" {\n",
" \"figure.figsize\": (7, 7),\n",
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/crystal_map.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"from orix.quaternion import Orientation, Rotation, symmetry\n",
"from orix.vector import Vector3d\n",
"\n",
"\n",
"plt.rcParams.update({\"figure.figsize\": (7, 7), \"font.size\": 15})\n",
"tempdir = tempfile.mkdtemp() + \"/\""
]
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/inverse_pole_figures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"from orix.quaternion import Orientation, symmetry\n",
"from orix.vector import Vector3d\n",
"\n",
"\n",
"# We'll want our plots to look a bit larger than the default size\n",
"new_params = {\n",
" \"figure.facecolor\": \"w\",\n",
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/point_groups.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"from orix.quaternion import Rotation, symmetry\n",
"from orix.vector import Vector3d\n",
"\n",
"\n",
"plt.rcParams.update({\"font.size\": 15})"
]
},
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/s2_sampling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"from orix.quaternion import symmetry\n",
"from orix.sampling import sample_S2_methods, sample_S2\n",
"\n",
"\n",
"plt.rcParams.update({\"font.size\": 20, \"lines.markersize\": 2})"
]
},
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/stereographic_projection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"from orix import plot # Register orix' projections with Matplotlib\n",
"from orix.vector import Vector3d\n",
"\n",
"\n",
"# We'll want our plots to look a bit larger than the default size\n",
"plt.rcParams.update(\n",
" {\n",
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/uniform_sampling_of_orientation_space.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
"from orix.sampling import get_sample_fundamental\n",
"from orix.vector import Vector3d\n",
"\n",
"\n",
"plt.rcParams.update(\n",
" {\n",
" \"axes.grid\": True,\n",
Expand Down
66 changes: 66 additions & 0 deletions examples/stereographic_projection/plot_symmetry_advanced.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#
# Copyright 2018-2026 the orix developers
#
# This file is part of orix.
#
# orix is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# orix is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with orix. If not, see <http://www.gnu.org/licenses/>.
#

r"""
===============================
Altering Crystal Symmetry Plots
===============================

This example demonstrates some advanced methods for altering
stereographic plots of symmetries. For a more general example, see
:ref:`sphx_glr_plot_symmetry_operations.py`. For examples of how to make
symmetry objects, see :ref:`create_symmetry.py`
"""

import matplotlib.pyplot as plt
import numpy as np

import orix.plot as opl
import orix.quaternion as oqu
import orix.vector as ove

# Set a random seed for reproducability
np.random.seed = 897897
# Register our custom Matplotlib projections
opl.register_projections()
# Use the PointGroup Class to create a Symmetry from a common shorthand name
pg_Oh = oqu.symmetry.PointGroups.get("m-3m")

########################################################################################
# Typically, plots can be made using the built-in plot function. By default this
# will create a matplotlib Figure and Axis object, plot a single asymmetric
# vector, and add the Point Group name as the title
pg_Oh.plot()

########################################################################################
# Alternatively though, by creating a figure beforehand and passing the Axis
# in, it's possible to modify this plot as desired, for example by adding
# additional plots, changing the title, or modifying elements.

v = ove.Vector3d.random(10)
v_symm = pg_Oh.outer(v).flatten()
fig, ax = plt.subplots(1, 1, subplot_kw={"projection": "stereographic"})
pg_Oh.plot(ax=ax, show_name=False)
ax.set_title("my cool custom title")
ax.scatter(v_symm)

for i in range(len(ax.lines)):
ax.lines[i].set_c([0, 1, 1])

plt.show()
84 changes: 43 additions & 41 deletions examples/stereographic_projection/plot_symmetry_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,53 +21,55 @@
Plot symmetry operations
========================

This example shows how to draw proper symmetry operations :math:`s`
(no reflections or inversions).
This example shows how stereographic projections with symmetry operation
markers can be automatically generated for the 32 crystallographic point
groups.

The ordering used here follows the one given in section 9.2 of "Structures
of Materials" (DeGraef et.al, 2nd edition, 2012). This ordering starts with
the 5 cyclic groups (C1, C2, C3, C4, and C6), followed by the 4 dihedral
groups (D2, D3, D4, and D6). Next are the same groups combined with inversion
centers (Ci, Cs, C3i, S4, and C3h), perpendicular mirror planes (C2h, C4h,
and C6h), vertical mirror planes (C2v, C3v, C4v, and C6v), and diagonal
mirror planes (D3d, D2d, and D3h). Next are groups formed from permutations
of cyclic and dihedral groups (D2h, D4h, and D6h), and finally the groups
with 3-fold rotations around the 111 axes (T, O, Th, Td, and Oh).

The plots themselves as well as their labels follow the standards given
in Table 10.2.2 of the "International Tables for Crystallography, Volume
A" (ITC). Both the nomenclature and marker styles thus differ slightly from
many textbooks, including "Structure of Materials", as there are arbitrary
convention choices in ITC regarding both Schoenflies notation and marker
style.

Orix uses Schoenflies Notation (left label above each plot) for the default
symmetry group names since they are short and always begin with a letter,
but both Schoenflies and Hermann-Mauguin (right label above each plot) names
can be used to look up symmetry groups using `PointGroups.get()`
"""

import matplotlib.pyplot as plt

from orix.plot import register_projections
from orix.vector import Vector3d
import orix.plot as opl
import orix.quaternion as oqu
import orix.vector as ove

register_projections() # Register our custom Matplotlib projections
opl.register_projections() # Register our custom Matplotlib projections

marker_size = 200
fig, (ax0, ax1) = plt.subplots(
ncols=2,
subplot_kw={"projection": "stereographic"},
layout="tight",
)
# create a list of the 32 crystallographic point groups
point_groups = oqu.symmetry.PointGroups.get_set("procedural")

# show the table of symmetry information
print(point_groups)

ax0.set_title("432", pad=20)
# 4-fold (outer markers will be clipped a bit...)
v4fold = Vector3d([[0, 0, 1], [1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0]])
ax0.symmetry_marker(v4fold, fold=4, c="C4", s=marker_size)
ax0.draw_circle(v4fold, color="C4")
# 3-fold
v3fold = Vector3d([[1, 1, 1], [1, -1, 1], [-1, -1, 1], [-1, 1, 1]])
ax0.symmetry_marker(v3fold, fold=3, c="C3", s=marker_size)
ax0.draw_circle(v3fold, color="C3")
# 2-fold
# fmt: off
v2fold = Vector3d(
[
[ 1, 0, 1],
[ 0, 1, 1],
[-1, 0, 1],
[ 0, -1, 1],
[ 1, 1, 0],
[-1, -1, 0],
[-1, 1, 0],
[ 1, -1, 0],
]
# prepare the plots
fig, ax = plt.subplots(
4, 8, subplot_kw={"projection": "stereographic"}, figsize=[14, 10]
)
# fmt: on
ax0.symmetry_marker(v2fold, fold=2, c="C2", s=marker_size)
ax0.draw_circle(v2fold, color="C2")
ax = ax.flatten()

ax1.set_title("222", pad=20)
# 2-fold
v2fold = Vector3d([[0, 0, 1], [1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0]])
ax1.symmetry_marker(v2fold, fold=2, c="C2", s=2 * marker_size)
ax1.draw_circle(v2fold, color="C2")
# create a vector to mirror over axes
v = ove.Vector3d.from_polar(65, 80, degrees=True)
# Iterate through the 32 Point groups
for i, pg in enumerate(point_groups):
Comment thread
hakonanes marked this conversation as resolved.
pg.plot(asymmetric_vector=v, ax=ax[i])
27 changes: 10 additions & 17 deletions orix/crystal_map/_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,7 @@
import numpy as np

from orix.plot._util.color import get_matplotlib_color
from orix.quaternion.symmetry import (
_EDAX_POINT_GROUP_ALIASES,
VALID_SYSTEMS,
Symmetry,
_groups,
get_point_group,
)
from orix.quaternion.symmetry import VALID_SYSTEMS, PointGroups, Symmetry
from orix.vector.miller import Miller
from orix.vector.vector3d import Vector3d

Expand Down Expand Up @@ -225,7 +219,7 @@ def point_group(self) -> Symmetry | None:
Point group.
"""
if self.space_group is not None:
return get_point_group(self.space_group.number)
return PointGroups.from_space_group(self.space_group.number)
else:
return self._point_group

Expand All @@ -235,14 +229,7 @@ def point_group(self, value: int | str | Symmetry | None) -> None:
if isinstance(value, int):
value = str(value)
if isinstance(value, str):
for key, aliases in _EDAX_POINT_GROUP_ALIASES.items():
if value in aliases:
value = key
break
for point_group in _groups:
if value == point_group.name:
value = point_group
break
value = PointGroups.get(value)
if not isinstance(value, Symmetry) and value is not None:
raise ValueError(
f"{value!r} must be of type {Symmetry}, the name of a valid point group"
Expand Down Expand Up @@ -486,7 +473,13 @@ def new_structure_matrix_from_alignment(


def default_lattice(system: VALID_SYSTEMS) -> Lattice:
if system in ["triclinic", "monoclinic", "orthorhombic", "tetragonal", "cubic"]:
if system in [
"triclinic",
"monoclinic",
"orthorhombic",
"tetragonal",
"cubic",
]:
lat = Lattice()
elif system in ["trigonal", "hexagonal"]:
lat = Lattice(1, 1, 1, 90, 90, 120)
Expand Down
Loading
Loading