From 2ba0752b71dd8fc69e03b3ba96a51e0ab932f730 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 14 Jan 2020 23:56:52 +0100 Subject: [PATCH] ensure that symmetrically equivalent rotations have the same IPF color --- python/tests/test_Rotation.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py index e0a454590..012c95469 100644 --- a/python/tests/test_Rotation.py +++ b/python/tests/test_Rotation.py @@ -7,6 +7,7 @@ import numpy as np import damask from damask import Rotation from damask import Orientation +from damask import Lattice n = 1000 @@ -68,6 +69,14 @@ class TestRotation: for direction in set(permutations(np.array(color['direction']))): assert np.allclose(cube.IPFcolor(direction),np.array(color['RGB'])) + @pytest.mark.parametrize('lattice',Lattice.lattices) + def test_IPF(self,lattice): + direction = np.random.random(3)*2.0-1 + for rot in [Rotation.fromRandom() for r in range(n//100)]: + R = damask.Orientation(rot,lattice) + color = R.IPFcolor(direction) + for equivalent in R.equivalentOrientations(): + assert np.allclose(color,R.IPFcolor(direction)) @pytest.mark.parametrize('model',['Bain','KS','GT','GT_prime','NW','Pitsch']) @pytest.mark.parametrize('lattice',['fcc','bcc'])