polishing
This commit is contained in:
parent
ef0c78745a
commit
23365660d8
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -3,7 +3,6 @@ import random
|
|||
import pytest
|
||||
import numpy as np
|
||||
|
||||
from damask import Orientation
|
||||
from damask import Rotation
|
||||
from damask import Symmetry
|
||||
|
||||
|
|
Loading…
Reference in New Issue