ostk.astrodynamics.solver.LeastSquaresSolver

class LeastSquaresSolver(
self: ostk.astrodynamics.solver.LeastSquaresSolver,
maximum_iteration_count: int,
rms_update_threshold: ostk.core.type.Real,
finite_difference_solver: ostk.astrodynamics.solver.FiniteDifferenceSolver = FiniteDifferenceSolver.default(),
)

Bases: pybind11_object

Class to solve non-linear least squares problems.

Constructor.

Parameters:
  • maximum_iteration_count (int) -- Maximum number of iterations.

  • rms_update_threshold (float) -- Minimum RMS threshold.

  • finite_difference_solver (FiniteDifferenceSolver) -- Finite difference solver. Defaults to FiniteDifferenceSolver.Default().

Methods

calculate_empirical_covariance

Calculate the empirical covariance matrix from an array of state residuals.

default

Create a default instance of LeastSquaresSolver.

get_finite_difference_solver

Get the finite difference solver.

get_max_iteration_count

Get the maximum iteration count.

get_rms_update_threshold

Get the RMS update threshold.

solve

Solve the non-linear least squares problem.

class Analysis(self: ostk.astrodynamics.solver.LeastSquaresSolver.Analysis, termination_criteria: ostk.core.type.String, estimated_state: ostk::astrodynamics::trajectory::State, estimated_covariance: numpy.ndarray[numpy.float64[m, n]], estimated_frisbee_covariance: numpy.ndarray[numpy.float64[m, n]], computed_observations: list[ostk::astrodynamics::trajectory::State], steps: list[ostk.astrodynamics.solver.LeastSquaresSolver.Step])

Bases: pybind11_object

Class representing the analysis of the least squares solver.

Constructor.

Parameters:
  • termination_criteria (str) -- The termination criteria.

  • estimated_state (State) -- The estimated state.

  • estimated_covariance (np.ndarray) -- The estimated covariance matrix.

  • estimated_frisbee_covariance (np.ndarray) -- The estimated Frisbee covariance matrix.

  • computed_observations (list[State]) -- The computed observations of the final iteration.

  • steps (list[LeastSquaresSolver.Step]) -- The steps.

compute_residual_states(self: ostk.astrodynamics.solver.LeastSquaresSolver.Analysis, observations: list[ostk::astrodynamics::trajectory::State]) list[ostk::astrodynamics::trajectory::State]

Compute the residual states.

Parameters:

observations (list[State]) -- The observations.

Returns:

The residuals.

Return type:

list[State]

property computed_observations

The computed observations of the final iteration.

Type:

np.ndarray

property estimated_covariance

The estimated covariance matrix.

Type:

np.ndarray

property estimated_frisbee_covariance

The estimated Frisbee covariance matrix.

Type:

np.ndarray

property estimated_state

The estimated state.

Type:

State

property iteration_count

The iteration count.

Type:

int

property observation_count

The observation count.

Type:

int

property rms_error

The RMS error.

Type:

float

property steps

The steps.

Type:

list[LeastSquaresSolver.Step]

property termination_criteria

The termination criteria.

Type:

str

class Step(
self: ostk.astrodynamics.solver.LeastSquaresSolver.Step,
rms_error: ostk.core.type.Real,
x_hat: numpy.ndarray[numpy.float64[m, 1]],
)

Bases: pybind11_object

Class representing a step in the least squares solver.

Constructor.

Parameters:
  • rms_error (float) -- The RMS error.

  • x_hat (np.ndarray) -- The X hat vector.

property rms_error

The RMS error.

Type:

float

property x_hat

The X hat vector.

Type:

np.ndarray

static calculate_empirical_covariance(residuals: list[ostk::astrodynamics::trajectory::State]) numpy.ndarray[numpy.float64[m, n]]

Calculate the empirical covariance matrix from an array of state residuals.

Parameters:

residuals (list[State]) -- A list of state residuals.

Returns:

The empirical covariance matrix.

Return type:

np.ndarray

Throws:

ostk::core::error::runtime::Undefined: If the residual array is empty.

static default() ostk.astrodynamics.solver.LeastSquaresSolver

Create a default instance of LeastSquaresSolver.

Returns:

A default instance of LeastSquaresSolver.

Return type:

LeastSquaresSolver

get_finite_difference_solver(
self: ostk.astrodynamics.solver.LeastSquaresSolver,
) ostk.astrodynamics.solver.FiniteDifferenceSolver

Get the finite difference solver.

Returns:

The finite difference solver.

Return type:

FiniteDifferenceSolver

get_max_iteration_count(
self: ostk.astrodynamics.solver.LeastSquaresSolver,
) int

Get the maximum iteration count.

Returns:

The maximum iteration count.

Return type:

int

get_rms_update_threshold(
self: ostk.astrodynamics.solver.LeastSquaresSolver,
) ostk.core.type.Real

Get the RMS update threshold.

Returns:

The RMS update threshold.

Return type:

float

solve(self: ostk.astrodynamics.solver.LeastSquaresSolver, initial_guess: ostk::astrodynamics::trajectory::State, observations: list[ostk::astrodynamics::trajectory::State], state_generator: Callable[[ostk::astrodynamics::trajectory::State, list[ostk.physics.time.Instant]], list[ostk::astrodynamics::trajectory::State]], initial_guess_sigmas: dict[ostk::astrodynamics::trajectory::state::CoordinateSubset, numpy.ndarray[numpy.float64[m, 1]]] = {}, observation_sigmas: dict[ostk::astrodynamics::trajectory::state::CoordinateSubset, numpy.ndarray[numpy.float64[m, 1]]] = {}) ostk.astrodynamics.solver.LeastSquaresSolver.Analysis

Solve the non-linear least squares problem.

Parameters:
  • initial_guess (State) -- Initial guess state (the Estimated State is of the same domain as this state).

  • observations (list[State]) -- List of observations.

  • state_generator (callable[list[State],[State, list[Instant]]]) -- Function to generate states.

  • initial_guess_sigmas (dict[CoordinateSubset, np.ndarray], optional) -- Dictionary of sigmas for initial guess.

  • observation_sigmas (dict[CoordinateSubset, np.ndarray], optional) -- Dictionary of sigmas for observations.

Returns:

The analysis of the estimate.

Return type:

LeastSquaresSolver::Analysis