moved typecheck of __ne__ functions to __eq__
added initial empty runtimeerror to Schmid function minor corrections
This commit is contained in:
parent
f80de7d0b3
commit
d1f9e98e3c
|
@ -165,8 +165,10 @@ class Orientation(Rotation,Crystal):
|
||||||
Orientation to check for equality.
|
Orientation to check for equality.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not isinstance(other, Orientation):
|
|
||||||
raise TypeError
|
eq = self.__eq__(other)
|
||||||
|
if not isinstance(eq, bool):
|
||||||
|
return eq
|
||||||
return np.logical_not(self==other)
|
return np.logical_not(self==other)
|
||||||
|
|
||||||
|
|
||||||
|
@ -557,7 +559,7 @@ class Orientation(Rotation,Crystal):
|
||||||
if self.family != other.family:
|
if self.family != other.family:
|
||||||
raise NotImplementedError('disorientation between different crystal families')
|
raise NotImplementedError('disorientation between different crystal families')
|
||||||
|
|
||||||
blend: Tuple[int, ...] = util.shapeblender(self.shape,other.shape)
|
blend = util.shapeblender(self.shape,other.shape)
|
||||||
s = self.equivalent
|
s = self.equivalent
|
||||||
o = other.equivalent
|
o = other.equivalent
|
||||||
|
|
||||||
|
@ -764,7 +766,7 @@ class Orientation(Rotation,Crystal):
|
||||||
np.broadcast_to(self.standard_triangle['improper'], vector_.shape+(3,)),
|
np.broadcast_to(self.standard_triangle['improper'], vector_.shape+(3,)),
|
||||||
vector_), 12)
|
vector_), 12)
|
||||||
in_SST_ = np.all(components_proper >= 0.0,axis=-1) \
|
in_SST_ = np.all(components_proper >= 0.0,axis=-1) \
|
||||||
| np.all(components_improper >= 0.0,axis=-1)
|
| np.all(components_improper >= 0.0,axis=-1)
|
||||||
components = np.where((in_SST_ & np.all(components_proper >= 0.0,axis=-1))[...,np.newaxis],
|
components = np.where((in_SST_ & np.all(components_proper >= 0.0,axis=-1))[...,np.newaxis],
|
||||||
components_proper,components_improper)
|
components_proper,components_improper)
|
||||||
else:
|
else:
|
||||||
|
@ -928,7 +930,8 @@ class Orientation(Rotation,Crystal):
|
||||||
(self.kinematics('twin'),N_twin)
|
(self.kinematics('twin'),N_twin)
|
||||||
if active == '*': active = [len(a) for a in kinematics['direction']]
|
if active == '*': active = [len(a) for a in kinematics['direction']]
|
||||||
|
|
||||||
assert active
|
if not active:
|
||||||
|
raise RuntimeError
|
||||||
d = self.to_frame(uvw=np.vstack([kinematics['direction'][i][:n] for i,n in enumerate(active)]))
|
d = self.to_frame(uvw=np.vstack([kinematics['direction'][i][:n] for i,n in enumerate(active)]))
|
||||||
p = self.to_frame(hkl=np.vstack([kinematics['plane'][i][:n] for i,n in enumerate(active)]))
|
p = self.to_frame(hkl=np.vstack([kinematics['plane'][i][:n] for i,n in enumerate(active)]))
|
||||||
P = np.einsum('...i,...j',d/np.linalg.norm(d,axis=1,keepdims=True),
|
P = np.einsum('...i,...j',d/np.linalg.norm(d,axis=1,keepdims=True),
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Rotation:
|
||||||
elif np.array(rotation).shape[-1] == 4:
|
elif np.array(rotation).shape[-1] == 4:
|
||||||
self.quaternion = np.array(rotation)
|
self.quaternion = np.array(rotation)
|
||||||
else:
|
else:
|
||||||
raise TypeError('Rotation is neither a Rotation nor a quaternion')
|
raise TypeError('"rotation" is neither a Rotation nor a quaternion')
|
||||||
|
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
|
@ -139,8 +139,9 @@ class Rotation:
|
||||||
Rotation to check for inequality.
|
Rotation to check for inequality.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not isinstance(other, Rotation):
|
eq = self.__eq__(other)
|
||||||
raise TypeError
|
if not isinstance(eq, bool):
|
||||||
|
return eq
|
||||||
return np.logical_not(self==other)
|
return np.logical_not(self==other)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue