rotate

Functions for rotations on the unit sphere.

skysegmentor.rotate3d_Euler(x, y, z, angles, axes='zyz', center=[0.0, 0.0, 0.0])[source]

Rotates points in 3D cartesian coordinates by Euler angle around specified axes.

Parameters:
  • x (float or array) – Cartesian coordinates.

  • y (float or array) – Cartesian coordinates.

  • z (float or array) – Cartesian coordinates.

  • angles (array) – Euler angles.

  • axes (str, optional) – Euler angle axes, default z-y-z rotations.

  • center (list[float], optional) – Center of rotation, default=[0., 0., 0.].

  • k (array, optional) – If k is specified, points are rotated around a unit vector k.

Returns:

xrot, yrot, zrot – Rotated x, y and z coordinates.

Return type:

float or array

skysegmentor.rotate_usphere(phi, the, angles)[source]

Rotates spherical coordinates by Euler angles performed along the z-axis, then y-axis and then z-axis.

Parameters:
  • phi (float or array) – Spherical angular coordinates.

  • the (float or array) – Spherical angular coordinates.

  • angles (list) – Euler angles defining rotations about the z-axis, y-axis then z-axis.

skysegmentor.midpoint_usphere(phi1, phi2, the1, the2)[source]

Finds the spherical angular coordinates of the midpoint between two points on a unit sphere.

Parameters:
  • phi1 (float) – Longitude coordinates for both points.

  • phi2 (float) – Longitude coordinates for both points.

  • the1 (float) – Latitude coordinates for both points.

  • the2 (float) – Latitude coordinates for both points.

Returns:

midphi, midthe – Midpoint along the longitude phi and latitude theta.

Return type:

float

skysegmentor.rotate2plane(c1, c2)[source]

Finds the rotation angles to place the two coordinates c1 and c2 along a latitude = pi/2 (i.e. equator of sphere) and with a midpoint of longitude = pi.

Parameters:
  • c1 (float) – Coordinates of two points where c1 = [phi1, theta1] and c2 = [phi2, theta2].

  • c2 (float) – Coordinates of two points where c1 = [phi1, theta1] and c2 = [phi2, theta2].

Returns:

a1, a2, a3 – Euler angles of rotation.

Return type:

lists

skysegmentor.forward_rotate(phi, the, a1, a2, a3)[source]

Applies a forward rotation of spherical angular coordinates phi and theta using the forward Euler angles of rotation a1, a2 and a3.

Parameters:
  • phi (float or array) – Spherical angular coordinates.

  • the (float or array) – Spherical angular coordinates.

  • a1 (lists) – Euler angles of rotation.

  • a2 (lists) – Euler angles of rotation.

  • a3 (lists) – Euler angles of rotation.

skysegmentor.backward_rotate(phi, the, a1, a2, a3)[source]

Applies a backward rotation of spherical angular coordinates phi and theta using the forward Euler angles of rotation a1, a2 and a3.

Parameters:
  • phi (float or array) – Spherical angular coordinates.

  • the (float or array) – Spherical angular coordinates.

  • a1 (lists) – Euler angles of rotation.

  • a2 (lists) – Euler angles of rotation.

  • a3 (lists) – Euler angles of rotation.