Mean Elements¶
Functions for converting between mean and osculating Keplerian orbital elements, using either first-order Brouwer-Lyddane theory or numerical windowed averaging.
Note
For conceptual explanations and usage examples, see Mean Elements in the User Guide.
Single-State Conversions¶
state_koe_osc_to_mean builtin ¶
state_koe_osc_to_mean(osc: ndarray, method: MeanElementMethod, angle_format: AngleFormat) -> ndarray
Convert osculating Keplerian elements to mean Keplerian elements.
Applies the selected mean-element method to convert osculating (instantaneous) orbital elements to mean (orbit-averaged) elements. MeanElementMethod.numerical() is batch-only and raises for single-state calls; use MeanElementMethod.BROUWER_LYDDANE for the first-order analytical J2 mapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
osc | ndarray | Osculating Keplerian elements as a 6-element array: [a, e, i, Ω, ω, M] where: - a: Semi-major axis (meters) - e: Eccentricity (dimensionless) - i: Inclination (radians or degrees, per angle_format) - Ω: Right ascension of ascending node (radians or degrees, per angle_format) - ω: Argument of perigee (radians or degrees, per angle_format) - M: Mean anomaly (radians or degrees, per angle_format) | required |
method | MeanElementMethod | Algorithm used to compute mean elements. | required |
angle_format | AngleFormat | Format of angular elements (Radians or Degrees) | required |
Returns:
| Type | Description |
|---|---|
ndarray | numpy.ndarray: Mean Keplerian elements in the same format as input. |
Raises:
| Type | Description |
|---|---|
BraheError | If |
Note
The forward and inverse transformations are not perfectly inverse due to first-order truncation of the infinite series. Small errors of order J2² are expected.
Example
state_koe_mean_to_osc builtin ¶
state_koe_mean_to_osc(mean: ndarray, method: MeanElementMethod, angle_format: AngleFormat) -> ndarray
Convert mean Keplerian elements to osculating Keplerian elements.
Applies the selected mean-element method to convert mean (orbit-averaged) orbital elements to osculating (instantaneous) elements. MeanElementMethod.numerical() is batch-only and raises for single-state calls; use MeanElementMethod.BROUWER_LYDDANE for the first-order analytical J2 mapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mean | ndarray | Mean Keplerian elements as a 6-element array: [a, e, i, Ω, ω, M] where: - a: Semi-major axis (meters) - e: Eccentricity (dimensionless) - i: Inclination (radians or degrees, per angle_format) - Ω: Right ascension of ascending node (radians or degrees, per angle_format) - ω: Argument of perigee (radians or degrees, per angle_format) - M: Mean anomaly (radians or degrees, per angle_format) | required |
method | MeanElementMethod | Algorithm used to compute osculating elements. | required |
angle_format | AngleFormat | Format of angular elements (Radians or Degrees) | required |
Returns:
| Type | Description |
|---|---|
ndarray | numpy.ndarray: Osculating Keplerian elements in the same format as input. |
Raises:
| Type | Description |
|---|---|
BraheError | If |
Note
The forward and inverse transformations are not perfectly inverse due to first-order truncation of the infinite series. Small errors of order J2² are expected.
Example
Batch Conversions¶
states_koe_osc_to_mean builtin ¶
states_koe_osc_to_mean(epochs: list[Epoch], states: ndarray, method: MeanElementMethod, angle_format: AngleFormat) -> Tuple
Convert a batch of osculating Keplerian states to mean Keplerian states.
Applies the selected mean-element method across an epoch/state series. MeanElementMethod.BROUWER_LYDDANE maps each (epoch, state) pair independently, so the output has the same length as the input. MeanElementMethod.numerical() instead averages the osculating states over a moving window (see MeanElementNumericalMethodConfig); the output may be shorter than the input when edge is WindowEdgeHandling.TRUNCATE and some output epochs' windows are not fully supported by the input trajectory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epochs | list[Epoch] | Epochs of the input osculating states, one per | required |
states | ndarray | Osculating Keplerian elements, shape (M, 6). Each row is [a, e, i, Ω, ω, M] where: - a: Semi-major axis (meters) - e: Eccentricity (dimensionless) - i: Inclination (radians or degrees, per angle_format) - Ω: Right ascension of ascending node (radians or degrees, per angle_format) - ω: Argument of perigee (radians or degrees, per angle_format) - M: Mean anomaly (radians or degrees, per angle_format) | required |
method | MeanElementMethod | Algorithm used to compute mean elements. | required |
angle_format | AngleFormat | Format of angular elements (Radians or Degrees). | required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple | Tuple | (list[Epoch], numpy.ndarray) of output epochs and mean Keplerian elements, shape (N, 6). N equals M for |
Raises:
| Type | Description |
|---|---|
BraheError | If |
Example
states_koe_mean_to_osc builtin ¶
states_koe_mean_to_osc(epochs: list[Epoch], states: ndarray, method: MeanElementMethod, angle_format: AngleFormat) -> Tuple
Convert a batch of mean Keplerian states to osculating Keplerian states.
Applies the selected mean-element method across an epoch/state series. MeanElementMethod.BROUWER_LYDDANE maps each (epoch, state) pair independently, so the output has the same length as the input. MeanElementMethod.numerical() instead inverts the windowed averaging via iterative differential correction (see MeanElementNumericalMethodConfig and MeanElementInverseConfig); the output has the same length and epochs as the input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epochs | list[Epoch] | Epochs of the input mean states, one per | required |
states | ndarray | Mean Keplerian elements, shape (M, 6). Each row is [a, e, i, Ω, ω, M] where: - a: Semi-major axis (meters) - e: Eccentricity (dimensionless) - i: Inclination (radians or degrees, per angle_format) - Ω: Right ascension of ascending node (radians or degrees, per angle_format) - ω: Argument of perigee (radians or degrees, per angle_format) - M: Mean anomaly (radians or degrees, per angle_format) | required |
method | MeanElementMethod | Algorithm used to compute osculating elements. | required |
angle_format | AngleFormat | Format of angular elements (Radians or Degrees). | required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple | Tuple | (list[Epoch], numpy.ndarray) of output epochs and osculating Keplerian elements, shape (M, 6). |
Raises:
| Type | Description |
|---|---|
BraheError | If |
Example
Methods and Configuration¶
MeanElementMethod ¶
Algorithm used to map between mean and osculating Keplerian elements.
Note
This class is created via a class attribute and a class method: - MeanElementMethod.BROUWER_LYDDANE - First-order analytical J2 mapping - MeanElementMethod.numerical(config) - Numerical windowed averaging (batch-only)
Example
Initialize instance.
BROUWER_LYDDANE class-attribute ¶
BROUWER_LYDDANE: Any = MeanElementMethod.BROUWER_LYDDANE
Algorithm used to map between mean and osculating Keplerian elements.
Note
This class is created via a class attribute and a class method: - MeanElementMethod.BROUWER_LYDDANE - First-order analytical J2 mapping - MeanElementMethod.numerical(config) - Numerical windowed averaging (batch-only)
Example
numerical builtin ¶
numerical(config: MeanElementNumericalMethodConfig) -> MeanElementMethod
Create a numerical windowed-averaging method selector (batch-only).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | MeanElementNumericalMethodConfig | Numerical averaging window configuration. | required |
Returns:
| Name | Type | Description |
|---|---|---|
MeanElementMethod | MeanElementMethod | A numerical method selector. |
WindowAlignment ¶
WindowEdgeHandling ¶
MeanElementNumericalMethodConfig ¶
MeanElementNumericalMethodConfig(window_seconds: float, alignment: WindowAlignment, edge: WindowEdgeHandling, inverse: MeanElementInverseConfig = None)
Configuration for the numerical windowed-averaging mean-element method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window_seconds | float | Averaging window length in seconds. | required |
alignment | WindowAlignment | Placement of the averaging window relative to the output epoch. | required |
edge | WindowEdgeHandling | Handling of output epochs whose window runs past the data bounds. | required |
inverse | MeanElementInverseConfig | Dynamics for the iterative mean-to-osculating inverse. Required for numerical mean-to-osculating conversion; unused for osculating-to-mean. | None |
Example
Initialize instance.
MeanElementInverseConfig ¶
MeanElementInverseConfig(force_model: ForceModelConfig, propagation: NumericalPropagationConfig, tolerance: float, max_iterations: int)
Iterative differential-correction dynamics for numerical mean-to-osculating conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force_model | ForceModelConfig | Force model used to propagate the trial osculating state. | required |
propagation | NumericalPropagationConfig | Integrator settings for the trial propagation. | required |
tolerance | float | Convergence tolerance on the mean-element residual, compared against the mixed norm | required |
max_iterations | int | Maximum number of differential-correction iterations. | required |
Example
Initialize instance.
See Also¶
- Mean Elements Guide - Conceptual overview and usage examples
- Equinoctial Elements - Equinoctial element conversions used internally by numerical averaging