diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index c59ababda..cb28c160e 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -40,6 +40,7 @@ class Orientation: # ToDo: make subclass of lattice and Rotation self.rotation = Rotation.from_quaternion(rotation) # assume quaternion def __getitem__(self,item): + """Iterate over leading/leftmost dimension of Orientation array.""" return self.__class__(self.rotation[item],self.lattice) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index accd453cc..26fd3e261 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -81,17 +81,16 @@ class Rotation: ]) - def __len__(self): - return 0 if self.shape == () else len(self.shape) - - def __getitem__(self,item): + """Iterate over leading/leftmost dimension of Rotation array.""" + if self.shape == (): return self.copy() if isinstance(item,tuple) and len(item) >= len(self): raise IndexError('Too many indices') return self.__class__(self.quaternion[item]) def __len__(self): + """Length of leading/leftmost dimension of Rotation array.""" return 0 if self.shape == () else self.shape[0] @@ -104,9 +103,10 @@ class Rotation: other : numpy.ndarray or Rotation Vector, second or fourth order tensor, or rotation object that is rotated. - Todo - ---- - Check rotation of 4th order tensor + Returns + ------- + other_rot : numpy.ndarray or Rotation + Rotated vector, second or fourth order tensor, or rotation object. """ if isinstance(other, Rotation): diff --git a/python/tests/test_Lattice.py b/python/tests/test_Lattice.py index f53c3ad03..aa201c645 100644 --- a/python/tests/test_Lattice.py +++ b/python/tests/test_Lattice.py @@ -3,7 +3,6 @@ import random import pytest import numpy as np -from damask import Orientation from damask import Rotation from damask import Symmetry