Skip to content

OrbitTrajectory

OrbitTrajectory is a specialized trajectory container for orbital mechanics that stores states in a specific reference frame (ECI or ECEF) and can automatically transform between frames when querying.

OrbitTrajectory has the same API as Trajectory, plus frame awareness.

OrbitTrajectory

OrbitTrajectory(dimension: int, frame: OrbitFrame, representation: OrbitRepresentation, angle_format: Union[AngleFormat, None] = None)

Orbital trajectory with frame and representation awareness.

Stores a sequence of orbital states at specific epochs with support for interpolation, frame conversions, and representation transformations.

Parameters:

Name Type Description Default
dimension int

State dimension (minimum 6 for position + velocity)

required
frame OrbitFrame

Reference frame for the trajectory

required
representation OrbitRepresentation

State representation format

required
angle_format AngleFormat or None

Angle format for Keplerian states, must be None for Cartesian representation

None

Attributes:

Name Type Description
dimension int

State vector dimension

frame OrbitFrame

Reference frame

representation OrbitRepresentation

State representation format

angle_format AngleFormat or None

Angle format for Keplerian representation

interpolation_method InterpolationMethod

Current interpolation method

Example
1
2
3
4
import brahe as bh

# Create trajectory in ECI Cartesian frame
traj = bh.OrbitTrajectory(6, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)

Initialize instance.

angle_format property

angle_format: AngleFormat

Get trajectory angle format for Keplerian states.

Returns:

Type Description
AngleFormat

AngleFormat or None: Angle format for Keplerian representation, None for Cartesian

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
print(f"Angle format: {traj.angle_format}")

frame property

frame: OrbitFrame

Get trajectory reference frame.

Returns:

Name Type Description
OrbitFrame OrbitFrame

Reference frame of the trajectory

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
print(f"Frame: {traj.frame}")

length property

length: int

Get the number of states in the trajectory.

Returns:

Name Type Description
int int

Number of states in the trajectory

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.DTrajectory(6)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
print(f"Trajectory length: {traj.length}")

representation property

representation: OrbitRepresentation

Get trajectory state representation.

Returns:

Name Type Description
OrbitRepresentation OrbitRepresentation

State representation format of the trajectory

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
print(f"Representation: {traj.representation}")

acceleration_at_idx method descriptor

acceleration_at_idx(index: int) -> ndarray

Get the acceleration vector at a specific index.

Parameters:

Name Type Description Default
index int

Index of the state point

required

Returns:

Type Description
ndarray

numpy.ndarray | None: Acceleration vector if stored, None if acceleration storage is not enabled

Raises:

Type Description
IndexError

If index is out of bounds

Example
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(6, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj.enable_acceleration_storage(3)

epoch = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
acc = np.array([-9.0, 0.1, -0.05])
traj.add_with_acceleration(epoch, state, acc)

retrieved_acc = traj.acceleration_at_idx(0)
print(retrieved_acc)  # [-9.0, 0.1, -0.05]

add method descriptor

add(epoch: Epoch, state: ndarray) -> Any

Add a state to the trajectory.

Parameters:

Name Type Description Default
epoch Epoch

Time of the state

required
state ndarray

State vector with dimension matching trajectory's dimension

required
Example
import brahe as bh
import numpy as np

# Standard 6D trajectory
traj = bh.OrbitTrajectory(6, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)

# Extended 9D trajectory
traj_ext = bh.OrbitTrajectory(9, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
state_ext = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0, 1.0, 2.0, 3.0])
traj_ext.add(epc, state_ext)

add_state_and_covariance method descriptor

add_state_and_covariance(epoch: Epoch, state: ndarray, covariance: ndarray) -> ndarray

Add a state vector and associated covariance matrix to the trajectory.

Parameters:

Name Type Description Default
epoch Epoch

Time of the state and covariance

required
state ndarray

6-element state vector [x, y, z, vx, vy, vz] in meters and m/s

required
covariance ndarray

6x6 covariance matrix in the same units

required

Raises:

Type Description
RuntimeError

If the trajectory was not initialized with covariances enabled

Example
import brahe as bh
import numpy as np

epoch = bh.Epoch.from_datetime(2024, 1, 1, 0, 0, 0.0)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
cov = np.eye(6) * 1000.0

traj = bh.OrbitTrajectory.from_orbital_data(
    [epoch], [state], bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN,
    covariances=np.array([cov])
)

new_epoch = epoch + 60.0
new_state = np.array([bh.R_EARTH + 500e3, 100.0, 0.0, 0.0, 7.5e3, 0.0])
new_cov = np.eye(6) * 1100.0
traj.add_state_and_covariance(new_epoch, new_state, new_cov)

add_with_acceleration method descriptor

add_with_acceleration(epoch: Epoch, state: ndarray, acceleration: ndarray) -> Any

Add a state with its corresponding acceleration to the trajectory.

Parameters:

Name Type Description Default
epoch Epoch

Epoch for the state

required
state ndarray

State vector

required
acceleration ndarray

Acceleration vector

required

Raises:

Type Description
ValueError

If acceleration storage is not enabled or dimension mismatch

Example
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(6, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj.enable_acceleration_storage(3)
traj.set_interpolation_method(bh.InterpolationMethod.HERMITE_QUINTIC)

epoch = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
acc = np.array([-9.0, 0.0, 0.0])  # Gravity acceleration

traj.add_with_acceleration(epoch, state, acc)
traj.add_with_acceleration(epoch + 60.0, state, acc)

# Now HermiteQuintic interpolation will use stored accelerations
mid_state = traj.interpolate(epoch + 30.0)

additional_dimension method descriptor

additional_dimension() -> int

Get the number of additional state elements beyond the orbital state.

Returns:

Name Type Description
int int

Number of additional states (dimension - 6)

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(9, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
print(f"Additional dimension: {traj.additional_dimension()}")  # 3

clear method descriptor

clear() -> Any

Clear all states from the trajectory.

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
traj.clear()

covariance method descriptor

covariance(epoch: Epoch) -> ndarray

Get the covariance matrix at a specific epoch in the trajectory's native frame.

Parameters:

Name Type Description Default
epoch Epoch

Time at which to retrieve the covariance

required

Returns:

Type Description
ndarray

np.ndarray | None: 6x6 covariance matrix, or None if no covariances are available

Example
import brahe as bh
import numpy as np

epoch = bh.Epoch.from_datetime(2024, 1, 1, 0, 0, 0.0)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
cov = np.eye(6) * 1000.0

traj = bh.OrbitTrajectory.from_orbital_data(
    [epoch], [state], bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN,
    covariances=np.array([cov])
)

result = traj.covariance(epoch)
print(result)  # 6x6 numpy array

covariance_eci method descriptor

covariance_eci(epoch: Epoch) -> ndarray

Get the covariance matrix at a specific epoch in the ECI frame.

Parameters:

Name Type Description Default
epoch Epoch

Time at which to retrieve the covariance

required

Returns:

Type Description
ndarray

np.ndarray | None: 6x6 covariance matrix in ECI frame, or None if no covariances are available

Example
import brahe as bh
import numpy as np

epoch = bh.Epoch.from_datetime(2024, 1, 1, 0, 0, 0.0)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
cov = np.eye(6) * 1000.0

traj = bh.OrbitTrajectory.from_orbital_data(
    [epoch], [state], bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN,
    covariances=np.array([cov])
)

result = traj.covariance_eci(epoch)
print(result)  # 6x6 numpy array

covariance_gcrf method descriptor

covariance_gcrf(epoch: Epoch) -> ndarray

Get the covariance matrix at a specific epoch in the GCRF frame.

Parameters:

Name Type Description Default
epoch Epoch

Time at which to retrieve the covariance

required

Returns:

Type Description
ndarray

np.ndarray | None: 6x6 covariance matrix in GCRF frame, or None if no covariances are available

Example
import brahe as bh
import numpy as np

epoch = bh.Epoch.from_datetime(2024, 1, 1, 0, 0, 0.0)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
cov = np.eye(6) * 1000.0

traj = bh.OrbitTrajectory.from_orbital_data(
    [epoch], [state], bh.OrbitFrame.GCRF, bh.OrbitRepresentation.CARTESIAN,
    covariances=np.array([cov])
)

result = traj.covariance_gcrf(epoch)
print(result)  # 6x6 numpy array

covariance_rtn method descriptor

covariance_rtn(epoch: Epoch) -> ndarray

Get the covariance matrix at a specific epoch in the RTN (Radial, Along-Track, Normal) frame.

The RTN frame is defined as: - R (Radial): Along the position vector (away from Earth center) - T (Along-track): Completes right-handed system (N × R) - N (Normal): Perpendicular to the orbital plane (along angular momentum)

Parameters:

Name Type Description Default
epoch Epoch

Time at which to retrieve the covariance

required

Returns:

Type Description
ndarray

np.ndarray | None: 6x6 covariance matrix in RTN frame, or None if no covariances are available

Example
import brahe as bh
import numpy as np

epoch = bh.Epoch.from_datetime(2024, 1, 1, 0, 0, 0.0)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
cov = np.eye(6) * 1000.0

traj = bh.OrbitTrajectory.from_orbital_data(
    [epoch], [state], bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN,
    covariances=np.array([cov])
)

result = traj.covariance_rtn(epoch)
print(result)  # 6x6 numpy array in RTN frame

default builtin

default() -> OrbitTrajectory

Create a default empty orbital trajectory (ECI Cartesian).

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

New trajectory with ECI frame and Cartesian representation

dimension method descriptor

dimension() -> int

Get trajectory dimension (always 6 for orbital trajectories).

Returns:

Name Type Description
int int

Dimension of the trajectory (always 6)

Example
1
2
3
4
5
6
import brahe as bh

traj = bh.OrbitTrajectory(6, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
print(f"Dimension: {traj.dimension()}")
print(f"Orbital dimension: {traj.orbital_dimension()}")
print(f"Additional dimension: {traj.additional_dimension()}")

enable_acceleration_storage method descriptor

enable_acceleration_storage(dimension: int) -> OrbitTrajectory

Enable storage of acceleration data for this trajectory.

When enabled, accelerations can be stored alongside state data. This is useful for HermiteQuintic interpolation which uses acceleration information for smoother C2-continuous interpolation.

Parameters:

Name Type Description Default
dimension int

Dimension of acceleration vectors (typically 3 for 3D acceleration)

required

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Self with acceleration storage enabled

Example
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(6, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj.enable_acceleration_storage(3)  # Enable 3D acceleration storage

epoch = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
acc = np.array([-9.0, 0.0, 0.0])  # Gravity acceleration
traj.add_with_acceleration(epoch, state, acc)

end_epoch method descriptor

end_epoch() -> Epoch

Get end epoch of trajectory.

Returns:

Type Description
Epoch

Epoch or None: Last epoch if trajectory is not empty, None otherwise

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
print(f"End epoch: {traj.end_epoch()}")

epoch_at_idx method descriptor

epoch_at_idx(index: int) -> Epoch

Get the epoch at a specific index.

Parameters:

Name Type Description Default
index int

Index of the epoch to retrieve

required

Returns:

Name Type Description
Epoch Epoch

Epoch at the specified index

Example
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.UTC)
state = np.array([7000e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
traj.add(epc, state)

# Get epoch at index
epoch_0 = traj.epoch_at_idx(0)

epochs method descriptor

epochs() -> list[Epoch]

Get all epochs as a list of Epoch objects.

Returns:

Type Description
list[Epoch]

list[Epoch]: List of Epoch objects for all trajectory points

Example
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
traj.add(epc + 60.0, state)
epochs_list = traj.epochs()
print(f"First epoch: {epochs_list[0]}")

first method descriptor

first() -> Tuple

Get the first (epoch, state) tuple in the trajectory, if any exists.

Returns:

Type Description
Tuple

tuple or None: Tuple of (Epoch, numpy.ndarray) for first state, or None if empty

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
first_epc, first_state = traj.first()

from_orbital_data builtin

from_orbital_data(epochs: list[Epoch], states: ndarray, frame: OrbitFrame, representation: OrbitRepresentation, angle_format: Union[AngleFormat, None] = None, covariances: Union[ndarray, None] = None) -> OrbitTrajectory

Create orbital trajectory from existing data.

Parameters:

Name Type Description Default
epochs list[Epoch]

List of time epochs for each state

required
states ndarray

2D array of 6-element state vectors with shape (N, 6) where N is the number of epochs. Each row is one state vector.

required
frame OrbitFrame

Reference frame for the states

required
representation OrbitRepresentation

State representation format

required
angle_format AngleFormat or None

Angle format for Keplerian states, must be None for Cartesian representation

None
covariances ndarray or None

Optional 3D array of 6x6 covariance matrices with shape (N, 6, 6) where N is the number of epochs. Only supported for ECI and GCRF frames.

None

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

New trajectory instance populated with data

Example
import brahe as bh
import numpy as np

epochs = [bh.Epoch.from_datetime(2024, 1, 1, 0, 0, 0.0)]
states = np.array([[bh.R_EARTH + 500e3, 0, 0, 0, 7500, 0]])
# Covariance is optional
covs = np.array([np.eye(6) * 100.0])  # 100 m² position variance

traj = bh.OrbitTrajectory.from_orbital_data(
    epochs, states, bh.OrbitFrame.ECI,
    bh.OrbitRepresentation.CARTESIAN, None,
    covariances=covs
)

get method descriptor

get(index: int) -> Tuple

Get both epoch and state at a specific index.

Parameters:

Name Type Description Default
index int

Index to retrieve

required

Returns:

Name Type Description
tuple Tuple

Tuple of (Epoch, numpy.ndarray) for epoch and state at the index

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
ret_epc, ret_state = traj.get(0)

get_covariance_interpolation_method method descriptor

get_covariance_interpolation_method() -> CovarianceInterpolationMethod

Get the current covariance interpolation method.

Returns:

Name Type Description
CovarianceInterpolationMethod CovarianceInterpolationMethod

Current covariance interpolation method

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
method = traj.get_covariance_interpolation_method()

get_eviction_policy method descriptor

get_eviction_policy() -> str

Get current eviction policy.

Returns:

Name Type Description
str str

String representation of eviction policy

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
policy = traj.get_eviction_policy()

get_id method descriptor

get_id() -> int

Get the trajectory numeric ID.

Returns:

Type Description
int

int | None: The trajectory ID, or None if not set

Example
1
2
3
4
5
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj = traj.with_id(12345)
print(traj.get_id())  # 12345

get_interpolation_method method descriptor

get_interpolation_method() -> InterpolationMethod

Get the current interpolation method.

Returns:

Name Type Description
InterpolationMethod InterpolationMethod

Current interpolation method

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
method = traj.get_interpolation_method()

get_name method descriptor

get_name() -> str

Get the trajectory name.

Returns:

Type Description
str

str | None: The trajectory name, or None if not set

Example
1
2
3
4
5
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj = traj.with_name("My Trajectory")
print(traj.get_name())  # "My Trajectory"

get_uuid method descriptor

get_uuid() -> str

Get the trajectory UUID.

Returns:

Type Description
str

str | None: The trajectory UUID as a string, or None if not set

Example
1
2
3
4
5
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj = traj.with_new_uuid()
print(traj.get_uuid())  # e.g., "550e8400-e29b-41d4-a716-446655440000"

has_accelerations method descriptor

has_accelerations() -> bool

Check if this trajectory has acceleration storage enabled.

Returns:

Name Type Description
bool bool

True if acceleration storage is enabled, False otherwise

Example
1
2
3
4
5
6
7
import brahe as bh

traj = bh.OrbitTrajectory(6, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
print(traj.has_accelerations())  # False

traj.enable_acceleration_storage(3)
print(traj.has_accelerations())  # True

index_after_epoch method descriptor

index_after_epoch(epoch: Epoch) -> int

Get the index of the state at or after the given epoch.

Parameters:

Name Type Description Default
epoch Epoch

Target epoch

required

Returns:

Name Type Description
int int

Index of the state at or after the target epoch

Example
1
2
3
4
5
6
7
8
9
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc1 = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc1, state)
epc2 = bh.Epoch.from_datetime(2024, 1, 1, 11, 59, 0.0, 0.0, bh.TimeSystem.UTC)
index = traj.index_after_epoch(epc2)

index_before_epoch method descriptor

index_before_epoch(epoch: Epoch) -> int

Get the index of the state at or before the given epoch.

Parameters:

Name Type Description Default
epoch Epoch

Target epoch

required

Returns:

Name Type Description
int int

Index of the state at or before the target epoch

Example
1
2
3
4
5
6
7
8
9
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc1 = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc1, state)
epc2 = bh.Epoch.from_datetime(2024, 1, 1, 12, 1, 0.0, 0.0, bh.TimeSystem.UTC)
index = traj.index_before_epoch(epc2)

interpolate method descriptor

interpolate(epoch: Epoch) -> ndarray

Interpolate state at a given epoch using the configured interpolation method.

Parameters:

Name Type Description Default
epoch Epoch

Target epoch

required

Returns:

Type Description
ndarray

numpy.ndarray: Interpolated state vector

Example
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc1 = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state1 = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc1, state1)
epc2 = bh.Epoch.from_datetime(2024, 1, 1, 12, 2, 0.0, 0.0, bh.TimeSystem.UTC)
state2 = np.array([bh.R_EARTH + 510e3, 0.0, 0.0, 0.0, 7650.0, 0.0])
traj.add(epc2, state2)
epc_mid = bh.Epoch.from_datetime(2024, 1, 1, 12, 1, 0.0, 0.0, bh.TimeSystem.UTC)
state_interp = traj.interpolate(epc_mid)

interpolate_linear method descriptor

interpolate_linear(epoch: Epoch) -> ndarray

Interpolate state at a given epoch using linear interpolation.

Parameters:

Name Type Description Default
epoch Epoch

Target epoch

required

Returns:

Type Description
ndarray

numpy.ndarray: Linearly interpolated state vector

Example
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc1 = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state1 = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc1, state1)
epc2 = bh.Epoch.from_datetime(2024, 1, 1, 12, 2, 0.0, 0.0, bh.TimeSystem.UTC)
state2 = np.array([bh.R_EARTH + 510e3, 0.0, 0.0, 0.0, 7650.0, 0.0])
traj.add(epc2, state2)
epc_mid = bh.Epoch.from_datetime(2024, 1, 1, 12, 1, 0.0, 0.0, bh.TimeSystem.UTC)
state_interp = traj.interpolate_linear(epc_mid)

is_empty method descriptor

is_empty() -> bool

Check if trajectory is empty.

Returns:

Name Type Description
bool bool

True if trajectory contains no states, False otherwise

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
print(f"Is empty: {traj.is_empty()}")

last method descriptor

last() -> Tuple

Get the last (epoch, state) tuple in the trajectory, if any exists.

Returns:

Type Description
Tuple

tuple or None: Tuple of (Epoch, numpy.ndarray) for last state, or None if empty

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
last_epc, last_state = traj.last()

len method descriptor

len() -> int

Get the number of states in the trajectory (alias for length).

Returns:

Name Type Description
int int

Number of states in the trajectory

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.DTrajectory(6)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
print(f"Number of states: {traj.len()}")

nearest_state method descriptor

nearest_state(epoch: Epoch) -> Tuple

Get the nearest state to a given epoch.

Parameters:

Name Type Description Default
epoch Epoch

Target epoch

required

Returns:

Name Type Description
tuple Tuple

Tuple of (Epoch, numpy.ndarray) containing the nearest state

Example
1
2
3
4
5
6
7
8
9
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc1 = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc1, state)
epc2 = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 30.0, 0.0, bh.TimeSystem.UTC)
nearest_epc, nearest_state = traj.nearest_state(epc2)

orbital_dimension method descriptor

orbital_dimension() -> int

Get the orbital state dimension (always 6).

The orbital state consists of position (3) and velocity (3) components.

Returns:

Name Type Description
int int

Always returns 6

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(9, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
print(f"Orbital dimension: {traj.orbital_dimension()}")  # 6

remove method descriptor

remove(index: int) -> Tuple

Remove a state at a specific index.

Parameters:

Name Type Description Default
index int

Index of the state to remove

required

Returns:

Name Type Description
tuple Tuple

Tuple of (Epoch, numpy.ndarray) for the removed epoch and state

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
removed_epc, removed_state = traj.remove(0)

remove_epoch method descriptor

remove_epoch(epoch: Epoch) -> ndarray

Remove a state at a specific epoch.

Parameters:

Name Type Description Default
epoch Epoch

Epoch of the state to remove

required

Returns:

Type Description
ndarray

numpy.ndarray: The removed state vector

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
removed_state = traj.remove_epoch(epc)

set_acceleration_at method descriptor

set_acceleration_at(index: int, acceleration: ndarray) -> Any

Set the acceleration vector at a specific index.

Parameters:

Name Type Description Default
index int

Index of the state point

required
acceleration ndarray

Acceleration vector to set

required

Raises:

Type Description
IndexError

If index is out of bounds

ValueError

If acceleration storage is not enabled or dimension mismatch

Example
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(6, bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj.enable_acceleration_storage(3)

epoch = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
traj.add(epoch, state)  # Add state without acceleration

# Set acceleration later
acc = np.array([-9.0, 0.1, -0.05])
traj.set_acceleration_at(0, acc)

set_covariance_interpolation_method method descriptor

set_covariance_interpolation_method(method: CovarianceInterpolationMethod) -> Any

Set the covariance interpolation method.

Parameters:

Name Type Description Default
method CovarianceInterpolationMethod

Covariance interpolation method to use

required
Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj.set_covariance_interpolation_method(bh.CovarianceInterpolationMethod.MATRIX_SQUARE_ROOT)

set_eviction_policy_max_age method descriptor

set_eviction_policy_max_age(max_age: float) -> Any

Set eviction policy to keep states within maximum age.

Parameters:

Name Type Description Default
max_age float

Maximum age in seconds relative to most recent state

required
Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj.set_eviction_policy_max_age(3600.0)

set_eviction_policy_max_size method descriptor

set_eviction_policy_max_size(max_size: int) -> Any

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
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj.set_eviction_policy_max_size(1000)

set_interpolation_method method descriptor

set_interpolation_method(method: InterpolationMethod) -> Any

Set the interpolation method for the trajectory.

Parameters:

Name Type Description Default
method InterpolationMethod

New interpolation method

required
Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj.set_interpolation_method(bh.InterpolationMethod.LINEAR)

start_epoch method descriptor

start_epoch() -> Epoch

Get start epoch of trajectory.

Returns:

Type Description
Epoch

Epoch or None: First epoch if trajectory is not empty, None otherwise

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
print(f"Start epoch: {traj.start_epoch()}")

state method descriptor

state(epoch: Epoch) -> ndarray

Get state at specified epoch (in native frame/representation).

Parameters:

Name Type Description Default
epoch Epoch

Time for state query

required

Returns:

Type Description
ndarray

numpy.ndarray: State vector in trajectory's native frame and representation

Example
import brahe as bh
import numpy as np

# Create ECI Cartesian trajectory
traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc1 = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.UTC)
state1 = np.array([7000e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
traj.add(epc1, state1)

# Query state at epoch
state = traj.state(epc1)

state_after_epoch method descriptor

state_after_epoch(epoch: Epoch) -> Tuple

Get the state at or after the given epoch.

Parameters:

Name Type Description Default
epoch Epoch

Target epoch

required

Returns:

Name Type Description
tuple Tuple

Tuple of (Epoch, numpy.ndarray) containing state at or after the target epoch

Example
1
2
3
4
5
6
7
8
9
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc1 = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc1, state)
epc2 = bh.Epoch.from_datetime(2024, 1, 1, 11, 59, 0.0, 0.0, bh.TimeSystem.UTC)
ret_epc, ret_state = traj.state_after_epoch(epc2)

state_at_idx method descriptor

state_at_idx(index: int) -> ndarray

Get the state vector at a specific index.

Parameters:

Name Type Description Default
index int

Index of the state to retrieve

required

Returns:

Type Description
ndarray

numpy.ndarray: State vector at the specified index

Example
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.UTC)
state = np.array([7000e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
traj.add(epc, state)

# Get state at index
state_0 = traj.state_at_idx(0)

state_before_epoch method descriptor

state_before_epoch(epoch: Epoch) -> Tuple

Get the state at or before the given epoch.

Parameters:

Name Type Description Default
epoch Epoch

Target epoch

required

Returns:

Name Type Description
tuple Tuple

Tuple of (Epoch, numpy.ndarray) containing state at or before the target epoch

Example
1
2
3
4
5
6
7
8
9
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc1 = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc1, state)
epc2 = bh.Epoch.from_datetime(2024, 1, 1, 12, 1, 0.0, 0.0, bh.TimeSystem.UTC)
ret_epc, ret_state = traj.state_before_epoch(epc2)

state_ecef method descriptor

state_ecef(epoch: Epoch) -> ndarray

Get state in ECEF Cartesian frame at specified epoch.

Parameters:

Name Type Description Default
epoch Epoch

Time for state query

required

Returns:

Type Description
ndarray

numpy.ndarray: State vector in ECEF Cartesian [x, y, z, vx, vy, vz] (meters, m/s)

Example
import brahe as bh
import numpy as np

# Create ECI trajectory
traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.UTC)
state_eci = np.array([7000e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
traj.add(epc, state_eci)

# Get ECEF state (automatically converted from ECI)
state_ecef = traj.state_ecef(epc)

state_eci method descriptor

state_eci(epoch: Epoch) -> ndarray

Get state in ECI Cartesian frame at specified epoch.

Parameters:

Name Type Description Default
epoch Epoch

Time for state query

required

Returns:

Type Description
ndarray

numpy.ndarray: State vector in ECI Cartesian [x, y, z, vx, vy, vz] (meters, m/s)

Example
import brahe as bh
import numpy as np

# Create trajectory in any frame/representation
traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.KEPLERIAN, bh.AngleFormat.DEGREES)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.001, 98.0, 15.0, 30.0, 45.0])
traj.add(epc, oe)

# Get ECI Cartesian state (automatically converted from Keplerian)
state_eci = traj.state_eci(epc)

state_eme2000 method descriptor

state_eme2000(epoch: Epoch) -> ndarray

Get state in EME2000 Cartesian frame at specified epoch.

Parameters:

Name Type Description Default
epoch Epoch

Time for state query

required

Returns:

Type Description
ndarray

numpy.ndarray: State vector in EME2000 Cartesian [x, y, z, vx, vy, vz] (meters, m/s)

Example
import brahe as bh
import numpy as np

# Create GCRF trajectory
traj = bh.OrbitTrajectory(bh.OrbitFrame.GCRF, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.UTC)
state_gcrf = np.array([7000e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
traj.add(epc, state_gcrf)

# Get EME2000 state (automatically converted from GCRF)
state_eme2000 = traj.state_eme2000(epc)

state_gcrf method descriptor

state_gcrf(epoch: Epoch) -> ndarray

Get state in GCRF Cartesian frame at specified epoch.

Parameters:

Name Type Description Default
epoch Epoch

Time for state query

required

Returns:

Type Description
ndarray

numpy.ndarray: State vector in GCRF Cartesian [x, y, z, vx, vy, vz] (meters, m/s)

Example
import brahe as bh
import numpy as np

# Create ITRF trajectory
traj = bh.OrbitTrajectory(bh.OrbitFrame.ITRF, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.UTC)
state_itrf = np.array([7000e3, 0.0, 0.0, 0.0, 0.0, 7.5e3])
traj.add(epc, state_itrf)

# Get GCRF state (automatically converted from ITRF)
state_gcrf = traj.state_gcrf(epc)

state_itrf method descriptor

state_itrf(epoch: Epoch) -> ndarray

Get state in ITRF Cartesian frame at specified epoch.

Parameters:

Name Type Description Default
epoch Epoch

Time for state query

required

Returns:

Type Description
ndarray

numpy.ndarray: State vector in ITRF Cartesian [x, y, z, vx, vy, vz] (meters, m/s)

Example
import brahe as bh
import numpy as np

# Create GCRF trajectory
traj = bh.OrbitTrajectory(bh.OrbitFrame.GCRF, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.UTC)
state_gcrf = np.array([7000e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
traj.add(epc, state_gcrf)

# Get ITRF state (automatically converted from GCRF)
state_itrf = traj.state_itrf(epc)

state_koe_mean method descriptor

state_koe_mean(epoch: Epoch, angle_format: AngleFormat) -> ndarray

Get mean Keplerian elements at a given epoch.

Mean elements are orbit-averaged elements that remove short-period and long-period J2 perturbations using first-order Brouwer-Lyddane theory.

Parameters:

Name Type Description Default
epoch Epoch

The epoch to get elements at.

required
angle_format AngleFormat

If AngleFormat.DEGREES, angular elements are returned in degrees, otherwise in radians.

required

Returns:

Type Description
ndarray

numpy.ndarray: Mean Keplerian elements [a, e, i, raan, argp, M]

Example
import brahe as bh
import numpy as np

# Create Cartesian trajectory
traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.UTC)
state_cart = np.array([7000e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
traj.add(epc, state_cart)

# Get mean elements in degrees
mean_elems = traj.state_koe_mean(epc, bh.AngleFormat.DEGREES)
osc_elems = traj.state_koe_osc(epc, bh.AngleFormat.DEGREES)
print(f"Mean semi-major axis: {mean_elems[0]/1000:.2f} km")
print(f"Osc semi-major axis: {osc_elems[0]/1000:.2f} km")

state_koe_osc method descriptor

state_koe_osc(epoch: Epoch, angle_format: AngleFormat) -> ndarray

Get state as osculating Keplerian elements at specified epoch.

Parameters:

Name Type Description Default
epoch Epoch

Time for state query

required
angle_format AngleFormat

Desired angle format for output

required

Returns:

Type Description
ndarray

numpy.ndarray: Osculating Keplerian elements [a, e, i, raan, argp, M]

Example
import brahe as bh
import numpy as np

# Create Cartesian trajectory
traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.UTC)
state_cart = np.array([7000e3, 0.0, 0.0, 0.0, 7.5e3, 0.0])
traj.add(epc, state_cart)

# Get osculating elements in degrees
elements = traj.state_koe_osc(epc, bh.AngleFormat.DEGREES)
print(f"Semi-major axis: {elements[0]/1000:.2f} km")
print(f"Inclination: {elements[2]:.2f} degrees")

states method descriptor

states() -> ndarray

Get all states as a numpy array.

Returns:

Type Description
ndarray

numpy.ndarray: 2D array of states with shape (N, 6) where N is the number of states

Example
1
2
3
4
5
6
7
8
9
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
traj.add(epc + 60.0, state)
states_array = traj.states()

states_koe_mean method descriptor

states_koe_mean(epochs: list[Epoch], angle_format: AngleFormat) -> List

Get mean Keplerian elements at multiple epochs.

Mean elements are orbit-averaged elements that remove short-period and long-period J2 perturbations using first-order Brouwer-Lyddane theory.

Parameters:

Name Type Description Default
epochs list[Epoch]

List of epochs to query.

required
angle_format AngleFormat

Desired angle format for output.

required

Returns:

Type Description
List

list[numpy.ndarray]: List of mean Keplerian elements [a, e, i, raan, argp, M].

states_koe_osc method descriptor

states_koe_osc(epochs: list[Epoch], angle_format: AngleFormat) -> List

Get osculating Keplerian elements at multiple epochs.

Parameters:

Name Type Description Default
epochs list[Epoch]

List of epochs to query.

required
angle_format AngleFormat

Desired angle format for output.

required

Returns:

Type Description
List

list[numpy.ndarray]: List of osculating Keplerian elements [a, e, i, raan, argp, M].

timespan method descriptor

timespan() -> float

Get time span of trajectory in seconds.

Returns:

Type Description
float

float or None: Time span between first and last epochs, or None if less than 2 states

Example
1
2
3
4
5
6
7
8
9
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
traj.add(epc + 3600.0, state)
print(f"Timespan: {traj.timespan()} seconds")

to_ecef method descriptor

to_ecef() -> OrbitTrajectory

Convert to ECEF (Earth-Centered Earth-Fixed) frame in Cartesian representation.

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Trajectory in ECEF Cartesian frame

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
traj_ecef = traj.to_ecef()

to_eci method descriptor

to_eci() -> OrbitTrajectory

Convert to ECI (Earth-Centered Inertial) frame in Cartesian representation.

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Trajectory in ECI Cartesian frame

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECEF, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 0.0, 0.0])
traj.add(epc, state)
traj_eci = traj.to_eci()

to_eme2000 method descriptor

to_eme2000() -> OrbitTrajectory

Convert to EME2000 (Earth Mean Equator and Equinox of J2000.0) frame in Cartesian representation.

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Trajectory in EME2000 Cartesian frame

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.GCRF, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
traj_eme2000 = traj.to_eme2000()

to_gcrf method descriptor

to_gcrf() -> OrbitTrajectory

Convert to GCRF (Geocentric Celestial Reference Frame) frame in Cartesian representation.

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Trajectory in GCRF Cartesian frame

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.EME2000, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
traj_gcrf = traj.to_gcrf()

to_itrf method descriptor

to_itrf() -> OrbitTrajectory

Convert to ITRF (International Terrestrial Reference Frame) frame in Cartesian representation.

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Trajectory in ITRF Cartesian frame

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.GCRF, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
traj_itrf = traj.to_itrf()

to_keplerian method descriptor

to_keplerian(angle_format: AngleFormat) -> OrbitTrajectory

Convert to Keplerian representation in ECI frame.

Parameters:

Name Type Description Default
angle_format AngleFormat

Angle format for the result (Radians or Degrees)

required

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Trajectory in ECI Keplerian representation

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
traj_kep = traj.to_keplerian(bh.AngleFormat.RADIANS)

to_matrix method descriptor

to_matrix() -> ndarray

Convert trajectory to matrix representation.

Returns:

Type Description
ndarray

numpy.ndarray: 2D array with shape (6, N) where N is number of states

Example
1
2
3
4
5
6
7
8
import brahe as bh
import numpy as np

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
epc = bh.Epoch.from_datetime(2024, 1, 1, 12, 0, 0.0, 0.0, bh.TimeSystem.UTC)
state = np.array([bh.R_EARTH + 500e3, 0.0, 0.0, 0.0, 7600.0, 0.0])
traj.add(epc, state)
matrix = traj.to_matrix()

with_covariance_interpolation_method method descriptor

with_covariance_interpolation_method(method: CovarianceInterpolationMethod) -> OrbitTrajectory

Set covariance interpolation method using builder pattern.

Parameters:

Name Type Description Default
method CovarianceInterpolationMethod

Covariance interpolation method to use

required

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Self with updated covariance interpolation method

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj = traj.with_covariance_interpolation_method(bh.CovarianceInterpolationMethod.TWO_WASSERSTEIN)

with_eviction_policy_max_age method descriptor

with_eviction_policy_max_age(max_age: float) -> OrbitTrajectory

Set eviction policy to keep states within maximum age using builder pattern.

Parameters:

Name Type Description Default
max_age float

Maximum age of states in seconds

required

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Self with updated eviction policy

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj = traj.with_eviction_policy_max_age(3600.0)

with_eviction_policy_max_size method descriptor

with_eviction_policy_max_size(max_size: int) -> OrbitTrajectory

Set eviction policy to keep maximum number of states using builder pattern.

Parameters:

Name Type Description Default
max_size int

Maximum number of states to retain

required

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Self with updated eviction policy

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj = traj.with_eviction_policy_max_size(1000)

with_id method descriptor

with_id(id: int) -> OrbitTrajectory

Set the trajectory numeric ID and return self (builder pattern).

Parameters:

Name Type Description Default
id int

Numeric ID to assign to the trajectory

required

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Self with ID set

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj = traj.with_id(12345)

with_interpolation_method method descriptor

with_interpolation_method(interpolation_method: InterpolationMethod) -> OrbitTrajectory

Set interpolation method using builder pattern.

Parameters:

Name Type Description Default
interpolation_method InterpolationMethod

Interpolation method to use

required

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Self with updated interpolation method

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj = traj.with_interpolation_method(bh.InterpolationMethod.LINEAR)

with_name method descriptor

with_name(name: str) -> OrbitTrajectory

Set the trajectory name and return self (builder pattern).

Parameters:

Name Type Description Default
name str

Name to assign to the trajectory

required

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Self with name set

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj = traj.with_name("My Trajectory")

with_new_uuid method descriptor

with_new_uuid() -> OrbitTrajectory

Generate a new UUID and set it on the trajectory (builder pattern).

Returns:

Name Type Description
OrbitTrajectory OrbitTrajectory

Self with new UUID set

Example
1
2
3
4
import brahe as bh

traj = bh.OrbitTrajectory(bh.OrbitFrame.ECI, bh.OrbitRepresentation.CARTESIAN, None)
traj = traj.with_new_uuid()

See Also