consistently define allclose for own type only
This commit is contained in:
parent
b1922c9fc0
commit
35caed305f
|
@ -168,8 +168,8 @@ class Orientation(Rotation,Crystal):
|
||||||
return np.logical_not(self==other) if isinstance(other, Orientation) else NotImplemented
|
return np.logical_not(self==other) if isinstance(other, Orientation) else NotImplemented
|
||||||
|
|
||||||
|
|
||||||
def isclose(self,
|
def isclose(self: MyType,
|
||||||
other: object,
|
other: MyType,
|
||||||
rtol: float = 1e-5,
|
rtol: float = 1e-5,
|
||||||
atol: float = 1e-8,
|
atol: float = 1e-8,
|
||||||
equal_nan: bool = True) -> bool:
|
equal_nan: bool = True) -> bool:
|
||||||
|
@ -193,8 +193,6 @@ class Orientation(Rotation,Crystal):
|
||||||
Mask indicating where corresponding orientations are close.
|
Mask indicating where corresponding orientations are close.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not isinstance(other, Orientation):
|
|
||||||
raise TypeError
|
|
||||||
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
|
||||||
|
@ -202,8 +200,8 @@ class Orientation(Rotation,Crystal):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def allclose(self,
|
def allclose(self: MyType,
|
||||||
other: object,
|
other: MyType,
|
||||||
rtol: float = 1e-5,
|
rtol: float = 1e-5,
|
||||||
atol: float = 1e-8,
|
atol: float = 1e-8,
|
||||||
equal_nan: bool = True) -> bool:
|
equal_nan: bool = True) -> bool:
|
||||||
|
|
|
@ -140,8 +140,8 @@ class Rotation:
|
||||||
"""
|
"""
|
||||||
return np.logical_not(self==other) if isinstance(other, Rotation) else NotImplemented
|
return np.logical_not(self==other) if isinstance(other, Rotation) else NotImplemented
|
||||||
|
|
||||||
def isclose(self,
|
def isclose(self: MyType,
|
||||||
other: 'Rotation',
|
other: MyType,
|
||||||
rtol: float = 1e-5,
|
rtol: float = 1e-5,
|
||||||
atol: float = 1e-8,
|
atol: float = 1e-8,
|
||||||
equal_nan: bool = True) -> bool:
|
equal_nan: bool = True) -> bool:
|
||||||
|
@ -171,8 +171,8 @@ class Rotation:
|
||||||
np.all(np.isclose(s,-1.0*o,rtol,atol,equal_nan),axis=-1))
|
np.all(np.isclose(s,-1.0*o,rtol,atol,equal_nan),axis=-1))
|
||||||
|
|
||||||
|
|
||||||
def allclose(self,
|
def allclose(self: MyType,
|
||||||
other: 'Rotation',
|
other: MyType,
|
||||||
rtol: float = 1e-5,
|
rtol: float = 1e-5,
|
||||||
atol: float = 1e-8,
|
atol: float = 1e-8,
|
||||||
equal_nan: bool = True) -> Union[np.bool_, bool]:
|
equal_nan: bool = True) -> Union[np.bool_, bool]:
|
||||||
|
|
Loading…
Reference in New Issue