diff --git a/python/damask/_config.py b/python/damask/_config.py index c7e937656..9aa031ff0 100644 --- a/python/damask/_config.py +++ b/python/damask/_config.py @@ -115,7 +115,7 @@ class Config(dict): """ Delete item. - key : dict + key : str or scalar Label of the key to remove. """ duplicate = self.copy() diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index b7be4f16d..d68cea6d3 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -234,18 +234,15 @@ class Rotation: def apply(self,other): """ - Apply rotation to vector or second/forth order tensor field. + Apply rotation to vector, second or fourth order tensor, or rotation object. Parameters ---------- - other : numpy.ndarray of shape (...,3), (...,3,3), or (...,3,3,3,3) - Vector or tensor on which the rotation is apply + other : numpy.ndarray of shape (...,3), (...,3,3), or (...,3,3,3,3) or Rotation + Vector, tensor, or rotation object on which to apply the rotation. """ - if isinstance(other,np.ndarray): - return self@other - else: - raise TypeError('Use "R1*R2" or "R1/R2", to compose rotations') + return self@other def __matmul__(self,other): diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py index 3def59213..707bc0210 100644 --- a/python/tests/test_Rotation.py +++ b/python/tests/test_Rotation.py @@ -1021,13 +1021,10 @@ class TestRotation: R = Rotation.from_random() assert R/R == R*R**(-1) == Rotation() - @pytest.mark.parametrize('vec',[np.ones(3),np.ones((3,3)), np.ones((3,3,3,3))]) - def test_apply(self,vec): - assert (Rotation().from_random().apply(vec)).all() - - def test_apply_invalid(self): - with pytest.raises(TypeError): - Rotation().apply(Rotation()) + @pytest.mark.parametrize('item',[Rotation(),np.ones(3),np.ones((3,3)), np.ones((3,3,3,3))]) + def test_apply(self,item): + r = Rotation.from_random() + assert r.apply(item) == r@item if isinstance(item,Rotation) else (r.apply(item) == r@item).all() @pytest.mark.parametrize('angle',[10,20,30,40,50,60,70,80,90,100,120]) def test_average(self,angle):