6. SolutionOD#
- class SolutionOD(filter_obj: FilterOD, output_settings: OutputSettings | None = None)#
Bases:
objectStores and manages the results of an orbit determination process.
Encapsulates all outputs from a filter including state deviations, covariances, residuals, and optional debugging quantities. Storage is controlled by OutputSettings.
- Parameters:
filter_obj (
FilterOD) – The filter object that produced this solution.output_settings (
OutputSettings, optional) – Configuration controlling what quantities are stored.
- output_settings#
Output configuration.
- Type:
OutputSettings
- timestamps#
Epoch timestamps for the solution.
- Type:
np.ndarray
- deviation_est#
Estimated state deviation history [n_epochs x n_states].
- Type:
np.ndarray, optional
- deviation_smooth#
Smoothed state deviation history [n_epochs x n_states].
- Type:
np.ndarray, optional
- covariance_smooth#
Smoothed covariance matrices (from RTS smoother).
- Type:
listofnp.ndarray, optional
- uq_metrics#
Uncertainty quantification metrics (mean, std, skewness, kurtosis, etc.).
- Type:
dict, optional
References
Tapley, B. D., Schutz, B. E., & Born, G. H. (2004). Statistical orbit determination. Elsevier.
Attributes
The filter object used for orbit determination.
Whether this is a covariance analysis.
Number of epochs in the solution.
Number of states in the state vector.
Methods
UQ_compute([particle_states, confidence_levels])Compute UQ metrics for particle-based filters.
create_JSON(filepath[, include_covariances, ...])Export solution results to JSON file.
create_bsp(filepath, epochs[, body_id, ...])Generate BSP (Binary SPK) file for estimated trajectory.
deserialize(filepath[, filter_obj])Deserialize SolutionOD object from binary file.
estimated_trajectory(epochs[, use_smoothed])Computes the estimated trajectory (position, velocity, parameters) for a given set of epochs.
map_state_deviation_to_epoch([...])Maps the state deviation to the initial epoch using the state transition matrix.
print_stats([verbose])Print statistical summary of the OD solution.
propagate_covariance(epochs)Propagate a reference covariance to arbitrary epochs using trajectory STMs.
refresh_measurements_after_outliers(Orbiter, ...)Refreshes measurement data by removing outliers and updating the remaining epochs.
serialize(filepath[, protocol])Serialize SolutionOD object to binary format using pickle.
sync_survived_indices(curr_outlier_ind)Syncs the indices of survived epochs after removing outliers.
- classmethod deserialize(filepath: str | Path, filter_obj: FilterOD | None = None) SolutionOD#
Deserialize SolutionOD object from binary file.
- Parameters:
- Returns:
Deserialized solution object.
- Return type:
- Raises:
FileNotFoundError – If file does not exist.
- UQ_compute(particle_states: ndarray | None = None, confidence_levels: List[float] = [0.68, 0.95, 0.997]) Dict#
Compute UQ metrics for particle-based filters.
- Parameters:
- Returns:
UQ metrics including mean, covariance, percentiles, effective sample size.
- Return type:
- Raises:
ValueError – If particle data is unavailable.
- create_JSON(filepath: str | Path, include_covariances: bool = True, include_residuals: bool = True) None#
Export solution results to JSON file.
- create_bsp(filepath: str | Path, epochs: EpochArray, body_id: int = -999, center_id: int = 399, reference_frame: str = 'J2000') None#
Generate BSP (Binary SPK) file for estimated trajectory.
Requires spiceypy library to be installed.
- Parameters:
filepath (
strorPath) – Path to output BSP file.epochs (
EpochArray) – Epochs for trajectory evaluation.body_id (
int, optional) – SPICE ID for the body. Defaults to -999.center_id (
int, optional) – SPICE ID for central body. Defaults to 399 (Earth).reference_frame (
str, optional) – Reference frame. Defaults to ‘J2000’.
- Raises:
ImportError – If spiceypy is not installed.
ValueError – If deviation_est is not available.
- estimated_trajectory(epochs: EpochArray, use_smoothed: bool = True)#
Computes the estimated trajectory (position, velocity, parameters) for a given set of epochs.
- Parameters:
epochs (
EpochArray) – The epochs for which the estimated trajectory is computed.use_smoothed (
bool, optional) – If True and smoothed solution is available, uses smoothed deviations. Otherwise uses filtered deviations. Defaults to True.
- Returns:
estimated_pos, estimated_vel, estimated_params – A tuple with the following values corresponding to their respective indices:
[0]= estimated_posnumpy.ndarrayThe estimated position at each epoch.
[1]= estimated_velnumpy.ndarrayThe estimated velocity at each epoch.
[2]= estimated_paramsnumpy.ndarray or list or NoneThe estimated parameters if available, otherwise
None.
- Return type:
tuple[numpy.ndarray,numpy.ndarray,numpy.ndarray]
- map_state_deviation_to_epoch(map_back_sequence: bool = False, use_smoothed: bool = True)#
Maps the state deviation to the initial epoch using the state transition matrix.
If smoothed solution is available, simply returns the first smoothed deviation (which is already at the initial epoch). Otherwise, maps the filtered deviation backward through the STMs.
- Parameters:
map_back_sequence (
bool, optional) – If True, maps deviations back through the entire sequence; otherwise, maps only the last leg. Only used when smoothed solution is not available. Defaults to True.use_smoothed (
bool, optional) – If True and smoothed solution is available, uses the first smoothed deviation. Otherwise maps filtered deviations backward. Defaults to True.
- Returns:
mapped – The mapped state deviation(s) at the initial epoch. For sequences, returns a list with one deviation per leg if not mapping back. Otherwise returns a single deviation vector.
- Return type:
numpy.ndarrayorlistofnumpy.ndarray
- print_stats(verbose: bool = True) None#
Print statistical summary of the OD solution.
- Parameters:
verbose (
bool, optional) – Print detailed statistics. Defaults to True.
- propagate_covariance(epochs: EpochArray) List[ndarray]#
Propagate a reference covariance to arbitrary epochs using trajectory STMs.
- Non-sequence:
Uses trajectory.get_STM(epoch, idx=None) which is assumed to return Phi(epoch, t0) for some fixed t0. Then Phi(t, tref) is formed by ratio.
- Sequence:
Uses trajectory.get_STM_sequence(epoch, idx_leg=i) which is assumed to return Phi_i(epoch, t_leg_start). Then Phi(t, tref) within leg i is formed by ratio.
- Propagation law (no process noise):
P(t) = Phi(t,tref) P(tref) Phi(t,tref)^T
- Parameters:
epochs (
EpochArray) – Epochs where you want P(t).- Returns:
Covariances at requested epochs (same order as input).
- Return type:
list[np.ndarray]- Raises:
ValueError – If covariance history is missing or STMs cannot be computed.
- refresh_measurements_after_outliers(Orbiter: Spacecraft, observed_value, outlier_ind: list) tuple[EpochArray, RangeIdeal | RangeRateIdeal, dict]#
Refreshes measurement data by removing outliers and updating the remaining epochs.
- Parameters:
GS1_object (
RangeIdealorRangerateIdeal) – The measurement object storing ideal range or range rate data.Orbiter (
Spacecraft) – The spacecraft for which the measurements are updated.observed_value (
Range_GS1orRangerate_GS1) – The original observed measurement data.outlier_ind (
list) – List of indices of outliers to be removed.
- Returns:
epochs_after_outlier, obs_new, epoch_values – A tuple with the following values corresponding to their respective indices:
[0]= epochs_array_after_outlierEpochArrayArray of epochs after removing outliers.
[1]= observed_newRangeIdeal or RangeRateIdealUpdated measurement object after outlier removal.
[2]= epoch_value_dictdictDictionary mapping updated epoch indices to original values.
- Return type:
tuple[EpochArray,Type[GS1_object],dict]
- serialize(filepath: str | Path, protocol: int = 5) None#
Serialize SolutionOD object to binary format using pickle.
- Parameters:
Notes
The filter object reference is NOT serialized to avoid circular dependencies and large file sizes. Only solution data is preserved.