Again changes to the return values.
A python function with no return value returns 'None'
This commit is contained in:
parent
9a43c2e4c5
commit
feca9fe0a0
|
@ -108,23 +108,21 @@ class Rotation:
|
||||||
def inverse(self):
|
def inverse(self):
|
||||||
"""In-place inverse rotation/backward rotation"""
|
"""In-place inverse rotation/backward rotation"""
|
||||||
self.quaternion.conjugate()
|
self.quaternion.conjugate()
|
||||||
|
return self
|
||||||
|
|
||||||
def inversed(self):
|
def inversed(self):
|
||||||
"""Inverse rotation/backward rotation"""
|
"""Inverse rotation/backward rotation"""
|
||||||
c = self.copy()
|
return self.copy.inverse()
|
||||||
c.inverse()
|
|
||||||
return c
|
|
||||||
|
|
||||||
|
|
||||||
def standardize(self):
|
def standardize(self):
|
||||||
"""Ensure quaternion representation with positive q"""
|
"""In-place quaternion representation with positive q"""
|
||||||
if self.quaternion.q < 0.0: self.quaternion.homomorph()
|
if self.quaternion.q < 0.0: self.quaternion.homomorph()
|
||||||
|
return self
|
||||||
|
|
||||||
def standardized(self):
|
def standardized(self):
|
||||||
"""Ensure quaternion representation with positive q"""
|
"""Quaternion representation with positive q"""
|
||||||
c = self.copy()
|
return self.copy.standardize()
|
||||||
c.standardize()
|
|
||||||
return c
|
|
||||||
|
|
||||||
|
|
||||||
def misorientation(self,other):
|
def misorientation(self,other):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
P = -1 # convention (sed DOI:10.1088/0965-0393/23/8/083501)
|
P = -1 # convention (see DOI:10.1088/0965-0393/23/8/083501)
|
||||||
|
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
class Quaternion:
|
class Quaternion:
|
||||||
|
@ -186,35 +186,32 @@ class Quaternion:
|
||||||
|
|
||||||
|
|
||||||
def normalize(self):
|
def normalize(self):
|
||||||
"""Normalizes in-place (no return value)"""
|
"""Normalizes in-place"""
|
||||||
d = self.magnitude()
|
d = self.magnitude()
|
||||||
if d > 0.0: self /= d
|
if d > 0.0: self /= d
|
||||||
|
return self
|
||||||
|
|
||||||
def normalized(self):
|
def normalized(self):
|
||||||
"""Returns normalized copy"""
|
"""Returns normalized copy"""
|
||||||
c = self.copy()
|
return self.copy.normalize()
|
||||||
c.normalize()
|
|
||||||
return c
|
|
||||||
|
|
||||||
|
|
||||||
def conjugate(self):
|
def conjugate(self):
|
||||||
"""Conjugates in-place (no return value)"""
|
"""Conjugates in-place"""
|
||||||
self.p = -self.p
|
self.p = -self.p
|
||||||
|
return self
|
||||||
|
|
||||||
def conjugated(self):
|
def conjugated(self):
|
||||||
"""Returns conjugated copy"""
|
"""Returns conjugated copy"""
|
||||||
c = self.copy()
|
return self.copy.conjugate()
|
||||||
c.conjugate()
|
|
||||||
return c
|
|
||||||
|
|
||||||
|
|
||||||
def homomorph(self):
|
def homomorph(self):
|
||||||
"""Homomorphs in-place (no return value)"""
|
"""Homomorphs in-place"""
|
||||||
self.q = -self.q
|
self.q = -self.q
|
||||||
self.p = -self.p
|
self.p = -self.p
|
||||||
|
return self
|
||||||
|
|
||||||
def homomorphed(self):
|
def homomorphed(self):
|
||||||
"""Returns homomorphed copy"""
|
"""Returns homomorphed copy"""
|
||||||
c = self.copy()
|
return self.copy.homomorph()
|
||||||
c.homomorph()
|
|
||||||
return c
|
|
||||||
|
|
Loading…
Reference in New Issue