dyad.TwoBody
- class dyad.TwoBody(m_1, m_2, a, e, Omega=0.0, i=0.0, omega=0.0)[source]
A class representing the elliptical orbits of a two-body system
Represents the orbit of the secondary body with respect to the primary body as well as the orbit of the primary and secondary bodies with respect to the system’s centre of mass.
- Parameters:
- m_1: array-like
Mass of the primary body, \(m_{1}\).
- m_2: array-like
Mass of the secondary body, \(m_{2}\).
- a: array-like
Semimajor axis of the relative orbit, \(a\).
- e: array-like
Eccentricity of the relative orbit, \(e\).
- Omega: array-like
Longitude of the ascending node of the relative orbit, \(\Omega\).
- i: array-like
Inclination of the relative orbit, \(i\).
- omega: array-like
Argument of pericentre of the relative orbit, \(\omega\).
- Attributes:
angular_momentumGet the body’s specific angular momentum
angular_momentum_magnitudeGet the magnitude of the body’s specific angular momentum
apoapsisGet the apoapsis of the orbit
areaGet the area contained by the orbit
argument_of_pericentreGet the orbit’s argument of pericentre
central_massGet the central mass
eccentricityGet the orbit’s eccentricity
eccentricity_vectorGet the eccentricity vector of the orbit
energyGet the body’s specific total energy
inclinationGet the inclination of the orbit
longitude_of_ascending_nodeGet the longitude of the ascending node of the orbit
lrl_vectorGet the Laplace-Runge-Lenz vector of the orbit
periapsisGet the periapsis of the orbit
periodGet the orbital period
primaryGet the primary body’s orbit as an instance of
OrbitsecondaryGet the secondary body’s orbit as an instance of
Orbitsemilatus_rectumGet the orbit’s semilatus rectum
semimajor_axisGet the orbit’s semimajor axis
semiminor_axisGet the orbit’s semiminor axis
Methods
delaunay_elements([theta])Get the Delaunay elements of the orbit
eccentric_anomaly(theta)Return the body's eccentric anomaly
kinetic_energy(theta)Return the body's specific kinetic energy
mean_anomaly(theta)Return the body's mean anomaly
modified_delaunay_elements([theta])Get the modified Delaunay elements of the orbit
orbital_elements([theta])Get the orbital elements of the orbit
potential(theta)Return the gravitational potential at the body's position
radius(theta)Return the body's radius
speed(theta)Return the body's speed
state(theta)Return the orbital state vector in Cartesian coordinates
Examples
Scalar parameters defining a single binary system in the perifocal plane.
>>> dyad.TwoBody(1., 1., 1., 0.) <dyad._core.TwoBody object at 0x...>
Scalar parameters defining a single orbit in the observer’s frame.
>>> dyad.TwoBody(1., 1., 1., 0., 1., 1., 1.) <dyad._core.TwoBody object at 0x...>
Array-like parameters defining multiple orbits.
>>> m, q, a, e = [1., 1.], [1., 1.], [1., 1.], [0., 0.] >>> dyad.TwoBody(m, q, a, e) <dyad._core.TwoBody object at 0x...>
The relative position and velocity of the secondary body with respect to the primary body in the form \((x, y, z, v_{x}, v_{y}, v_{z})\).
>>> dyad.TwoBody(1., 1., 1., 0.).state(1.) array([ 0.54030231, 0.84147098, 0. , -0.02047084, 0.01314417, 0. ])
The position and velocity of the primary and secondary bodies with respect to the centre-of-mass frame each again in the form \(x, y, z, v_{x}, v_{y}, v_{z}\).
>>> dyad.TwoBody(1., 1., 1., 0.).primary.state(1.) array([ 0.27015115, 0.42073549, 0. , -0.01023542, 0.00657209, 0. ]) >>> dyad.TwoBody(1., 1., 1., 0.).secondary.state(1.) array([-0.27015115, -0.42073549, -0. , 0.01023542, -0.00657209, -0. ])
Methods
__init__(m_1, m_2, a, e[, Omega, i, omega])delaunay_elements([theta])Get the Delaunay elements of the orbit
eccentric_anomaly(theta)Return the body's eccentric anomaly
kinetic_energy(theta)Return the body's specific kinetic energy
mean_anomaly(theta)Return the body's mean anomaly
modified_delaunay_elements([theta])Get the modified Delaunay elements of the orbit
orbital_elements([theta])Get the orbital elements of the orbit
potential(theta)Return the gravitational potential at the body's position
radius(theta)Return the body's radius
speed(theta)Return the body's speed
state(theta)Return the orbital state vector in Cartesian coordinates
Attributes
angular_momentumGet the body's specific angular momentum
angular_momentum_magnitudeGet the magnitude of the body's specific angular momentum
apoapsisGet the apoapsis of the orbit
areaGet the area contained by the orbit
argument_of_pericentreGet the orbit's argument of pericentre
central_massGet the central mass
eccentricityGet the orbit's eccentricity
eccentricity_vectorGet the eccentricity vector of the orbit
energyGet the body's specific total energy
inclinationGet the inclination of the orbit
longitude_of_ascending_nodeGet the longitude of the ascending node of the orbit
lrl_vectorGet the Laplace-Runge-Lenz vector of the orbit
periapsisGet the periapsis of the orbit
periodGet the orbital period
primaryGet the primary body's orbit as an instance of
OrbitsecondaryGet the secondary body's orbit as an instance of
Orbitsemilatus_rectumGet the orbit's semilatus rectum
semimajor_axisGet the orbit's semimajor axis
semiminor_axisGet the orbit's semiminor axis