Skip to content

Commit

Permalink
Merge pull request #538 from hakonanes/prepare-0.13.3-release
Browse files Browse the repository at this point in the history
Prepare 0.13.3 release
  • Loading branch information
hakonanes authored Jan 5, 2025
2 parents dbb4c7e + 288da77 commit 6b94792
Show file tree
Hide file tree
Showing 14 changed files with 138 additions and 65 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ jobs:
include:
- os: ubuntu-latest
python-version: '3.10'
DEPENDENCIES: diffpy.structure==3.0.2 matplotlib==3.6.1
# Matplotlib 3.6.1 is not compatible with NumPy v2
DEPENDENCIES: diffpy.structure==3.0.2 matplotlib==3.6.1 "numpy<2"
LABEL: -oldest
- os: ubuntu-latest
python-version: '3.12'
Expand Down
16 changes: 16 additions & 0 deletions .license.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Copyright 2019-${years} the ${projectname} developers

This file is part of ${projectname}.

${projectname} 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.

${projectname} 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 ${projectname}. If not, see <http://www.gnu.org/licenses/>.
30 changes: 28 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
##
## Copyright 2019-2025 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/>.
##
repos:
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
- id: black-jupyter
Expand All @@ -13,7 +31,15 @@ repos:
name: isort (python)
args:
[--profile=black, --filter-files, --force-sort-within-sections]
- repo: https://github.com/johann-petrak/licenseheaders.git
rev: 'v0.8.8'
hooks:
- id: licenseheaders
args: ["-t", ".license.tmpl", "-cy", "-n", "orix", "-f"]
# https://pre-commit.ci/#configuration
ci:
# Don't run automatically on PRs, instead add the comment
# "pre-commit.ci autofix" on a pull request to manually trigger auto-fixing
autofix_prs: false
autofix_prs: false
# TODO: Remove skip once (nearly) all files are formatted with the license template
skip: [licenseheaders]
11 changes: 9 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ All user facing changes to this project are documented in this file. The format
on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`__, and this project tries
its best to adhere to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`__.

2025-01-01 - version 0.13.3
==========

Fixed
-----
- Handle all EDAX TSL point group aliases.

2024-09-25 - version 0.13.2
===========================

Expand Down Expand Up @@ -234,7 +241,7 @@ Added
- Seven methods for sampling unit vectors from regular grids on *S2* via
``orix.sampling.sample_S2()``.
- Calculation of the Inverse Pole Density Function (IPDF), ie. pole density in the
crystal point group fundamental sector, through
crystal point group fundamental sector, through
``InversePoleFigurePlot.pole_density_function()``.
- The ``orix.measure`` module has been introduced. The ``measure`` module is related to
quantification of orientation and vector data.
Expand Down Expand Up @@ -422,7 +429,7 @@ Deprecated
- Setting (Mis)Orientation symmetry via ``set_symmetry()`` is deprecated in 0.8, in
favour of setting it directly via a ``symmetry.setter``, and will be removed in 0.9.
Use ``map_into_symmetry_reduced_zone()`` instead.

Removed
-------
- ``StereographicPlot`` methods ``azimuth_grid()`` and ``polar_grid()``.
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ orix is released under the GPL v3 license.
.. |build_status| image:: https://github.com/pyxem/orix/workflows/build/badge.svg
:target: https://github.com/pyxem/orix/actions/workflows/build.yml

.. |python| image:: https://img.shields.io/badge/python-3.8+-blue.svg
.. |python| image:: https://img.shields.io/badge/python-3.10+-blue.svg
:target: https://www.python.org/downloads/

.. |Coveralls| image:: https://coveralls.io/repos/github/pyxem/orix/badge.svg?branch=develop
Expand Down
3 changes: 3 additions & 0 deletions doc/dev/setting_up_development_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ globally (in the ``conda`` environment)::

This installs all necessary development dependencies, including those for running tests
and building documentation.

Finally, please insteall the pre-commit hooks as described in the :doc:`/dev/code_style`
guide.
19 changes: 18 additions & 1 deletion orix/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
__version__ = "0.13.2"
#
# Copyright 2018-2024 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/>.#
__version__ = "0.13.3"
# Sorted by line contributions (ideally excluding lines in notebook files)
__credits__ = [
"Håkon Wiik Ånes",
Expand Down
6 changes: 3 additions & 3 deletions orix/crystal_map/phase_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
import numpy as np

from orix.quaternion.symmetry import (
_EDAX_POINT_GROUP_ALIASES,
Symmetry,
_groups,
get_point_group,
point_group_aliases,
)
from orix.vector import Miller, Vector3d

Expand Down Expand Up @@ -229,9 +229,9 @@ def point_group(self, value: int | str | Symmetry | None) -> None:
if isinstance(value, int):
value = str(value)
if isinstance(value, str):
for correct, aliases in point_group_aliases.items():
for key, aliases in _EDAX_POINT_GROUP_ALIASES.items():
if value in aliases:
value = correct
value = key
break
for point_group in _groups:
if value == point_group.name:
Expand Down
6 changes: 3 additions & 3 deletions orix/io/plugins/ang.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from orix import __version__
from orix.crystal_map import CrystalMap, PhaseList, create_coordinate_arrays
from orix.quaternion import Rotation
from orix.quaternion.symmetry import point_group_aliases
from orix.quaternion.symmetry import _EDAX_POINT_GROUP_ALIASES

__all__ = ["file_reader", "file_writer"]

Expand Down Expand Up @@ -594,9 +594,9 @@ def _get_header_from_phases(xmap: CrystalMap) -> str:
else:
proper_point_group = phase.point_group.proper_subgroup
point_group_name = proper_point_group.name
for key, alias in point_group_aliases.items():
for key, aliases in _EDAX_POINT_GROUP_ALIASES.items():
if point_group_name == key:
point_group_name = alias[0]
point_group_name = aliases[0]
break
header += (
f"Phase {phase_id}\n"
Expand Down
57 changes: 26 additions & 31 deletions orix/plot/direction_color_keys/direction_color_key_tsl.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#
# Copyright 2018-2024 the orix developers
#
# This file is part of orix.
Expand All @@ -13,9 +14,7 @@
# 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/>.

from typing import Optional, Tuple, Union
# along with orix. If not, see <http://www.gnu.org/licenses/>.#

from matplotlib.figure import Figure
import numpy as np
Expand All @@ -33,42 +32,39 @@


class DirectionColorKeyTSL(DirectionColorKey):
"""Assign colors to (crystal) directions rotated by crystal
orientations and projected into an inverse pole figure, according to
the Laue symmetry of the crystal.
This is based on the TSL color key implemented in MTEX.
"""Assign colors to crystal directions in a fundamental sector given
by one of the eleven Laue symmetries.
Parameters
----------
symmetry
Crystal symmetry. If a non-Laue symmetry is given, the
corresponding Laue symmetry is used.
Notes
-----
Coloring is based on the EDAX TSL color key as implemented in MTEX.
"""

def __init__(self, symmetry: Symmetry) -> None:
"""Create an inverse pole figure (IPF) color key to color
crystal directions according to a Laue symmetry's fundamental
sector (IPF).
Parameters
----------
symmetry
(Laue) symmetry of the crystal. If a non-Laue symmetry
is given, the Laue symmetry of that symmetry will be used.
"""
laue_symmetry = symmetry.laue
super().__init__(laue_symmetry)

def direction2color(self, direction: Vector3d) -> np.ndarray:
"""Return an RGB color per orientation given a Laue symmetry
and a sample direction.
"""Return an RGB color per (crystal) direction.
Plot the inverse pole figure color key with :meth:`plot`.
Parameters
----------
direction
Directions to color.
Crystal directions to color. Each direction is rotated to
the fundamental sector of the Laue symmetry.
Returns
-------
rgb
Color array of shape ``direction.shape + (3,)``.
Color array of shape direction.shape + (3,).
"""
laue_group = self.symmetry
h = direction.in_fundamental_sector(laue_group)
Expand All @@ -78,11 +74,10 @@ def direction2color(self, direction: Vector3d) -> np.ndarray:

def _create_rgba_grid(
self, alpha: float = 1.0, return_extent: bool = False
) -> Union[
np.ndarray,
Tuple[np.ndarray, Tuple[Tuple[float, float], Tuple[float, float]]],
]:
"""Create the 2d colormap used to represent crystal directions.
) -> (
np.ndarray | tuple[np.ndarray, tuple[tuple[float, float], tuple[float, float]]]
):
"""Return the 2D colormap used to represent crystal directions.
Parameters
----------
Expand All @@ -107,7 +102,7 @@ def _create_rgba_grid(
sector = laue_group.fundamental_sector

v = sample_S2(2)
v2 = Vector3d(np.row_stack((v[v <= sector].data, sector.edges.data)))
v2 = Vector3d(np.vstack((v[v <= sector].data, sector.edges.data)))

rgb = self.direction2color(v2)
r, g, b = rgb.T
Expand Down Expand Up @@ -144,18 +139,18 @@ def _create_rgba_grid(
else:
return rgba_grid

def plot(self, return_figure: bool = False) -> Optional[Figure]:
def plot(self, return_figure: bool = False) -> Figure | None:
"""Plot the inverse pole figure color key.
Parameters
----------
return_figure
Whether to return the figure. Default is ``False``.
Whether to return the figure. Default is False.
Returns
-------
figure
Color key figure, returned if ``return_figure=True``.
Color key figure, returned if *return_figure* is True.
"""
from orix.plot.inverse_pole_figure_plot import _setup_inverse_pole_figure_plot

Expand Down
5 changes: 3 additions & 2 deletions orix/quaternion/rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ def __mul__(
return Q
if isinstance(other, Vector3d):
v = Quaternion(self) * other
improper = (self.improper * np.ones(other.shape)).astype(bool)
v[improper] = -v[improper]
if np.any(self.improper):
improper = (self.improper * np.ones(other.shape)).astype(bool)
v[improper] = -v[improper]
return v
if isinstance(other, int) or isinstance(other, list): # abs(1)
other = np.atleast_1d(other).astype(int)
Expand Down
Loading

0 comments on commit 6b94792

Please sign in to comment.