adjusted typecheck in __eq__ and __ne__ functions
This commit is contained in:
parent
7a405125da
commit
019ae1c536
|
@ -148,7 +148,7 @@ class Orientation(Rotation,Crystal):
|
|||
|
||||
"""
|
||||
if not isinstance(other, Orientation):
|
||||
return NotImplemented
|
||||
raise NotImplementedError
|
||||
matching_type = self.family == other.family and \
|
||||
self.lattice == other.lattice and \
|
||||
self.parameters == other.parameters
|
||||
|
@ -165,9 +165,7 @@ class Orientation(Rotation,Crystal):
|
|||
Orientation to check for equality.
|
||||
|
||||
"""
|
||||
eq = self.__eq__(other)
|
||||
if not isinstance(eq, bool):
|
||||
return eq
|
||||
self.__eq__(other)
|
||||
return np.logical_not(self==other)
|
||||
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ class Rotation:
|
|||
|
||||
"""
|
||||
if not isinstance(other, Rotation):
|
||||
return NotImplemented
|
||||
raise NotImplementedError
|
||||
return np.logical_or(np.all(self.quaternion == other.quaternion,axis=-1),
|
||||
np.all(self.quaternion == -1.0*other.quaternion,axis=-1))
|
||||
|
||||
|
@ -139,9 +139,7 @@ class Rotation:
|
|||
Rotation to check for inequality.
|
||||
|
||||
"""
|
||||
eq = self.__eq__(other)
|
||||
if not isinstance(eq, bool):
|
||||
return eq
|
||||
self.__eq__(other)
|
||||
return np.logical_not(self==other)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue