User defined planets (UDPLAs)#

class pykep.udpla.null_udpla#

A moot udpla used as default to construct a planet.

class pykep.udpla.keplerian(when, elem, mu_central_body, name='unkown', added_params=[-1, -1, -1], elem_type=KEP_F)#

keplerian udpla

Constructs a Keplerian udpla from its orbital elements at epoch.

Args:

when (epoch): the epoch at which the orbital elements are provided.

elem (list or numpy.ndarray): the orbital elements. by default.

mu_central_body (float): the gravitational parameter of the main attracting body.

name (str): the name of the orbiting body.

added_params (list): the body gravitational parameter, its radius and its safe radius. (if -1 they are assumed unkown)

el_type (el_type): the elements type. Deafulets to osculating Keplerian (a ,e ,i, W, w, f) with true anomaly.

Examples:
>>> import pykep as pk
>>> elem = [1, 0, 0, 0, 0, 0]
>>> when = pk.epoch("2025-03-22")
>>> udpla = pk.udpla.keplerian(when = when, elem = elem, mu_central_body =1, name = "my_pla")
>>> pla = pk.planet(udpla)
Alternative Constructor:

__init__(ep, posvel, mu_central_body, name = “unkown”, added_params = [-1,-1,-1])

Constructs a Keplerian udpla from its position and velocity at epoch.

Args:

ep (epoch): the epoch at which the orbital elements are provided.

posvel (list [list, list]): the body position and velocty.

mu_central_body (float): the gravitational parameter of the main attracting body.

name (str): the name of the orbiting body.

added_params (list): the body gravitational parameter, its radius and its safe radius. (if -1 they are assumed unkown)

Examples:
>>> import pykep as pk
>>> r = [1, 0, 0]
>>> v = [0, 1, 0]
>>> ep = pk.epoch("2025-03-22")
>>> udpla = pk.udpla.keplerian(ep = ep, posvel = [r, v], mu_central_body =1, name = "my_pla")
>>> pla = pk.planet(udpla)
class pykep.udpla.jpl_lp(name='earth')#

Low precision ephemerides from JPL for the solar system planets

Constructs a solar system planet with ephemerides computed using a low-precision (non Keplerian) model from JPL (https://ssd.jpl.nasa.gov/planets/approx_pos.html).

Args:

name (str): the name of the solar system planet.

Examples:
>>> import pykep as pk
>>> udpla = pk.udpla.jpl_lp(name="mercury")
>>> pla = pk.planet(udpla)
class pykep.udpla.vsop2013(body='mercury', thresh=1e-5)#

Analytical planetary ephemerides from the VSOP2013 theory

Constructs a solar system planet with ephemerides computed using the VSOP2013 analytical theory (https://en.wikipedia.org/wiki/VSOP_model).

Args:

body (str): the name of the solar system planet.

thresh (float): the truncation threshold for the theory’s coefficients.

Examples:
>>> import pykep as pk
>>> udpla = pk.udpla.vsop2013(body="venus")
>>> pla = pk.planet(udpla)
class pykep.udpla.tle(line1, line2)#

This User Defined Planet (UDPLA) represents a satellite orbiting the Earth and defined in the TLE format and propagated using the SGP4 propagator.

Args:

line1 (str): The first line of a TLE

line2 (str): The second line of a TLE

Note

The resulting ephemerides will be returned in SI units and in the True Equator Mean Equinox (TEME) reference frame

Examples:
>>> import pykep as pk
>>> line1 = "1 33773U 97051L   23290.57931959  .00002095  00000+0  65841-3 0  9991"
>>> line2 = "2 33773  86.4068  33.1145 0009956 224.5064 135.5336 14.40043565770064"
>>> udpla = pk.udpla.tle(line1, line2)
>>> pla = pk.planet(udpla)
>>> pla.eph(pk.epoch("2023-10-31"))
eph(mjd2000)#

Mandatory method of the planet interface.

Args:

mjd2000 (float): Modified Julian Date 2000.

Returns:

list [list, list]: the planet ephemerides.

eph_v(mjd2000s)#

Optional method of the planet interface.

Args:

mjd2000s (array-like (1,)): Modified Julian Dates 2000.

Returns:

ndarray: the planet ephemerides as an array of dimension (-1,6)

get_extra_info()#

Optional method of the planet interface.

Returns:

str: Extra info on the udpla

get_mu_central_body()#

Optional method of the planet interface.

Returns:

float: the graviational parameter of the Earth.

get_name()#

Optional method of the planet interface.

Returns:

str: The body name

class pykep.udpla.spice(body, ref_frame, obs)#

This User Defined Planet (UDPLA) represents a planet/object/spacecraft as defined by a pre-loaded SPICE kernel. The interface to the NAIF SPICE code is provided via the third-party python package called spiceypy: https://spiceypy.readthedocs.io/en/stable/

The resulting ephemerides will be returned in SI units and in the selected reference frame (J2000 ECLIPTIC by default).

Note

SPICE kernels containing interesting objects can be, for example, found at: https://naif.jpl.nasa.gov/naif/data_archived.html -> Spacecarft from NAIF https://ssd.jpl.nasa.gov/ftp/eph/planets/bsp/ -> Solar System planets https://www.cosmos.esa.int/web/spice -> ESA missions

Warning

The utility function load_spice_kernels() must be called to pre-load into memory the necessary SPICE kernels. Else, the call to the eph() method will fail rising an exception.

eph(mjd2000)#

Mandatory method of the planet interface.

Args:

mjd2000 (float): Modified Julian Date 2000

Returns:

list [list, list]: the planet ephemerides.

get_extra_info()#

Optional method of the planet interface.

Returns:

str: Extra info on the udpla

get_name()#

Optional method of the planet interface.

Returns:

str: The body name

class pykep.udpla.de440s(body='EARTH BARYCENTER', ref_frame='ECLIPJ2000', obs='SSB')#

This User Defined Planet (UDPLA) represents a solar system planet as described by JPL 440s ephemerides. The correct spice kernel is preloaded upon instantiation of the class as its shipped with the pykep module.

Args:

body (str): NAIF name of the solar system body. Defaults to: “EARTH BARYCENTER”.

ref_frame (str): NAIF name of the reference frame. For example: “ECLIPJ2000”.

obs (str): NAIF name of the observer. For example: “SSB” (solar system barycenter).

body_list()#

The list of bodies contained in the de440s ephemerides. This is a static method and can be queried before constructing the object.

Returns:

list: The list of possible body names.

get_name()#

Optional method of the planet interface.

Returns:

str: The body name

kernel_file()#

The full path for the kernel file “de440s.bsp” shipped in pykep

Returns:

str: The full file name.