Ephemerides#
The ephemerides are the position end velocity Cartesian vectors of a moving object. In pykep
the class planet
offers a common interface to access various ephemerides, regardless on how they are computed. Whether the underlying computations are simply Keplerian, or based on more advanced trajectory propagations, interpolations or predictions, a unified interface is offered by this type-erasing class.
The user can code his own python class following the mandatory interface of a planet
and his own coded objects will be treated uniformly as any other planet in pykep
. These User Defined Planets (or UPLAs) can implement heterogeneous techniques and interface to any third-party API, but once they are used to construct a planet
, they will appear as any other planet
in pykep
.
For convenience, a number of already coded UDPLAs are offered so that, to start with, users can compute the positions of planet, satellites comets and spacecarft without the need to code their own UDPLA.
import pykep as pk
Let us start to use the UDPLA keplerian
which describes the motion of an object in a Keplerian orbit. All UDPLAS provided by pykep
are in the module udpla
# We instantiate the udpla
udpla = pk.udpla.keplerian(pk.epoch(0.), [1., 0, 0, 0, 0, 0], mu_central_body = 1., name = "A Circular Orbit")
# And use it to construct a pykep planet, hence erasing its type.
pla = pk.planet(udpla)
Note
Non-dimensional units are often useful in astrodynamics and most pykep class allow their use. Of course only if everything is consistent the computations will make sense. pykep
does not check this consistency and thus the user must be careful when using anything which is non SI, and to not mix units.
Let us print on screen this planet
.
print(pla)
A Circular Orbit
The textual representation of a planet is made of two parts.
The first part is common to all objects of type planet
and reports the body name, its physical parameters and the name of the underlying c++ class of the udpla (for pythonic udplas, this will be always the same and eaul to kep3::python_udpla).
The second part is instead original with the udpla type, and is essentially whatever is returned by the planet
interface optional method extra_info
. In this case, the udpla is a c++ based class exposed to python as :class:pykep.udpla.keplerian
and its extra info report the orbital parameters as well as the Cartesian components of the body state at the reference epoch.