fix for broken representation of no-rotation orientations and averaging weights
This commit is contained in:
parent
6d5c3a5d12
commit
4796afdd92
|
@ -226,9 +226,9 @@ class Orientation(Rotation):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return super().__eq__(other) \
|
return super().__eq__(other) \
|
||||||
and self.family == other.family \
|
and hasattr(other, 'family') and self.family == other.family \
|
||||||
and self.lattice == other.lattice \
|
and hasattr(other, 'lattice') and self.lattice == other.lattice \
|
||||||
and self.parameters == other.parameters
|
and hasattr(other, 'parameters') and self.parameters == other.parameters
|
||||||
|
|
||||||
|
|
||||||
def __matmul__(self,other):
|
def __matmul__(self,other):
|
||||||
|
|
|
@ -204,8 +204,16 @@ class Rotation:
|
||||||
|
|
||||||
|
|
||||||
def append(self,other):
|
def append(self,other):
|
||||||
"""Extend rotation array along first dimension with other array."""
|
"""
|
||||||
return self.copy(rotation=np.vstack((self.quaternion,other.quaternion)))
|
Extend rotation array along first dimension with other array(s).
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
other : Rotation or list of Rotations.
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.copy(rotation=np.vstack(tuple(map(lambda x:x.quaternion,
|
||||||
|
[self]+other if type(other) == list else [self,other]))))
|
||||||
|
|
||||||
|
|
||||||
def flatten(self,order = 'C'):
|
def flatten(self,order = 'C'):
|
||||||
|
@ -263,7 +271,7 @@ class Rotation:
|
||||||
"""Intermediate representation supporting quaternion averaging."""
|
"""Intermediate representation supporting quaternion averaging."""
|
||||||
return np.einsum('...i,...j',quat,quat)
|
return np.einsum('...i,...j',quat,quat)
|
||||||
|
|
||||||
if not weights:
|
if weights is None:
|
||||||
weights = np.ones(self.shape,dtype=float)
|
weights = np.ones(self.shape,dtype=float)
|
||||||
|
|
||||||
eig, vec = np.linalg.eig(np.sum(_M(self.quaternion) * weights[...,np.newaxis,np.newaxis],axis=-3) \
|
eig, vec = np.linalg.eig(np.sum(_M(self.quaternion) * weights[...,np.newaxis,np.newaxis],axis=-3) \
|
||||||
|
|
Loading…
Reference in New Issue