reading numpy manual ...

https://numpy.org/doc/stable/reference/generated/numpy.isclose.html
rtol=1.e-8, b=1 gives atol+btol=1.e-8+1e-9, simplified to 1e-8
This commit is contained in:
Martin Diehl 2020-07-13 22:48:29 +02:00
parent 9f79faf819
commit b0e06f180a
2 changed files with 2 additions and 2 deletions

View File

@ -805,7 +805,7 @@ class Rotation:
"""Rotation matrix to Bunge-Euler angles."""
with np.errstate(invalid='ignore',divide='ignore'):
zeta = 1.0/np.sqrt(1.0-om[...,2,2:3]**2)
eu = np.where(np.isclose(np.abs(om[...,2,2:3]),1.0,1e-9),
eu = np.where(np.isclose(np.abs(om[...,2,2:3]),1.0,0.0),
np.block([np.arctan2(om[...,0,1:2],om[...,0,0:1]),
np.pi*0.5*(1-om[...,2,2:3]),
np.zeros(om.shape[:-2]+(1,)),

View File

@ -150,7 +150,7 @@ def om2qu(a):
def om2eu(om):
"""Rotation matrix to Bunge-Euler angles."""
if not np.isclose(np.abs(om[2,2]),1.0,1.e-9):
if not np.isclose(np.abs(om[2,2]),1.0,0.0):
zeta = 1.0/np.sqrt(1.0-om[2,2]**2)
eu = np.array([np.arctan2(om[2,0]*zeta,-om[2,1]*zeta),
np.arccos(om[2,2]),