hapsira.util

Function helpers.

Module Contents

Functions

norm(vec[, axis])

Norm of a Quantity vector that respects units.

time_range(start, *[, num_values, spacing, end, ...])

Generates range of astronomical times.

find_closest_value(value, values)

Calculates the closest value in the given values.

alinspace(start[, stop, num, endpoint])

Return increasing, evenly spaced angular values over a specified interval.

wrap_angle(angle[, limit])

hapsira.util.norm(vec, axis=None)

Norm of a Quantity vector that respects units.

Parameters:
  • vec (Quantity) – Vector with units.

  • axis (int or None) – Axis along which to compute the vector norms.

hapsira.util.time_range(start, *, num_values=50, spacing=None, end=None, format=None, scale=None)

Generates range of astronomical times.

New in version 0.8.0.

Parameters:
  • start (Time or Quantity) – Start time.

  • num_values (int, optional) – Number of equal spaced time values to be generated, default to 50.

  • spacing (Time or Quantity, optional) – Spacing between periods, optional.

  • end (Time or equivalent, optional) – End date.

Returns:

result – Array of time values.

Return type:

Time

hapsira.util.find_closest_value(value, values)

Calculates the closest value in the given values.

Parameters:
  • value (Quantity) – Reference value.

  • values (Quantity) – Values to search from.

hapsira.util.alinspace(start, stop=None, *, num=50, endpoint=True)

Return increasing, evenly spaced angular values over a specified interval.

hapsira.util.wrap_angle(angle, limit=180 * u.deg)