From 4183eeaeca1b15a9ec5f66cbb65b071b5baf84ba Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 18 Apr 2019 18:05:46 -0400 Subject: [PATCH] [skip ci] disorientation may return full-fledged orientation obj and aux info, added rotation.standardize(d) --- python/damask/orientation.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/python/damask/orientation.py b/python/damask/orientation.py index 626acc0f2..26e926357 100644 --- a/python/damask/orientation.py +++ b/python/damask/orientation.py @@ -109,6 +109,15 @@ class Rotation: return self.__class__(self.quaternion.conjugated()) + def standardize(self): + """Ensure quaternion representation with positive q""" + if self.quaternion.q < 0.0: self.quaternion.homomorph() + + def standardized(self): + """Ensure quaternion representation with positive q""" + return self.__class__(self.quaternion.homomorphed() if self.quaternion.q < 0.0 else self.quaternion) + + def misorientation(self,other): """Misorientation""" return other*self.inversed() @@ -920,7 +929,7 @@ class Orientation: if breaker: break if breaker: break - return (r, i,j, k == 1) if symmetries else r # disorientation ... + return (Orientation(r,self.symmetry), i,j, k == 1) if symmetries else r # disorientation ... # ... own sym, other sym, # self-->other: True, self<--other: False