reversed operator order to allow for proper blending in misorientation

This commit is contained in:
Philip Eisenlohr 2024-02-09 19:52:32 -05:00 committed by achalhp
parent 608063a8e5
commit e3f27a7eb3
2 changed files with 7 additions and 4 deletions

View File

@ -534,21 +534,23 @@ class Orientation(Rotation,Crystal):
r_ = s[:,np.newaxis,...].misorientation(o[np.newaxis,:,...]) # type: ignore[index]
_r = ~r_
shp = r_.shape[2:]
forward = r_.in_disorientation_FZ
reverse = _r.in_disorientation_FZ
ok = forward | reverse
ok &= (np.cumsum(ok.reshape((-1,)+blend),axis=0) == 1).reshape(ok.shape)
ok &= (np.cumsum(ok.reshape((-1,*shp)),axis=0) == 1).reshape(ok.shape)
r = np.where(np.any((ok&forward)[...,np.newaxis],axis=(0,1),keepdims=True),
r_.quaternion,
_r.quaternion)
loc = np.where(ok)
sort = 0 if len(loc) == 2 else np.lexsort(loc[:1:-1])
quat = r[ok][sort].reshape(blend+(4,))
quat = r[ok][sort].reshape((*shp,4))
return (
(self.copy(rotation=quat),
(np.vstack(loc[:2]).T)[sort].reshape(blend+(2,)))
(np.vstack(loc[:2]).T)[sort].reshape((*shp,2)))
if return_operators else
self.copy(rotation=quat)
)

View File

@ -616,6 +616,7 @@ class Rotation:
----------
other : damask.Rotation
Rotation to which the misorientation is computed.
Compatible innermost dimensions will blend.
Returns
-------
@ -623,7 +624,7 @@ class Rotation:
Misorientation.
"""
return other/self
return ~(self*~other)
################################################################################################