Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_plot_data(self):
from orix.vector import Vector3d
theta = np.linspace(0, 2 * np.pi - EPSILON, 361)
rho = np.linspace(0, np.pi - EPSILON, 181)
theta, rho = np.meshgrid(theta, rho)
g = Vector3d.from_polar(rho, theta)
n = Rodrigues.from_rotation(self).norm.data[:, np.newaxis, np.newaxis]
if n.size == 0:
return Rotation.from_neo_euler(AxAngle.from_axes_angles(g, np.pi))
d = (-self.axis).dot_outer(g.unit).data
x = n * d
x = 2 * np.arctan(x ** -1)
x[x < 0] = np.pi
x = np.min(x, axis=0)
r = Rotation.from_neo_euler(AxAngle.from_axes_angles(g.unit, x))
return r
def get_plot_data(self):
from orix.vector import Vector3d
theta = np.linspace(0, 2 * np.pi - EPSILON, 361)
rho = np.linspace(0, np.pi - EPSILON, 181)
theta, rho = np.meshgrid(theta, rho)
g = Vector3d.from_polar(rho, theta)
n = Rodrigues.from_rotation(self).norm.data[:, np.newaxis, np.newaxis]
if n.size == 0:
return Rotation.from_neo_euler(AxAngle.from_axes_angles(g, np.pi))
d = (-self.axis).dot_outer(g.unit).data
x = n * d
x = 2 * np.arctan(x ** -1)
x[x < 0] = np.pi
x = np.min(x, axis=0)
r = Rotation.from_neo_euler(AxAngle.from_axes_angles(g.unit, x))
return r
def from_symmetry(cls, s1, s2=C1):
"""The set of unique (mis)orientations of a symmetrical object.
Parameters
----------
s1, s2 : Symmetry
"""
s1, s2 = get_proper_groups(s1, s2)
large_cell_normals = _get_large_cell_normals(s1, s2)
disjoint = s1 & s2
fundamental_sector = disjoint.fundamental_sector()
fundamental_sector_normals = Rotation.from_neo_euler(
AxAngle.from_axes_angles(fundamental_sector, np.pi)
)
normals = Rotation(
np.concatenate([large_cell_normals.data, fundamental_sector_normals.data])
)
orientation_region = cls(normals)
vertices = orientation_region.vertices()
if vertices.size:
orientation_region = orientation_region[
np.any(
np.isclose(orientation_region.dot_outer(vertices).data, 0), axis=1
)
]
return orientation_region