Util module

Function helpers.

poliastro.util.circular_velocity(k, a)

Compute circular velocity for a given body (k) and semimajor axis (a).

poliastro.util.rotate(vector, angle, axis='z')

Rotates a vector around axis a right-handed positive angle.

This is just a convenience function around astropy.coordinates.matrix_utilities.rotation_matrix().

  • vector (Quantity) – Dimension 3 vector.
  • angle (Quantity) – Angle of rotation.
  • axis (str, optional) – Either ‘x’, ‘y’ or ‘z’.


This performs a so-called active or alibi transformation: rotates the vector while the coordinate system remains unchanged. To do the opposite operation (passive or alias transformation) call the function as rotate(vec, ax, -angle, unit) or use the convenience function transform(), see [1].


poliastro.util.transform(vector, angle, axis='z')

Rotates a coordinate system around axis a positive right-handed angle.


This is a convenience function, equivalent to rotate(vec, -angle, axis, unit). Refer to the documentation of rotate() for further information.


Norm of a Quantity vector that respects units.

Parameters:vec (Quantity) – Vector with units.
poliastro.util.time_range(start, *, periods=50, spacing=None, end=None, format=None, scale=None)

Generates range of astronomical times.

New in version 0.8.0.

  • periods (int, optional) – Number of periods, default to 50.
  • spacing (Time or Quantity, optional) – Spacing between periods, optional.
  • end (Time or equivalent, optional) – End date.

Array of time values.

Return type:


poliastro.util.hyp_nu_limit(ecc, r_max_ratio=inf)

Limit true anomaly for hyperbolic orbits.

  • ecc (Quantity) – Eccentricity, should be larger than 1.
  • r_max_ratio (float, optional) – Value of \(r_{\text{max}} / p\) for this angle, default to infinity.