Util module

Function helpers.

poliastro.util.circular_velocity(k, a)

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

poliastro.util.norm(vec)

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.

Parameters:
  • 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.
Returns:

Array of time values.

Return type:

Time

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

Limit true anomaly for hyperbolic orbits.

Parameters:
  • 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.
poliastro.util.get_eccentricity_critical_argp(attractor, a, inc)

Calculates the eccentricity for frozen orbits when the argument of perigee is critical

Parameters:
  • attractor (Body) – Main attractor.
  • a (Quantity) – Orbit’s semimajor axis
  • inc (Quantity, optional) – Inclination, default to critical value.
poliastro.util.get_inclination_critical_argp(attractor, a, ecc)

Calculates the inclination for frozen orbits when the argument of perigee is critical and the eccentricity is given

Parameters:
  • attractor (Body) – Main attractor.
  • a (Quantity) – Orbit’s semimajor axis
  • ecc (Quantity, optional) – Eccentricity
poliastro.util.get_eccentricity_critical_inc(ecc=None)

Calculates the eccentricity when a frozen orbit has critical inclination

If ecc is None we set an arbitrary value which is the Moon ecc because it seems reasonable

Parameters:ecc (: ~astropy.units.Quantity, optional) – Eccentricity, or None if it was not defined
poliastro.util.find_closest_value(value, values)

Calculates the closest value in the given values :param value: :type value: ~astropy.units.Quantity :param values: :type values: ~astropy.units.Quantity