API documentation

ai.cs

The module defines various coordinate transformations and related functions: transformations between cartesian, cylindrical and spherical coordinates; rotational matrices; transformations between various geocentric and heliocentric coordinates (Python wrapper for cxform library).

ai.cs.cart2cyl(x, y, z)[source]

Converts data in cartesian coordinates into cylyndrical.

Parameters:
  • x (scalar or array_like) – X-component of data.
  • y (scalar or array_like) – Y-component of data.
  • z (scalar or array_like) – Z-component of data.
Returns:

Tuple (r, phi, z) of data in cylindrical coordinates.

ai.cs.cart2sp(x, y, z)[source]

Converts data from cartesian coordinates into spherical.

Parameters:
  • x (scalar or array_like) – X-component of data.
  • y (scalar or array_like) – Y-component of data.
  • z (scalar or array_like) – Z-component of data.
Returns:

Tuple (r, theta, phi) of data in spherical coordinates.

ai.cs.cxform(cs_from, cs_to, dt, x, y, z)[source]

Performs conversion between various geocentric and heliocentric coordinate systems.

Parameters:
  • cs_from (str) – Indentifier of the source coordinate system. Can be one of ‘GEI’, ‘J2000’, ‘GEO’, ‘MAG’, ‘GSE’, ‘GSM’, ‘SM’, ‘RTN’, ‘GSEQ’, ‘HEE’, ‘HAE’, ‘HEEQ’.
  • cs_to – Identifier of target coordinate system. Can be one of ‘GEI’, ‘J2000’, ‘GEO’, ‘MAG’, ‘GSE’, ‘GSM’, ‘SM’, ‘RTN’, ‘GSEQ’, ‘HEE’, ‘HAE’, ‘HEEQ’.
  • dt (datetime or array_like of datetime) – Datetime of the conversion.
  • x (scalar or array_like) – X-component of data.
  • y (scalar or array_like) – Y-component of data.
  • z (scalar or array_like) – Z-component of data.
Returns:

Tuple (x, y, z) of data in target coordinate system.

ai.cs.cyl2cart(r, phi, z)[source]

Converts data in cylindrical coordinates into cartesian.

Parameters:
  • r (scalar or array_like) – R-component of data.
  • phi (scalar or array_like) – Phi-component of data.
  • z (scalar or array_like) – Z-component of data.
Returns:

Tuple (x, y, z) of data in cartesian coordinates.

ai.cs.mx_apply(T, x, y, z)[source]

Applies rotation to data using rotational matrix.

Parameters:
  • T (numpy.matrix) – Rotational matrix.
  • x (scalar or array_like) – X-component of data.
  • y (scalar or array_like) – Y-component of data.
  • z (scalar or array_like) – Z-component of data.
Returns:

Tuple (x, y, z) of data in cartesian coordinates.

ai.cs.mx_rot(theta, phi, gamma)[source]

Returns rotational matrix for compound rotation around X, Y and Z axes. The order of rotation is X-Y-Z.

Parameters:
  • theta (scalar) – Rotation angle around Y in radians.
  • phi (scalar) – Rotational angle around in Z radians.
  • gamma (scalar) – Rotational angle around X in radians.
Returns:

Numpy rotational matrix.

ai.cs.mx_rot_reverse(theta, phi, gamma)[source]

Returns rotational matrix for compound rotations around X, Y and Z axes. The order of rotation is Z-Y-X.

Parameters:
  • theta (scalar) – Rotational angle around Y in radians.
  • phi (scalar) – Rotational angle around in Z radians.
  • gamma (scalar) – Rotational angle around X in radians.
Returns:

Numpy rotational matrix.

ai.cs.mx_rot_x(gamma)[source]

Returns rotational matrix for right-handed rotation around X axis.

Parameters:gamma (scalar) – Rotation angle around X in radians.
Returns:Numpy rotational matrix.
ai.cs.mx_rot_y(theta)[source]

Returns rotational matrix for right-handed rotation around Y axis.

Parameters:theta (scalar) – Rotation angle around Y in radians.
Returns:Numpy rotational matrix.
ai.cs.mx_rot_z(phi)[source]

Returns rotational matrix for right-handed rotation around Z axis.

Parameters:phi (scalar) – Rotation angle around Z in radians.
Returns:Numpy rotational matrix.
ai.cs.sp2cart(r, theta, phi)[source]

Converts data in spherical coordinates into cartesian.

Parameters:
  • r (scalar or array_like) – R-component of data.
  • theta (scalar or array_like) – Theta-component of data.
  • phi (scalar or array_like) – Phi-component of data.
Returns:

Tuple (x, y, z) of data in cartesian coordinates.