From 64163232981b35a0e4c05bee779e0e39b6ffae43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Sat, 22 Apr 2023 17:02:42 +0200 Subject: [PATCH] Expedite removal of 'convention' in some Quaternion methods to 0.13 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- CHANGELOG.rst | 2 ++ orix/quaternion/quaternion.py | 8 ++++---- orix/quaternion/rotation.py | 4 ++-- orix/tests/quaternion/test_orientation.py | 10 +++++----- orix/tests/quaternion/test_quaternion.py | 10 +++++----- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 422001df..6b3ead2f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,8 @@ Added Changed ------- +- The ``convention`` parameter in ``from_euler()`` and ``to_euler()`` will be removed in + the next minor release, 0.13, instead of release 1.0 as previously stated. Deprecated ---------- diff --git a/orix/quaternion/quaternion.py b/orix/quaternion/quaternion.py index 19e0624d..9a3b69b5 100644 --- a/orix/quaternion/quaternion.py +++ b/orix/quaternion/quaternion.py @@ -297,9 +297,9 @@ def from_axes_angles( q = cls.from_neo_euler(axangle).unit return q - # TODO: Remove decorator, **kwargs, and use of "convention" in 1.0 + # TODO: Remove decorator, **kwargs, and use of "convention" in 0.13 @classmethod - @deprecated_argument("convention", "0.9", "1.0", "direction") + @deprecated_argument("convention", "0.9", "0.13", "direction") def from_euler( cls, euler: Union[np.ndarray, tuple, list], @@ -772,8 +772,8 @@ def outer( "with `other` of type `Quaternion` or `Vector3d`" ) - # TODO: Remove decorator and **kwargs in 1.0 - @deprecated_argument("convention", since="0.9", removal="1.0") + # TODO: Remove decorator and **kwargs in 0.13 + @deprecated_argument("convention", since="0.9", removal="0.13") def to_euler(self, degrees: bool = False, **kwargs) -> np.ndarray: r"""Return the normalized quaternions as Euler angles in the Bunge convention :cite:`rowenhorst2015consistent`. diff --git a/orix/quaternion/rotation.py b/orix/quaternion/rotation.py index c5caa4f7..74960663 100644 --- a/orix/quaternion/rotation.py +++ b/orix/quaternion/rotation.py @@ -224,7 +224,7 @@ def from_axes_angles( """ return super().from_axes_angles(axes, angles, degrees) - # TODO: Remove **kwargs in 1.0. + # TODO: Remove **kwargs in 0.13 # Deprication decorator is implemented in Quaternion @classmethod def from_euler( @@ -719,7 +719,7 @@ def to_matrix(self) -> np.ndarray: """ return super().to_matrix() - # TODO: Remove **kwargs in 1.0 + # TODO: Remove **kwargs in 0.13 def to_euler(self, degrees: bool = False, **kwargs) -> np.ndarray: r"""Return the rotations as Euler angles in the Bunge convention :cite:`rowenhorst2015consistent`. diff --git a/orix/tests/quaternion/test_orientation.py b/orix/tests/quaternion/test_orientation.py index 89a1ae0d..e39f6dfd 100644 --- a/orix/tests/quaternion/test_orientation.py +++ b/orix/tests/quaternion/test_orientation.py @@ -561,7 +561,7 @@ def test_from_scipy_rotation(self): with pytest.raises(TypeError, match="Value must be an instance of"): _ = Orientation.from_scipy_rotation(r_scipy, (Oh, Oh)) - # TODO: Remove in 1.0 + # TODO: Remove in 0.13 def test_from_euler_warns(self): """Orientation.from_euler() warns only once when "convention" argument is passed. @@ -573,7 +573,7 @@ def test_from_euler_warns(self): _ = Orientation.from_euler(euler) msg = ( - r"Argument `convention` is deprecated and will be removed in version 1.0. " + r"Argument `convention` is deprecated and will be removed in version 0.13. " r"To avoid this warning, please do not use `convention`. " r"Use `direction` instead. See the documentation of `from_euler\(\)` for " "more details." @@ -582,7 +582,7 @@ def test_from_euler_warns(self): _ = Orientation.from_euler(euler, convention="whatever") assert len(record2) == 1 - # TODO: Remove in 1.0 + # TODO: Remove in 0.13 def test_from_euler_convention_mtex(self): """Passing convention="mtex" to Orientation.from_euler() works but warns once. @@ -593,7 +593,7 @@ def test_from_euler_convention_mtex(self): ori2 = Orientation.from_euler(euler, convention="mtex") assert np.allclose(ori1.data, ori2.data) - # TODO: Remove in 1.0 + # TODO: Remove in 0.13 def test_to_euler_convention_warns(self): """Orientation.to_euler() warns only once when "convention" argument is passed. @@ -605,7 +605,7 @@ def test_to_euler_convention_warns(self): ori2 = ori1.to_euler() msg = ( - r"Argument `convention` is deprecated and will be removed in version 1.0. " + r"Argument `convention` is deprecated and will be removed in version 0.13. " r"To avoid this warning, please do not use `convention`. " r"See the documentation of `to_euler\(\)` for more details." ) diff --git a/orix/tests/quaternion/test_quaternion.py b/orix/tests/quaternion/test_quaternion.py index 6b04940e..cdfd314f 100644 --- a/orix/tests/quaternion/test_quaternion.py +++ b/orix/tests/quaternion/test_quaternion.py @@ -355,7 +355,7 @@ def test_passing_degrees_warns(self): q = Quaternion.from_euler([90, 0, 0]) assert np.allclose(q.data, [0.5253, 0, 0, -0.8509], atol=1e-4) - # TODO: Remove in 1.0 + # TODO: Remove in 0.13 def test_from_euler_warns(self, eu): """Quaternion.from_euler() warns only when "convention" argument is passed. @@ -366,7 +366,7 @@ def test_from_euler_warns(self, eu): _ = Quaternion.from_euler(eu) msg = ( - r"Argument `convention` is deprecated and will be removed in version 1.0. " + r"Argument `convention` is deprecated and will be removed in version 0.13. " r"To avoid this warning, please do not use `convention`. " r"Use `direction` instead. See the documentation of `from_euler\(\)` for " "more details." @@ -374,7 +374,7 @@ def test_from_euler_warns(self, eu): with pytest.warns(np.VisibleDeprecationWarning, match=msg): _ = Quaternion.from_euler(eu, convention="whatever") - # TODO: Remove in 1.0 + # TODO: Remove in 0.13 def test_from_euler_convention_mtex(self, eu): """Passing convention="mtex" to Quaternion.from_euler() works but warns. @@ -384,7 +384,7 @@ def test_from_euler_convention_mtex(self, eu): q2 = Quaternion.from_euler(eu, convention="mtex") assert np.allclose(q1.data, q2.data) - # TODO: Remove in 1.0 + # TODO: Remove in 0.13 def test_to_euler_convention_warns(self, eu): """Quaternion.to_euler() warns only when "convention" argument is passed. @@ -397,7 +397,7 @@ def test_to_euler_convention_warns(self, eu): q2 = q1.to_euler() msg = ( - r"Argument `convention` is deprecated and will be removed in version 1.0. " + r"Argument `convention` is deprecated and will be removed in version 0.13. " r"To avoid this warning, please do not use `convention`. " r"See the documentation of `to_euler\(\)` for more details." )