pykep Documentation

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 (requires pygmo), The orbit plotting module, The utility module. When we import pykep via:

import pykep as pkp

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 important dictionaries will be imported:


The first one, pkp.__version__, is the pykep version dictionary that can be queried for major, minor or bugfix number. pykep 1.2.0 means that the major version is 1, the minor is 2 and the bugfix version is 0.

The second one, pkp.__extensions__, is the pykep extension dictionary containing the extension installed in the system as detected by pykep. For example:

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

Constants defined within pykep namespace

Name Description
pykep.AU One astronomical unit in meters
pykep.DAY2SEC Conversion factor from days to seconds
pykep.DAY2YEAR Conversion factor from days to years
pykep.DEG2RAD Conversion factor from degrees to radians
pykep.RAD2DEG Conversion factor from radians to degree
pykep.SEC2DAY Conversion factor from seconds to days
pykep.MU_SUN Sun gravitational constant in m^3/s^2
pykep.EARTH_VELOCITY Square root of MU_SUN/AU. Average earth velocity in meters per seconds.
pykep.G0 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).