-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #478 from hakonanes/prepare-for-0.12
Minor maintenance updates before 0.12.0 release
- Loading branch information
Showing
25 changed files
with
264 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,14 @@ If you think your work should be listed here, please raise an issue `on GitHub | |
<https://github.com/pyxem/orix>`__ or `contact the developers | ||
<[email protected]>`__. | ||
|
||
2024 | ||
==== | ||
- I. MacLaren, E. Frutos-Myro, S. Zeltmann, C. Ophus, "A method for crystallographic | ||
mapping of an alpha-beta titanium alloy with nanometre resolution using scanning | ||
precession electron diffraction and open-source software libraries," *Journal of | ||
Microscopy*, 1-9 (2024). | ||
https://doi/10.1111/jmi.13275. | ||
|
||
2022 | ||
==== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
""" | ||
======================== | ||
Create empty crystal map | ||
======================== | ||
This example shows how to create an empty crystal map of a given shape. | ||
By empty, we mean that it is filled with identity rotations. | ||
This crystal map can be useful for testing. | ||
""" | ||
|
||
from orix.crystal_map import CrystalMap | ||
|
||
xmap = CrystalMap.empty((5, 10)) | ||
|
||
print(xmap) | ||
print(xmap.rotations) | ||
|
||
xmap.plot("x") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
examples/rotations/rotating_z_to_high_symmetry_directions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
""" | ||
===================================================== | ||
Rotating z-vector to high-symmetry crystal directions | ||
===================================================== | ||
This example shows how to sample high-symmetry crystal directions | ||
:math:`\mathbf{t} = [u, v, w]` (or zone axes) using | ||
:meth:`orix.vector.Miller.from_highest_indices`. | ||
We will also return the rotations :math:`R` which rotate | ||
:math:`\mathbf{v_z} = (0, 0, 1)` to :math:`\mathbf{t}`. | ||
We do the following to obtain the high-symmetry crystal directions: | ||
1. Select a point group, here :math:`S = mmm`. | ||
2. Sample all directions :math:`\mathbf{t_i}` with indices of -1, 0, and 1 | ||
3. Project :math:`\mathbf{t_i}` to the fundamental sector of the Laue group of :math:`S` | ||
(which in this case is itself) | ||
4. Discard symmetrically equivalent and other duplicate crystal directions. | ||
Vectors such as [001] and [002] are considered equal after we make them unit vectors. | ||
5. Round the vector indices to the closest smallest integer (below a default of 20). | ||
The rotations :math:`R` can be useful e.g. when simulating diffraction patterns from | ||
crystals with one of the high-symmetry zone axes :math:`\mathbf{t}` aligned along the | ||
beam path. | ||
""" | ||
|
||
from orix.crystal_map import Phase | ||
from orix.quaternion import Rotation | ||
from orix.vector import Miller, Vector3d | ||
|
||
phase = Phase(point_group="mmm") | ||
t = Miller.from_highest_indices(phase, uvw=[1, 1, 1]) | ||
t = t.in_fundamental_sector() | ||
t = t.unit.unique(use_symmetry=True).round() | ||
print(t) | ||
|
||
######################################################################## | ||
# Get the rotations that rotate :math:`\mathbf{v_z}` to these crystal | ||
# directions | ||
vz = Miller(uvw=[0, 0, 1], phase=t.phase) | ||
R = Rotation.identity(t.size) | ||
for i, t_i in enumerate(t): | ||
R[i] = Rotation.from_align_vectors(t_i, vz) | ||
print(R) | ||
|
||
######################################################################## | ||
# Plot the crystal directions within the fundamental sector of Laue | ||
# group :math:`mmm` | ||
|
||
fig = t.scatter( | ||
vector_labels=[str(vi).replace(".", "") for vi in t.coordinates], | ||
text_kwargs={ | ||
"size": 15, | ||
"offset": (0, 0.03), | ||
"bbox": {"fc": "w", "pad": 2, "alpha": 0.75}, | ||
}, | ||
return_figure=True, | ||
) | ||
fig.axes[0].restrict_to_sector(t.phase.point_group.fundamental_sector) |
57 changes: 57 additions & 0 deletions
57
examples/rotations/rotations_mapping_fundamental_sector.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
""" | ||
================================================ | ||
Rotations mapping the fundamental sector on *S2* | ||
================================================ | ||
This example shows how to sample rotations :math:`\mathbf{R}` that when rotating the | ||
vector :math:`\mathbf{v_z} = (0, 0, 1)`, the resulting vectors cover the fundamental | ||
sector of a given Laue class. | ||
We show this by comparing the vectors we get by: | ||
1. Sampling rotations for *4/mmm* and then rotating :math:`\mathbf{v_z}` | ||
2. Sampling all of *S2* but only keeping those within the corresponding fundamental | ||
sector. | ||
Apart from the first rotation, all rotations have a Euler angle | ||
:math:`\phi = 0^{\circ}`. | ||
These "reduced" rotations can be useful in template matching of spot patterns from the | ||
transmission electron microscope. | ||
""" | ||
|
||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
from orix import plot, sampling | ||
from orix.quaternion import symmetry | ||
from orix.vector import Vector3d | ||
|
||
# Sample rotations with an average misorientation | ||
res = 2 | ||
pg = symmetry.D4h # 4/mmm | ||
|
||
R = sampling.get_sample_reduced_fundamental(res, point_group=pg) | ||
print(np.allclose(R.to_euler()[1:, 0], 0)) | ||
|
||
######################################################################## | ||
# Get vectors within the fundamental sector following the two routes | ||
v1 = R * Vector3d.zvector() | ||
|
||
v2 = sampling.sample_S2(res) | ||
v2 = v2[v2 <= pg.fundamental_sector] | ||
|
||
# Only equivalent for the same S2 sampling method | ||
print(np.allclose(v1.data, v2.data)) | ||
print(v1) | ||
print(v2) | ||
|
||
######################################################################## | ||
# Plot the vectors in the fundamental sector of Laue group 4/mmm | ||
fig, (ax0, ax1) = plt.subplots( | ||
ncols=2, subplot_kw={"projection": "ipf", "symmetry": pg}, layout="tight" | ||
) | ||
ax0.scatter(v1, s=5) | ||
ax1.scatter(v2, c="C1", s=5) | ||
ax0.set_title("Rotated Z vectors", loc="left") | ||
ax1.set_title("Directly sampled", loc="left") | ||
_ = fig.suptitle("Vectors in the fundamental sector of 4/mmm", y=0.8) |
Oops, something went wrong.