API reference

pykep is made of main modules called The core module, The planet module, The simsflanagan module, The pontryagin module, The phasing module, The trajopt module, The orbit plotting module, The utility module.

When we import pykep via:

import pykep as pk

the core module gets imported in the pykep namespace, while all other modules will appear in dedicated namespaces, e.g. pykep.trajopt, pykep.phasing etc.

In addition, two dictionaries will be imported:


The first one, pk.__version__, is the pykep version dictionary that can be queried for major and minor version.

The second one, pk.__extensions__, is the pykep extension dictionary containing relevant third-party dependencies as detected by pykep.

For example:

 {'matplotlib': True,
'mplot3d': True,
'pygmo': True,
'scikit-learn': True,
'scipy': True}

Constants defined within pykep namespace




One astronomical unit in meters


Conversion factor from days to seconds


Conversion factor from days to years


Conversion factor from degrees to radians


Conversion factor from radians to degree


Conversion factor from seconds to days


Sun gravitational constant in m^3/s^2


Earth gravitational constant in m^3/s^2


Square root of MU_SUN/AU. Average earth velocity in meters per seconds.


The standard gravity acceleration at ground level in m/s^2


pykep follows two conventions that are to be kept in mind.

  • Units: The S.I. system is used to perform all computations in pykep and it is the default choice for everything. In some cases, to help the user instantiate objects and define problems, classes and functions may accept inputs in different units or return results in different units, but this is only exceptional and documented in the class or function help.

  • Orbital parameters: In pykep, the osculating Keplerian elements are always in the following order: a,e,i,W,w,M (E or H), where a is the semi-major axis, e the eccentriciy, i the inclination, W the Right Axcension of the Acending Node, w the argument of perigee and M the mean anomaly (E and H being the eccentric and hyperbolic anomalies).