Working with orbit results (Gauss IOD)
This tutorial shows how to consume the successful results returned by TrajectorySet.estimate_all_orbits(...)
and how to navigate the different orbital element families produced by the Gauss solver.
You will learn how to:
- iterate over the successful results map and inspect
GaussResult
objects, - check whether the result is a preliminary or corrected orbit,
- extract the concrete orbital elements (Keplerian, Equinoctial, or Cometary),
- convert between element families when supported,
- serialize results to dictionaries for logging or downstream processing.
The examples assume you already ran batch IOD and obtained
(ok, errors)
fromestimate_all_orbits(env, params, ...)
. See the Trajectories and IODParams tutorials for how to configure and run the solver.
Reference: run_iod() used by the snippets
The code examples below call a shared helper that builds a small dataset, runs batch IOD,
and returns (ok, errors)
. For completeness, here is the helper once:
common_tuto.run_iod() | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
Iterate over successful results
obj_id
is the same identifier you used when ingesting trajectories (int or str).rms
is the post-fit residual RMS (radians) computed over the chosen time window.
Determine the element family
Extract concrete elements
Use the typed accessors; they return None
if the stored family differs.
Units reminder: - Epochs are MJD (TDB). Angles are radians. Distances are AU.
Convert between element families
Conversions are provided by the element classes themselves.
- Keplerian → Equinoctial:
Note: parabolic cometary elements (e = 1) cannot be converted by these helpers and will raise a
ValueError
.
Structured dict serialization
Every GaussResult
can be converted to a plain dictionary for easy logging and JSON export:
Structured dict serialization | |
---|---|
Example for a Keplerian result:
{
'stage': 'corrected',
'type': 'keplerian',
'elements': {
'reference_epoch': 58794.29503864708,
'semi_major_axis': 2.618543557694562,
'eccentricity': 0.2917924222538649,
'inclination': 0.23168624097364912,
'ascending_node_longitude': 0.20856161706357348,
'periapsis_argument': 6.264575557486691,
'mean_anomaly': 0.29001350766154466
}
}
Putting it together: filter, convert, export
Below is a compact pattern you can adapt to your pipeline:
Tips
- Always check the element family via
elements_type()
before calling accessors; the typed helpers returnNone
when mismatched. - When you need a single canonical representation, prefer converting to Keplerian where defined, but keep native cometary elements for
e = 1
. - Store the RMS alongside the elements; it’s a useful quality metric for ranking and filtering.
- If you run
estimate_best_orbit
repeatedly on the sameObservations
instance, be aware of the in-place uncertainty scaling caveat described in the Observations tutorial; recreate the object for bitwise reproducibility.