adjusted typecheck in __eq__ and __ne__ functions

This commit is contained in:
Daniel Otto de Mentock 2022-02-04 11:43:35 +01:00
parent 7a405125da
commit 019ae1c536
2 changed files with 4 additions and 8 deletions

View File

@ -148,7 +148,7 @@ class Orientation(Rotation,Crystal):
""" """
if not isinstance(other, Orientation): if not isinstance(other, Orientation):
return NotImplemented raise NotImplementedError
matching_type = self.family == other.family and \ matching_type = self.family == other.family and \
self.lattice == other.lattice and \ self.lattice == other.lattice and \
self.parameters == other.parameters self.parameters == other.parameters
@ -165,9 +165,7 @@ class Orientation(Rotation,Crystal):
Orientation to check for equality. Orientation to check for equality.
""" """
eq = self.__eq__(other) self.__eq__(other)
if not isinstance(eq, bool):
return eq
return np.logical_not(self==other) return np.logical_not(self==other)

View File

@ -124,7 +124,7 @@ class Rotation:
""" """
if not isinstance(other, Rotation): if not isinstance(other, Rotation):
return NotImplemented raise NotImplementedError
return np.logical_or(np.all(self.quaternion == other.quaternion,axis=-1), return np.logical_or(np.all(self.quaternion == other.quaternion,axis=-1),
np.all(self.quaternion == -1.0*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. Rotation to check for inequality.
""" """
eq = self.__eq__(other) self.__eq__(other)
if not isinstance(eq, bool):
return eq
return np.logical_not(self==other) return np.logical_not(self==other)