e15190.utilities.geometry.CoordinateConversion

class e15190.utilities.geometry.CoordinateConversion

Functions

__init__()

__init__()
static _spherical_to_cartesian(radius, polar, azimuth)

Convert spherical coordinates to Cartesian coordinates.

This a private method that contains the actual mathematics of the conversion. It is meant to be used by other wrapper functions that accommondate various input formats and output formats.

Parameters
  • radius (scalar or 1D numpy array) – The distance from the origin. Accepts any real numbers. Negative radius is simply interpreted as the opposite direction, e.g. (x, y, z) = (1, 2, 3) would become (-1, -2, -3).

  • polar (scalar or 1D numpy array) – The polar angle of the point in radians. Commonly denoted as theta in physics. Accepts any real numbers, but expect identical result for any theta with the same \(\mathrm{mod}(\theta, 2\pi)\) value.

  • azimuth (scalar or 1D numpy array) – The azimuthal angle of the point in radians. Commonly denoted as phi in physics. Accepts any real numbers, but expect identical result for any phi with the same \(\mathrm{mod}(\phi, 2\pi)\) value.

Returns

  • x (scalar or 1D numpy array) – The x-coordinate of the point in Cartesian coordinates.

  • y (scalar or 1D numpy array) – The y-coordinate of the point in Cartesian coordinates.

  • z (scalar or 1D numpy array) – The z-coordinate of the point in Cartesian coordinates.

static _cartesian_to_spherical(x, y, z)

Convert Cartesian coordinates to spherical coordinates.

This a private method that contains the actual mathematics of the conversion. It is meant to be used by other wrapper functions that accommondate various input formats and output formats.

Parameters
  • x (scalar or 1D numpy array) – The x-coordinate of the point in Cartesian coordinates.

  • y (scalar or 1D numpy array) – The y-coordinate of the point in Cartesian coordinates.

  • z (scalar 1D numpy array) – The z-coordinate of the point in Cartesian coordinates.

Returns

  • radius (scalar or 1D numpy array) – The radius of the point in spherical coordinates. Has a range of \([0, \infty)\).

  • polar (scalar or 1D numpy array) – The polar angle of the point in radians. Commonly denoted as theta in physics. Has a range of \([0, \pi)\).

  • azimuth (scalar or 1D numpy array) – The azimuthal angle of the point in radians. Commonly denoted as phi in physics. Has a range of \([-\pi, \pi)\).