vector2xy#

classmethod SphericalProjection.vector2xy(v: Vector3d | ndarray) ndarray[source]#

[Deprecated] Convert from cartesian to spherical coordinates according to the ISO 31-11 standard.

Parameters:
v

3D vector(s) on the form [[x0, y0, z0], [x1, y1, z1], ...].

Returns:
spherical_coordinates

Spherical coordinates theta, phi and r on the form [[theta1, phi1, r1], [theta2, phi2, r2], ...].

Notes

Deprecated since version 0.8.0: Function vector2xy() is deprecated and will be removed in version 0.9.0.

Examples

>>> import numpy as np
>>> from kikuchipy.projections import SphericalProjection
>>> v = np.random.random_sample(30).reshape((10, 3))
>>> theta, phi, r = SphericalProjection.vector2xy(v).T
>>> np.allclose(np.arccos(v[:, 2] / r), theta)
True
>>> np.allclose(np.arctan2(v[:, 1], v[:, 0]), phi)
True