poliastro2.core.orbit.scalar

Classes

Orbit(state, epoch)

Represents the position and velocity of a body with respect to an attractor at a given epoch.

class poliastro2.core.orbit.scalar.Orbit(state, epoch)

Represents the position and velocity of a body with respect to an attractor at a given epoch.

This class provides methods to access various orbital elements and properties, such as position, velocity, semimajor axis, eccentricity, inclination, and more. It also includes methods to change the attractor, propagate the orbit, and apply maneuvers. The implicit reference system is an inertial one, typically the International Celestial Reference System (ICRS) for the Solar System.

attractor

Main attractor of the orbit.

Type:

Body

epoch

Epoch of the orbit.

Type:

Time

plane

Fundamental plane of the frame.

Type:

Planes

r

Position vector.

Type:

Quantity

v

Velocity vector.

Type:

Quantity

a

Semimajor axis.

Type:

Quantity

p

Semilatus rectum.

Type:

Quantity

r_p

Radius of pericenter.

Type:

Quantity

r_a

Radius of apocenter.

Type:

Quantity

ecc

Eccentricity.

Type:

Quantity

inc

Inclination.

Type:

Quantity

raan

Right ascension of the ascending node.

Type:

Quantity

argp

Argument of the perigee.

Type:

Quantity

nu

True anomaly.

Type:

Quantity

f

Second modified equinoctial element.

Type:

Quantity

g

Third modified equinoctial element.

Type:

Quantity

h

Fourth modified equinoctial element.

Type:

Quantity

k

Fifth modified equinoctial element.

Type:

Quantity

L

True longitude.

Type:

Quantity

period

Period of the orbit.

Type:

Quantity

n

Mean motion.

Type:

Quantity

energy

Specific energy.

Type:

Quantity

e_vec

Eccentricity vector.

Type:

Quantity

h_vec

Specific angular momentum vector.

Type:

Quantity

h_mag

Specific angular momentum.

Type:

Quantity

arglat

Argument of latitude.

Type:

Quantity

t_p

Elapsed time since latest perifocal passage.

Type:

Quantity

get_frame()

Get equivalent reference frame of the orbit.

change_attractor(new_attractor, force=False)

Changes orbit attractor.

change_plane(plane)

Changes fundamental plane.

represent_as(representation, differential_class=None)

Converts the orbit to a specific representation.

rv()

Returns position and velocity vectors.

classical()

Returns classical orbital elements.

pqw()

Returns perifocal frame (PQW) vectors.

propagate(value, method=FarnocchiaPropagator())

Propagates an orbit a specified time.

time_to_anomaly(value)

Returns time required to be in a specific true anomaly.

propagate_to_anomaly(value)

Propagates an orbit to a specific true anomaly.

to_ephem(strategy=TrueAnomalyBounds())

Samples Orbit to return an ephemerides.

sample(values=100, \*, min_anomaly=None, max_anomaly=None)

Samples an orbit to some specified time values.

apply_maneuver(maneuver, intermediate=False)

Returns resulting Orbit after applying maneuver to self.

plot(backend=None, label=None)

Plots the orbit.

elevation(lat, theta, h)

Computes the elevation of the orbit with respect to a location on the attractor.

property L

True longitude.

property a

Semimajor axis.

apply_maneuver(maneuver, intermediate=False)

Returns resulting Orbit after applying maneuver to self.

Optionally return intermediate states (default to False).

Parameters:
  • maneuver (Maneuver) – Maneuver to apply.

  • intermediate (bool, optional) – Return intermediate states, default to False.

property arglat

Argument of latitude.

property argp

Argument of the perigee.

property attractor

Main attractor.

change_attractor(new_attractor, force=False)

Changes orbit attractor.

Only changes from attractor to parent or the other way around are allowed.

Parameters:
  • new_attractor (poliastro.bodies.Body) – Desired new attractor.

  • force (bool) – If True, changes attractor even if physically has no-sense.

Returns:

ss – Orbit with new attractor

Return type:

poliastro.twobody.orbit.Orbit

change_plane(plane)

Changes fundamental plane.

Parameters:

plane (Planes) – Fundamental plane of the frame.

classical()

Classical orbital elements.

property e_vec

Eccentricity vector.

property ecc

Eccentricity.

elevation(lat, theta, h)

Elevation.

Parameters:
  • lat (astropy.units.Quantity) – Latitude of the observation point on the attractor.

  • theta (astropy.units.Quantity) – Local sideral time of the observation point on the attractor.

  • h (astropy.units.Quantity) – Height of the station above the attractor.

Returns:

elevation – Elevation of the orbit with respect to a location on attractor, in units of radian.

Return type:

astropy.units.Quantity

Notes

Local sideral time needs to be precomputed. If Earth is the attractor, it can be computed using poliastro.earth.util.get_local_sidereal_time.

property energy

Specific energy.

property epoch

Epoch of the orbit.

property f

Second modified equinoctial element.

property g

Third modified equinoctial element.

get_frame()

Get equivalent reference frame of the orbit.

Added in version 0.14.0.

property h

Fourth modified equinoctial element.

property h_mag

Specific angular momentum.

property h_vec

Specific angular momentum vector.

property inc

Inclination.

property k

Fifth modified equinoctial element.

property n

Mean motion.

property nu

True anomaly.

property p

Semilatus rectum.

property period

Period of the orbit.

property plane

Fundamental plane of the frame.

plot(backend=None, label=None)

Plots the orbit.

Parameters:
  • backend (OrbitPlotterBackend) – An instance of OrbitPlotterBackend for rendendering the scene.

  • label (str, optional) – Label for the orbit, defaults to empty.

Returns:

An object for plotting orbits.

Return type:

OrbitPlotter

pqw()

Returns the Perifocal frame (PQW) vectors of the orbit.

This method calculates the PQW vectors based on the eccentricity and inclination of the orbit. It issues a deprecation warning indicating that this method will be removed in a future release.

Returns:

A tuple containing the p, q, and w vectors in the perifocal frame.

Return type:

tuple

propagate(value, method=<poliastro2.core.actions.propagate.farnocchia.FarnocchiaPropagator object>)

Propagates an orbit a specified time.

If value is true anomaly, propagate orbit to this anomaly and return the result. Otherwise, if time is provided, propagate this Orbit some time and return the result.

Parameters:
  • value (Quantity, Time, TimeDelta) – Scalar time to propagate.

  • method (function, optional) – Method used for propagation, default to farnocchia.

Returns:

New orbit after propagation.

Return type:

Orbit

propagate_to_anomaly(value)

Propagates an orbit to a specific true anomaly.

Parameters:

value (Quantity)

Returns:

Resulting orbit after propagation.

Return type:

Orbit

property r

Position vector.

property r_a

Radius of apocenter.

property r_p

Radius of pericenter.

property raan

Right ascension of the ascending node.

represent_as(representation, differential_class=None)

Converts the orbit to a specific representation.

Added in version 0.11.0.

Parameters:
  • representation (BaseRepresentation) – Representation object to use. It must be a class, not an instance.

  • differential_class (BaseDifferential, optional) – Class in which the differential should be represented, default to None.

Examples

>>> from poliastro.examples import iss
>>> from astropy.coordinates import SphericalRepresentation
>>> iss.represent_as(CartesianRepresentation)
<CartesianRepresentation (x, y, z) in km
    (859.07256, -4137.20368, 5295.56871)>
>>> iss.represent_as(CartesianRepresentation).xyz
<Quantity [  859.07256, -4137.20368,  5295.56871] km>
>>> iss.represent_as(CartesianRepresentation, CartesianDifferential).differentials['s']
<CartesianDifferential (d_x, d_y, d_z) in km / s
    (7.37289205, 2.08223573, 0.43999979)>
>>> iss.represent_as(CartesianRepresentation, CartesianDifferential).differentials['s'].d_xyz
<Quantity [7.37289205, 2.08223573, 0.43999979] km / s>
>>> iss.represent_as(SphericalRepresentation, CartesianDifferential)
<SphericalRepresentation (lon, lat, distance) in (rad, rad, km)
    (4.91712525, 0.89732339, 6774.76995296)
 (has differentials w.r.t.: 's')>
rv()

Position and velocity vectors.

sample(values=100, *, min_anomaly=None, max_anomaly=None)

Samples an orbit to some specified time values.

Added in version 0.8.0.

Parameters:
  • values (int) – Number of interval points (default to 100).

  • min_anomaly (Quantity, optional) – Anomaly limits to sample the orbit. For elliptic orbits the default will be \(E \in \left[0, 2 \pi \right]\), and for hyperbolic orbits it will be \(\nu \in \left[-\nu_c, \nu_c \right]\), where \(\nu_c\) is either the current true anomaly or a value that corresponds to \(r = 3p\).

  • max_anomaly (Quantity, optional) – Anomaly limits to sample the orbit. For elliptic orbits the default will be \(E \in \left[0, 2 \pi \right]\), and for hyperbolic orbits it will be \(\nu \in \left[-\nu_c, \nu_c \right]\), where \(\nu_c\) is either the current true anomaly or a value that corresponds to \(r = 3p\).

Returns:

positions – Array of x, y, z positions.

Return type:

CartesianRepresentation

Notes

When specifying a number of points, the initial and final position is present twice inside the result (first and last row). This is more useful for plotting.

Examples

>>> from astropy import units as u
>>> from poliastro.examples import iss
>>> iss.sample()  
<CartesianRepresentation (x, y, z) in km ...
>>> iss.sample(10)  
<CartesianRepresentation (x, y, z) in km ...
property t_p

Elapsed time since latest perifocal passage.

time_to_anomaly(value)

Returns time required to be in a specific true anomaly.

Parameters:

value (Quantity)

Returns:

tof – Time of flight required.

Return type:

Quantity

to_ephem(strategy=<poliastro2.core.twobody.sampling.TrueAnomalyBounds object>)

Samples Orbit to return an ephemerides.

Added in version 0.17.0.

property v

Velocity vector.