diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index f97e356fc..878face97 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -1219,6 +1219,6 @@ class Rotation: p = 2 else: p = np.where(np.maximum(np.abs(xyz[...,0]),np.abs(xyz[...,1])) <= np.abs(xyz[...,2]),0, - np.where(np.maximum(np.abs(xyz[...,1]),np.abs(xyz[...,2])) <= np.abs(xyz[...,0]),2,3)) + np.where(np.maximum(np.abs(xyz[...,1]),np.abs(xyz[...,2])) <= np.abs(xyz[...,0]),1,2)) return order[direction][p] diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py index 302e895ee..a46cf1a23 100644 --- a/python/tests/test_Rotation.py +++ b/python/tests/test_Rotation.py @@ -264,3 +264,18 @@ class TestRotation: for h,c in zip(ho,co): print(h,c) assert np.allclose(conversion(h),c) + + + @pytest.mark.parametrize('direction',['forward', + 'backward']) + def test_pyramid_vectorization(self,direction): + p = np.random.rand(n,3) + o = Rotation._get_order(p,direction) + for i,o_i in enumerate(o): + assert np.allclose(o_i,Rotation._get_order(p[i],direction)) + + def test_pyramid_invariant(self): + a = np.random.rand(n,3) + f = damask.Rotation._get_order(a,'forward') + b = damask.Rotation._get_order(a,'backward') + assert np.all(np.take_along_axis(np.take_along_axis(a,f,-1),b,-1) == a)