hapsira.ephem

Module Contents

Classes

BaseInterpolator

SincInterpolator

SplineInterpolator

Ephem

Time history of position and velocity of some object at particular epochs.

Functions

build_ephem_interpolant(body, epochs[, attractor])

Interpolates ephemerides data.

Attributes

EPHEM_FORMAT

hapsira.ephem.EPHEM_FORMAT = 'Ephemerides at {num} epochs from {start} ({start_scale}) to {end} ({end_scale})'
hapsira.ephem.build_ephem_interpolant(body, epochs, attractor=Earth)

Interpolates ephemerides data.

Parameters:
  • body (Body) – Source body.

  • epochs (Time) – Array of time values, can be generated with hapsira.util.time_range.

  • attractor (Body, optional) – Attractor, default to Earth.

Returns:

interpolant – Interpolant function that receives time increment in seconds since the initial epoch.

Return type:

callable

class hapsira.ephem.BaseInterpolator
abstract interpolate(epochs, reference_epochs, coordinates)
class hapsira.ephem.SincInterpolator
interpolate(epochs, reference_epochs, coordinates)
class hapsira.ephem.SplineInterpolator(kind='cubic')
interpolate(epochs, reference_epochs, coordinates)
class hapsira.ephem.Ephem(coordinates, epochs, plane)

Time history of position and velocity of some object at particular epochs.

Instead of creating Ephem objects directly, use the available classmethods.

Parameters:
property epochs

Epochs at which the ephemerides was originally sampled.

property plane

Reference plane of the ephemerides.

__str__()

Return str(self).

__repr__()

Return repr(self).

classmethod from_body(body, epochs, *, attractor=None, plane=Planes.EARTH_EQUATOR)

Return Ephem for a SolarSystemPlanet at certain epochs.

Parameters:
  • body (SolarSystemPlanet) – Body.

  • epochs (Time) – Epochs to sample the body positions.

  • attractor (SolarSystemPlanet, optional) – Body to use as central location, if not given the Solar System Barycenter will be used.

  • plane (Planes, optional) – Fundamental plane of the frame, default to Earth Equator.

classmethod from_horizons(name, epochs, *, attractor=None, plane=Planes.EARTH_EQUATOR, id_type=None)

Return Ephem for an object using JPLHorizons module of Astroquery.

Parameters:
  • name (str) – Name of the body to query for.

  • epochs (Time) – Epochs to sample the body positions.

  • attractor (SolarSystemPlanet, optional) – Body to use as central location, if not given the Solar System Barycenter will be used.

  • plane (Planes, optional) – Fundamental plane of the frame, default to Earth Equator.

  • id_type (NoneType or str, optional) – Use “smallbody” for Asteroids and Comets and None (default) to first search for Planets and Satellites.

classmethod from_orbit(orbit, epochs, plane=Planes.EARTH_EQUATOR)

Return Ephem from an Orbit at certain epochs.

Parameters:
  • orbit (Orbit) – Orbit.

  • epochs (Time) – Epochs to sample the orbit positions.

  • plane (Planes, optional) – Fundamental plane of the frame, default to Earth Equator.

sample(epochs=None, *, interpolator=SplineInterpolator())

Returns coordinates at specified epochs.

Parameters:
  • epochs (Time, optional) – Epochs to sample the ephemerides, if not given the original one from the object will be used.

  • interpolator (BaseInterpolator, optional) – Interpolation method to use for epochs outside of the original ones, default to splines.

Returns:

Sampled coordinates with velocities.

Return type:

CartesianRepresentation

rv(epochs=None, **kwargs)

Position and velocity vectors at given epochs.

Parameters:
  • epochs (Time, optional) – Epochs to sample the ephemerides, default to now.

  • **kwargs – Extra kwargs for interpolation method.