From 7ee68521f71e6d36249cc3f9ac07fac3754436f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=CC=8Akon=20Wiik=20A=CC=8Anes?= Date: Mon, 2 Sep 2024 20:23:40 +0200 Subject: [PATCH 1/5] Temporarily add PyCIFRW as dependency (dependency of diffpy.structure) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index fd889bde..dfcc4c09 100644 --- a/setup.py +++ b/setup.py @@ -93,6 +93,8 @@ "numpy", "numpy-quaternion", "pooch >= 0.13", + # TODO: Remove once https://github.com/diffpy/diffpy.structure/issues/97 is fixed + "pycifrw", "scipy", "tqdm", ], From 7736ab1c8096ab9da8fda6c4062bcf37d2780ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=CC=8Akon=20Wiik=20A=CC=8Anes?= Date: Mon, 2 Sep 2024 20:28:30 +0200 Subject: [PATCH 2/5] Minor fixes in crystal map and rotation plots using Matplotlib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- orix/tests/plot/test_crystal_map_plot.py | 2 +- orix/tests/plot/test_rotation_plot.py | 165 +++++++++++------------ 2 files changed, 82 insertions(+), 85 deletions(-) diff --git a/orix/tests/plot/test_crystal_map_plot.py b/orix/tests/plot/test_crystal_map_plot.py index 86cb2f52..3766a32e 100644 --- a/orix/tests/plot/test_crystal_map_plot.py +++ b/orix/tests/plot/test_crystal_map_plot.py @@ -375,7 +375,7 @@ def test_status_bar_silence_default_format_coord(self, crystal_map): fig = plt.figure() ax = fig.add_subplot(projection=PLOT_MAP) _ = ax.plot_map(crystal_map) - assert ax.format_coord(0, 0) == "x=0 y=0" + assert ax.format_coord(0, 0) == "(x, y) = (0, 0)" fig = plt.figure() ax = fig.add_subplot(projection=PLOT_MAP) diff --git a/orix/tests/plot/test_rotation_plot.py b/orix/tests/plot/test_rotation_plot.py index 4385a9e9..8fe36e1c 100644 --- a/orix/tests/plot/test_rotation_plot.py +++ b/orix/tests/plot/test_rotation_plot.py @@ -25,87 +25,84 @@ from orix.quaternion.symmetry import C1, D6 -def test_init_rodrigues_plot(): - fig = plt.figure() - ax = fig.add_subplot(projection="rodrigues", auto_add_to_figure=False) - assert isinstance(ax, RodriguesPlot) - - -def test_init_axangle_plot(): - fig = plt.figure() - ax = fig.add_subplot(projection="axangle", auto_add_to_figure=False) - assert isinstance(ax, AxAnglePlot) - - -def test_RotationPlot_methods(): - """This code is lifted from demo-3-v0.1.""" - misori = Misorientation([1, 1, 1, 1]) # any will do - ori = Orientation.random() - fig = plt.figure() - ax = fig.add_subplot( - projection="axangle", proj_type="ortho", auto_add_to_figure=False - ) - ax.scatter(misori) - ax.scatter(ori) - ax.plot(misori) - ax.plot(ori) - ax.plot_wireframe(OrientationRegion.from_symmetry(D6, D6)) - plt.close("all") - - # Clear the edge case - ax.transform(np.asarray([1, 1, 1])) - - -def test_full_region_plot(): - empty = OrientationRegion.from_symmetry(C1, C1) - _ = empty.get_plot_data() - - -def test_RotationPlot_transform_fundamental_zone_raises(): - fig = plt.figure() - ax = RotationPlot(fig) - fig.add_axes(ax) - with pytest.raises( - TypeError, match="fundamental_zone is not an OrientationRegion object" - ): - ax.transform(Orientation.random(), fundamental_zone=1) - - -def test_RotationPlot_map_into_symmetry_reduced_zone(): - # orientations are (in, out) of D6 fundamental zone - ori = Orientation(((1, 0, 0, 0), (0.5, 0.5, 0.5, 0.5))) - ori.symmetry = D6 - fz = OrientationRegion.from_symmetry(ori.symmetry) - assert np.allclose(ori < fz, (True, False)) - # test map_into_symmetry_reduced_zone in RotationPlot.transform - fig = ori.scatter(return_figure=True) - xyz_symmetry = fig.axes[0].collections[1]._offsets3d - # compute same plot again but with C1 symmetry where both orientations are in C1 FZ - ori.symmetry = C1 - fig2 = ori.scatter(return_figure=True) - xyz = fig2.axes[0].collections[1]._offsets3d - # test that the plotted points are not the same - assert not np.allclose(xyz_symmetry, xyz) - - -def test_correct_aspect_ratio(): - # Set up figure the "old" way - fig = plt.figure() - ax = fig.add_subplot( - projection="axangle", proj_type="ortho", auto_add_to_figure=False - ) - - # Check aspect ratio - x_old, _, z_old = ax.get_box_aspect() - assert np.allclose(x_old / z_old, 1.334, atol=1e-3) - - fr = OrientationRegion.from_symmetry(D6) - ax._correct_aspect_ratio(fr, set_limits=False) - - x_new, _, z_new = ax.get_box_aspect() - assert np.allclose(x_new / z_new, 3, atol=1e-3) - - # Check data limits - assert np.allclose(ax.get_xlim(), [0, 1]) - ax._correct_aspect_ratio(fr) # set_limits=True is default - assert np.allclose(ax.get_xlim(), [-np.pi / 2, np.pi / 2]) +class TestRodriguesPlot: + def test_creation(self): + fig = plt.figure() + ax = fig.add_subplot(projection="rodrigues") + assert isinstance(ax, RodriguesPlot) + + +class TestAxisAnglePlot: + def test_creation(self): + fig = plt.figure() + ax = fig.add_subplot(projection="axangle") + assert isinstance(ax, AxAnglePlot) + + plt.close("all") + + def test_rotation_plot(self): + M = Misorientation.random() + O = Orientation.random() + fig = plt.figure() + ax = fig.add_subplot(projection="axangle", proj_type="ortho") + ax.scatter(M) + ax.scatter(O) + ax.plot(M) + ax.plot(O) + ax.plot_wireframe(OrientationRegion.from_symmetry(D6, D6)) + + ax.transform(np.asarray([1, 1, 1])) # Edge case + + plt.close("all") + + def test_get_plot_data(self): + empty = OrientationRegion.from_symmetry(C1, C1) + _ = empty.get_plot_data() + + def test_rotation_plot_transform_fundamental_zone_raises(self): + fig = plt.figure() + ax = RotationPlot(fig) + fig.add_axes(ax) + with pytest.raises(TypeError, match="fundamental_zone is not an "): + ax.transform(Orientation.random(), fundamental_zone=1) + + def test_rotation_plot_map_into_symmetry_reduced_zone(self): + # Orientations are (in, out) of D6 fundamental zone + O = Orientation(((1, 0, 0, 0), (0.5, 0.5, 0.5, 0.5))) + O.symmetry = D6 + fz = OrientationRegion.from_symmetry(O.symmetry) + assert np.allclose(O < fz, (True, False)) + + # test map_into_symmetry_reduced_zone in RotationPlot.transform + fig = O.scatter(return_figure=True) + xyz_symmetry = fig.axes[0].collections[1]._offsets3d + + # compute same plot again but with C1 symmetry where both orientations are in C1 FZ + O.symmetry = C1 + fig2 = O.scatter(return_figure=True) + xyz = fig2.axes[0].collections[1]._offsets3d + + # test that the plotted points are not the same + assert not np.allclose(xyz_symmetry, xyz) + + plt.close("all") + + def test_correct_aspect_ratio(self): + fig = plt.figure() + ax = fig.add_subplot(projection="axangle", proj_type="ortho") + + # Check aspect ratio + x_old, _, z_old = ax.get_box_aspect() + assert np.allclose(x_old / z_old, 1.334, atol=1e-3) + + fr = OrientationRegion.from_symmetry(D6) + ax._correct_aspect_ratio(fr, set_limits=False) + + x_new, _, z_new = ax.get_box_aspect() + assert np.allclose(x_new / z_new, 3, atol=1e-3) + + assert np.allclose(ax.get_xlim(), [0, 1], atol=0.1) + ax._correct_aspect_ratio(fr) # set_limits=True is default + assert np.allclose(ax.get_xlim(), [-np.pi / 2, np.pi / 2]) + + plt.close("all") From 54aeadf0a17877b0ee5ee4559c69409cb5671ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=CC=8Akon=20Wiik=20A=CC=8Anes?= Date: Mon, 2 Sep 2024 20:45:48 +0200 Subject: [PATCH 3/5] Increment version to 0.13.0 and update CHANGELOG accordingly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- CHANGELOG.rst | 8 ++------ orix/__init__.py | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 75b13d7a..ee0fb9b3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,8 +6,8 @@ All user facing changes to this project are documented in this file. The format on `Keep a Changelog `__, and this project tries its best to adhere to `Semantic Versioning `__. -Unreleased -========== +2024-09-03 - version 0.13.0 +=========================== Added ----- @@ -30,10 +30,6 @@ Deprecated - ``loadang()`` and ``loadctf()`` are deprecated and will be removed in the next minor release. Please use ``io.load()`` instead. -Fixed ------ - - 2024-04-21 - version 0.12.1 =========================== diff --git a/orix/__init__.py b/orix/__init__.py index 283e5019..18ea610e 100644 --- a/orix/__init__.py +++ b/orix/__init__.py @@ -1,5 +1,5 @@ __name__ = "orix" -__version__ = "0.13.dev1" +__version__ = "0.13.0" __author__ = "orix developers" __author_email__ = "pyxem.team@gmail.com" __description__ = "orix is an open-source Python library for handling crystal orientation mapping data." From d94130b994bf42615d8652652642526779dc42a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=CC=8Akon=20Wiik=20A=CC=8Anes?= Date: Mon, 2 Sep 2024 20:46:05 +0200 Subject: [PATCH 4/5] Fix links to related projects in docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- doc/user/related_projects.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/user/related_projects.rst b/doc/user/related_projects.rst index bb911a94..bdb2f8e0 100644 --- a/doc/user/related_projects.rst +++ b/doc/user/related_projects.rst @@ -24,8 +24,8 @@ find useful: orix depends on numpy-quaternion for quaternion multiplication. - `texture `_: Python scripts for analysis of crystallographic texture. -- `pymicro `_`: Python package to work with material +- `pymicro `_: Python package to work with material microstructures and 3D data sets. -- `DREAM.3D `_`: C++ library to reconstruct, instatiate, quantify, +- `DREAM.3D `_: C++ library to reconstruct, instatiate, quantify, mesh, handle and visualize multidimensional (3D), multimodal data (mainly EBSD orientation data). \ No newline at end of file From 7f1898ff5959ba8272b2a182a4a9f1743e9d6963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=CC=8Akon=20Wiik=20A=CC=8Anes?= Date: Tue, 3 Sep 2024 20:44:21 +0200 Subject: [PATCH 5/5] Set version to 0.14.dev0 and add "Unreleased" section to changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- CHANGELOG.rst | 18 ++++++++++++++++++ orix/__init__.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ee0fb9b3..60466a48 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,24 @@ All user facing changes to this project are documented in this file. The format on `Keep a Changelog `__, and this project tries its best to adhere to `Semantic Versioning `__. +Unreleased +========== + +Added +----- + +Changed +------- + +Deprecated +---------- + +Removed +------- + +Fixed +----- + 2024-09-03 - version 0.13.0 =========================== diff --git a/orix/__init__.py b/orix/__init__.py index 18ea610e..13604a79 100644 --- a/orix/__init__.py +++ b/orix/__init__.py @@ -1,5 +1,5 @@ __name__ = "orix" -__version__ = "0.13.0" +__version__ = "0.14.dev0" __author__ = "orix developers" __author_email__ = "pyxem.team@gmail.com" __description__ = "orix is an open-source Python library for handling crystal orientation mapping data."