How to use the orix.vector.Vector3d.from_polar function in orix

To help you get started, we’ve selected a few orix examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyxem / orix / tests / test_vector3d.py View on Github external
def test_polar(theta, phi, r, expected):
    assert np.allclose(Vector3d.from_polar(theta, phi, r).data, expected.data, atol=1e-5)
github pyxem / orix / orix / grid / s2grid.py View on Github external
def __init__(self, theta_grid: S1Grid, rho_grid: S1Grid):
        self.theta_grid = theta_grid
        self.rho_grid = rho_grid
        theta = np.tile(theta_grid.points, rho_grid.points.shape)
        rho = rho_grid.points
        v = Vector3d.from_polar(theta, rho)
        self.points = v
github pyxem / orix / orix / quaternion / orientation_region.py View on Github external
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