Keplerian Propagator¶
Analytical two-body orbit propagator using Keplerian orbital elements.
KeplerianPropagator
¶
Python wrapper for KeplerianPropagator (new architecture) Keplerian orbit propagator using two-body dynamics.
The Keplerian propagator implements ideal two-body orbital mechanics without perturbations. It's fast and accurate for short time spans but doesn't account for real-world effects like drag, J2, solar radiation pressure, etc.
Example
import brahe as bh
import numpy as np
# Initial epoch and orbital elements
epc0 = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([7000000.0, 0.001, 0.9, 0.0, 0.0, 0.0]) # a, e, i, RAAN, omega, M
# Create propagator from Keplerian elements
prop = bh.KeplerianPropagator.from_keplerian(
epc0, oe, bh.AngleFormat.RADIANS, step_size=60.0
)
# Propagate forward one orbit
period = bh.orbital_period(oe[0])
epc_future = epc0 + period
state = prop.state(epc_future)
print(f"State after one orbit: {state}")
# Create from Cartesian state
x_cart = np.array([7000000.0, 0.0, 0.0, 0.0, 7546.0, 0.0])
prop2 = bh.KeplerianPropagator(
epc0, x_cart, bh.OrbitFrame.ECI,
bh.OrbitRepresentation.CARTESIAN,
bh.AngleFormat.RADIANS, 60.0
)
Initialize instance.
__doc__
class-attribute
¶
__doc__ = 'Python wrapper for KeplerianPropagator (new architecture)\nKeplerian orbit propagator using two-body dynamics.\n\nThe Keplerian propagator implements ideal two-body orbital mechanics without\nperturbations. It\'s fast and accurate for short time spans but doesn\'t account\nfor real-world effects like drag, J2, solar radiation pressure, etc.\n\nExample:\n ```python\n import brahe as bh\n import numpy as np\n\n # Initial epoch and orbital elements\n epc0 = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)\n oe = np.array([7000000.0, 0.001, 0.9, 0.0, 0.0, 0.0]) # a, e, i, RAAN, omega, M\n\n # Create propagator from Keplerian elements\n prop = bh.KeplerianPropagator.from_keplerian(\n epc0, oe, bh.AngleFormat.RADIANS, step_size=60.0\n )\n\n # Propagate forward one orbit\n period = bh.orbital_period(oe[0])\n epc_future = epc0 + period\n state = prop.state(epc_future)\n print(f"State after one orbit: {state}")\n\n # Create from Cartesian state\n x_cart = np.array([7000000.0, 0.0, 0.0, 0.0, 7546.0, 0.0])\n prop2 = bh.KeplerianPropagator(\n epc0, x_cart, bh.OrbitFrame.ECI,\n bh.OrbitRepresentation.CARTESIAN,\n bh.AngleFormat.RADIANS, 60.0\n )\n ```'
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.
__module__
class-attribute
¶
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.
id
property
¶
id: int
Get the current numeric ID.
Returns:
| Type | Description |
|---|---|
int
|
int or None: The numeric ID, or None if not set. |
trajectory
property
¶
trajectory: OrbitTrajectory
Get accumulated trajectory.
Returns:
| Name | Type | Description |
|---|---|---|
OrbitalTrajectory |
OrbitTrajectory
|
The accumulated trajectory. |
Example
import brahe as bh
import numpy as np
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.01, 0.9, 1.0, 0.5, 0.0])
state = bh.state_osculating_to_cartesian(oe, bh.AngleFormat.RADIANS)
prop = bh.KeplerianPropagator(epc, state, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None, 60.0)
prop.propagate_steps(10)
traj = prop.trajectory
print(f"Trajectory contains {traj.len()} states")
uuid
property
¶
uuid: str
Get the current UUID.
Returns:
| Type | Description |
|---|---|
str
|
str or None: The UUID as a string, or None if not set. |
__new__
builtin
¶
Create and return a new object. See help(type) for accurate signature.
from_ecef
builtin
¶
from_ecef(epoch: Epoch, state: ndarray, step_size: float) -> KeplerianPropagator
Create a new Keplerian propagator from Cartesian state in ECEF frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
Epoch
|
Initial epoch. |
required |
state
|
ndarray
|
6-element Cartesian state [x, y, z, vx, vy, vz] in ECEF frame. |
required |
step_size
|
float
|
Step size in seconds for propagation. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
KeplerianPropagator |
KeplerianPropagator
|
New propagator instance. |
from_eci
builtin
¶
from_eci(epoch: Epoch, state: ndarray, step_size: float) -> KeplerianPropagator
Create a new Keplerian propagator from Cartesian state in ECI frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
Epoch
|
Initial epoch. |
required |
state
|
ndarray
|
6-element Cartesian state [x, y, z, vx, vy, vz] in ECI frame. |
required |
step_size
|
float
|
Step size in seconds for propagation. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
KeplerianPropagator |
KeplerianPropagator
|
New propagator instance. |
from_keplerian
builtin
¶
from_keplerian(epoch: Epoch, elements: ndarray, angle_format: AngleFormat, step_size: float) -> KeplerianPropagator
Create a new Keplerian propagator from Keplerian orbital elements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
Epoch
|
Initial epoch. |
required |
elements
|
ndarray
|
6-element Keplerian elements [a, e, i, raan, argp, mean_anomaly]. |
required |
angle_format
|
AngleFormat
|
Angle format (Degrees or Radians). |
required |
step_size
|
float
|
Step size in seconds for propagation. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
KeplerianPropagator |
KeplerianPropagator
|
New propagator instance. |
generate_uuid
method descriptor
¶
generate_uuid() -> Any
Generate a new UUID and set it in-place (mutating).
propagate_steps
method descriptor
¶
Propagate forward by specified number of steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_steps
|
int
|
Number of steps to take. |
required |
Example
import brahe as bh
import numpy as np
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.01, 0.9, 1.0, 0.5, 0.0])
state = bh.state_osculating_to_cartesian(oe, bh.AngleFormat.RADIANS)
prop = bh.KeplerianPropagator(epc, state, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None, 60.0)
prop.propagate_steps(10) # Take 10 steps (600 seconds total)
print(f"Advanced to: {prop.current_epoch}")
propagate_to
method descriptor
¶
Propagate to a specific target epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_epoch
|
Epoch
|
The epoch to propagate to. |
required |
Example
import brahe as bh
import numpy as np
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.01, 0.9, 1.0, 0.5, 0.0])
state = bh.state_osculating_to_cartesian(oe, bh.AngleFormat.RADIANS)
prop = bh.KeplerianPropagator(epc, state, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None, 60.0)
target = epc + 3600.0 # Propagate to 1 hour ahead
prop.propagate_to(target)
print(f"Propagated to: {prop.current_epoch}")
reset
method descriptor
¶
reset() -> Any
Reset propagator to initial conditions.
Example
import brahe as bh
import numpy as np
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.01, 0.9, 1.0, 0.5, 0.0])
state = bh.state_osculating_to_cartesian(oe, bh.AngleFormat.RADIANS)
prop = bh.KeplerianPropagator(epc, state, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None, 60.0)
prop.propagate_steps(10)
prop.reset() # Return to initial epoch and state
print(f"Reset to: {prop.current_epoch}")
set_eviction_policy_max_age
method descriptor
¶
Set eviction policy to keep states within maximum age.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_age
|
float
|
Maximum age in seconds. |
required |
Example
import brahe as bh
import numpy as np
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.01, 0.9, 1.0, 0.5, 0.0])
state = bh.state_osculating_to_cartesian(oe, bh.AngleFormat.RADIANS)
prop = bh.KeplerianPropagator(epc, state, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None, 60.0)
prop.set_eviction_policy_max_age(3600.0) # Keep only states within 1 hour
prop.propagate_to(epc + 7200.0) # Propagate 2 hours
print(f"Trajectory length: {prop.trajectory.len()}")
set_eviction_policy_max_size
method descriptor
¶
Set eviction policy to keep maximum number of states.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_size
|
int
|
Maximum number of states to retain. |
required |
Example
import brahe as bh
import numpy as np
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.01, 0.9, 1.0, 0.5, 0.0])
state = bh.state_osculating_to_cartesian(oe, bh.AngleFormat.RADIANS)
prop = bh.KeplerianPropagator(epc, state, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None, 60.0)
prop.set_eviction_policy_max_size(100) # Keep only 100 most recent states
prop.propagate_steps(200)
print(f"Trajectory length: {prop.trajectory.len()}")
set_id
method descriptor
¶
Set the numeric ID in-place (mutating).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
int or None
|
Numeric ID to assign, or None to clear. |
required |
set_identity
method descriptor
¶
set_initial_conditions
method descriptor
¶
set_initial_conditions(epoch: Epoch, state: ndarray, frame: OrbitFrame, representation: OrbitRepresentation, angle_format: AngleFormat) -> Any
Set initial conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
Epoch
|
Initial epoch. |
required |
state
|
ndarray
|
Initial state vector. |
required |
frame
|
OrbitFrame
|
Reference frame. |
required |
representation
|
OrbitRepresentation
|
State representation. |
required |
angle_format
|
AngleFormat
|
Angle format. |
required |
Example
import brahe as bh
import numpy as np
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.01, 0.9, 1.0, 0.5, 0.0])
state = bh.state_osculating_to_cartesian(oe, bh.AngleFormat.RADIANS)
prop = bh.KeplerianPropagator(epc, state, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None, 60.0)
# Change initial conditions to a different orbit
new_oe = np.array([bh.R_EARTH + 800e3, 0.02, 1.2, 0.5, 0.3, 0.0])
new_state = bh.state_osculating_to_cartesian(new_oe, bh.AngleFormat.RADIANS)
new_epc = bh.Epoch.from_datetime(2024, 1, 2, 0, 0, 0.0, 0.0, bh.TimeSystem.UTC)
prop.set_initial_conditions(new_epc, new_state, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, bh.AngleFormat.RADIANS)
print(f"New initial epoch: {prop.initial_epoch}")
set_name
method descriptor
¶
Set the name in-place (mutating).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str or None
|
Name to assign, or None to clear. |
required |
state
method descriptor
¶
state_as_osculating_elements
method descriptor
¶
state_as_osculating_elements(epoch: Epoch, angle_format: AngleFormat) -> ndarray
Compute state as osculating elements at a specific epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
Epoch
|
Target epoch for state computation. |
required |
angle_format
|
AngleFormat
|
If AngleFormat.DEGREES, angular elements are returned in degrees, otherwise in radians. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
numpy.ndarray: Osculating elements [a, e, i, raan, argp, mean_anomaly]. |
state_ecef
method descriptor
¶
state_eci
method descriptor
¶
states
method descriptor
¶
states_as_osculating_elements
method descriptor
¶
states_as_osculating_elements(epochs: list[Epoch], angle_format: AngleFormat) -> List
Compute states as osculating elements at multiple epochs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epochs
|
list[Epoch]
|
List of epochs for state computation. |
required |
angle_format
|
AngleFormat
|
If AngleFormat.DEGREES, angular elements are returned in degrees, otherwise in radians. |
required |
Returns:
| Type | Description |
|---|---|
List
|
list[numpy.ndarray]: List of osculating element vectors. |
states_ecef
method descriptor
¶
states_eci
method descriptor
¶
step
method descriptor
¶
step() -> Any
Step forward by the default step size.
Example
import brahe as bh
import numpy as np
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.01, 0.9, 1.0, 0.5, 0.0])
state = bh.state_osculating_to_cartesian(oe, bh.AngleFormat.RADIANS)
prop = bh.KeplerianPropagator(epc, state, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None, 60.0)
prop.step() # Advance by default step_size (60 seconds)
print(f"Advanced to: {prop.current_epoch}")
step_by
method descriptor
¶
Step forward by a specified time duration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_size
|
float
|
Time step in seconds. |
required |
Example
import brahe as bh
import numpy as np
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.01, 0.9, 1.0, 0.5, 0.0])
state = bh.state_osculating_to_cartesian(oe, bh.AngleFormat.RADIANS)
prop = bh.KeplerianPropagator(epc, state, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None, 60.0)
prop.step_by(120.0) # Advance by 120 seconds
print(f"Advanced to: {prop.current_epoch}")
step_past
method descriptor
¶
Step past a specified target epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_epoch
|
Epoch
|
The epoch to step past. |
required |
Example
import brahe as bh
import numpy as np
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.01, 0.9, 1.0, 0.5, 0.0])
state = bh.state_osculating_to_cartesian(oe, bh.AngleFormat.RADIANS)
prop = bh.KeplerianPropagator(epc, state, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None, 60.0)
target = epc + 300.0 # Target 5 minutes ahead
prop.step_past(target)
print(f"Advanced to: {prop.current_epoch}")
with_id
method descriptor
¶
with_id(id: int) -> KeplerianPropagator
Set the numeric ID and return self (consuming constructor pattern).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
int
|
Numeric ID to assign to this propagator. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
KeplerianPropagator |
KeplerianPropagator
|
Self with ID set. |
with_identity
method descriptor
¶
with_identity(name: str or None, uuid_str: str or None, id: int or None) -> KeplerianPropagator
Set all identity fields at once and return self (consuming constructor pattern).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str or None
|
Optional name to assign. |
required |
uuid_str
|
str or None
|
Optional UUID string to assign. |
required |
id
|
int or None
|
Optional numeric ID to assign. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
KeplerianPropagator |
KeplerianPropagator
|
Self with identity set. |
with_name
method descriptor
¶
with_name(name: str) -> KeplerianPropagator
Set the name and return self (consuming constructor pattern).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name to assign to this propagator. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
KeplerianPropagator |
KeplerianPropagator
|
Self with name set. |
Example
import brahe as bh
import numpy as np
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([7000e3, 0.001, 0.9, 0.0, 0.0, 0.0])
prop = bh.KeplerianPropagator.from_keplerian(
epc, oe, bh.AngleFormat.RADIANS, 60.0
).with_name("My Orbit")
print(f"Name: {prop.name}")
with_new_uuid
method descriptor
¶
with_new_uuid() -> KeplerianPropagator
Generate a new UUID, set it, and return self (consuming constructor pattern).
Returns:
| Name | Type | Description |
|---|---|---|
KeplerianPropagator |
KeplerianPropagator
|
Self with new UUID set. |
with_uuid
method descriptor
¶
with_uuid(uuid_str: str) -> KeplerianPropagator
Set the UUID and return self (consuming constructor pattern).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uuid_str
|
str
|
UUID string to assign to this propagator. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
KeplerianPropagator |
KeplerianPropagator
|
Self with UUID set. |
Overview¶
The Keplerian propagator provides fast, analytical orbit propagation for unperturbed two-body motion. It uses closed-form solutions to Kepler's equations for orbital element propagation.
Key Features: - Fast analytical propagation (no numerical integration) - Perfect for preliminary analysis and mission design - No perturbations (atmospheric drag, J2, third-body, etc.) - Suitable for high-altitude orbits where perturbations are minimal
Module: brahe.orbits
When to Use: - Preliminary orbit analysis - High-altitude orbits (GEO, cislunar) - Short propagation times where perturbations are negligible - Educational purposes
When NOT to Use: - LEO orbits requiring accuracy beyond a few days - When atmospheric drag is significant - When J2 perturbations matter - Precise orbit determination applications
Example Usage¶
import brahe as bh
import numpy as np
# Initial orbital elements [a, e, i, Ω, ω, M] in SI units (m, rad)
# Example: Geostationary orbit
a = 42164000.0 # Semi-major axis (m)
e = 0.0001 # Eccentricity
i = 0.0 * bh.DEG2RAD # Inclination (rad)
raan = 0.0 # Right ascension of ascending node (rad)
argp = 0.0 # Argument of periapsis (rad)
M = 0.0 # Mean anomaly (rad)
elements = np.array([a, e, i, raan, argp, M])
# Create epoch
epoch = bh.Epoch.from_datetime(2024, 1, 1, 0, 0, 0.0, 0.0, bh.TimeSystem.UTC)
# Create propagator
prop = bh.KeplerianPropagator(
epoch=epoch,
elements=elements,
element_type=bh.OrbitRepresentation.MEAN_ELEMENTS,
frame=bh.OrbitFrame.ECI,
gm=bh.GM_EARTH
)
# Propagate to a future time
future_epoch = epoch + 86400.0 # 1 day later
state = prop.propagate(future_epoch) # Returns [x, y, z, vx, vy, vz]
# Propagate to multiple times
times = np.linspace(0, 7*86400, 100) # 1 week in 100 steps
epochs = [epoch + dt for dt in times]
states = prop.propagate_multiple(epochs)
print(f"Propagated to {len(states)} epochs")
print(f"Final position: {states[-1][:3]} m")
Orbital Elements¶
The propagator accepts orbital elements in the following order: 1. a - Semi-major axis (meters) 2. e - Eccentricity (dimensionless) 3. i - Inclination (radians) 4. Ω - Right ascension of ascending node (radians) 5. ω - Argument of periapsis (radians) 6. M or ν - Mean anomaly or true anomaly (radians)
Use OrbitRepresentation to specify element type:
- MEAN_ELEMENTS - Mean orbital elements with mean anomaly
- OSCULATING_ELEMENTS - Osculating elements with true anomaly
See Also¶
- SGPPropagator - SGP4/SDP4 propagator for TLE data
- Keplerian Elements - Orbital element conversion functions
- OrbitRepresentation - Element type specification