6. SolutionOD#

class SolutionOD(filter_obj: FilterOD, output_settings: OutputSettings | None = None)#

Bases: object

Stores 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.

filter#

Reference to the filter object.

Type:

FilterOD

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_est#

Estimated covariance matrices at each epoch.

Type:

list of np.ndarray, optional

covariance_smooth#

Smoothed covariance matrices (from RTS smoother).

Type:

list of np.ndarray, optional

covariance_consider#

Consider parameter covariance matrices.

Type:

list of np.ndarray, optional

prefits#

Pre-fit measurement residuals.

Type:

list, optional

postfits#

Post-fit measurement residuals.

Type:

list, optional

postfits_smoother#

Post-fit residuals for smoothed solution.

Type:

list, optional

uq_metrics#

Uncertainty quantification metrics (mean, std, skewness, kurtosis, etc.).

Type:

dict, optional

debug#

Debug quantities (Kalman gains, innovation covariances, NIS).

Type:

dict, optional

References

Tapley, B. D., Schutz, B. E., & Born, G. H. (2004). Statistical orbit determination. Elsevier.

Attributes

filter

The filter object used for orbit determination.

is_covariance_analysis

Whether this is a covariance analysis.

n_epochs

Number of epochs in the solution.

n_states

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:
  • filepath (str or Path) – Path to pickle file.

  • filter_obj (FilterOD, optional) – Filter object to associate with solution. If None, creates placeholder.

Returns:

Deserialized solution object.

Return type:

SolutionOD

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:
  • particle_states (np.ndarray, optional) – Particle states [n_particles x n_states x n_epochs]. If None, attempts to extract from filter.

  • confidence_levels (list of float, optional) – Confidence levels for uncertainty bounds.

Returns:

UQ metrics including mean, covariance, percentiles, effective sample size.

Return type:

dict

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.

Parameters:
  • filepath (str or Path) – Path to output JSON file.

  • include_covariances (bool, optional) – Include covariance matrices. Defaults to True.

  • include_residuals (bool, optional) – Include residual data. Defaults to True.

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 (str or Path) – 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:
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.ndarray

    The estimated position at each epoch.

  • [1] = estimated_velnumpy.ndarray

    The estimated velocity at each epoch.

  • [2] = estimated_paramsnumpy.ndarray or list or None

    The 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.ndarray or list of numpy.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 (RangeIdeal or RangerateIdeal) – The measurement object storing ideal range or range rate data.

  • Orbiter (Spacecraft) – The spacecraft for which the measurements are updated.

  • observed_value (Range_GS1 or Rangerate_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_outlierEpochArray

    Array of epochs after removing outliers.

  • [1] = observed_newRangeIdeal or RangeRateIdeal

    Updated measurement object after outlier removal.

  • [2] = epoch_value_dictdict

    Dictionary 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:
  • filepath (str or Path) – Path to output pickle file.

  • protocol (int, optional) – Pickle protocol version. Defaults to highest available.

Notes

The filter object reference is NOT serialized to avoid circular dependencies and large file sizes. Only solution data is preserved.

sync_survived_indices(curr_outlier_ind: list) dict#

Syncs the indices of survived epochs after removing outliers.

Parameters:
  • prev_dict (dict) – Dictionary containing epoch indices and corresponding values before outlier removal.

  • curr_outlier_ind (list) – List of indices representing removed outliers.

Returns:

updated – Updated dictionary with outliers removed and remaining indices synced.

Return type:

dict

property filter: FilterOD#

The filter object used for orbit determination.

property is_covariance_analysis: bool#

Whether this is a covariance analysis.

property n_epochs: int#

Number of epochs in the solution.

property n_states: int#

Number of states in the state vector.