# Filter iteration¶

Nyx supports iterations by smoothing the estimates first and then iterating on the measurements.

The algorithm is straight-forward:

- Smooth all estimates, or until the end of the smoothing arc (cf. smoothing).
- Process all of the measurements sequentially forward in time via the measurement update call of the OD Process.

## Iteration until convergence¶

This allows iterating the filter until one of the following conditions are met:

- The averaged RMS of the residuals is less than some threshold (defaults to
`1e-3`

); or - The difference between the best averaged RMS of the residuals of one iteration and that of the latest averaged RMS normalized by the best average RMS is less than some threshold (defaults to
`1e-4`

); or - The maximum number of iterations until the above convergence criteria is met (defaults to
`15`

); or - The average RMS of the residuals increases after each iterations until a maximum number of iterations (defaults to
`3`

).

Whether to use the prefit or the postfit (cf. nomenclature) is defined in configuration of the iteration function call. By default, Nyx will use the postfit residuals.

Average root mean square of postfit residual

It is defined as follows, where \(\hat{z_i}\) is the postfit \(i\)-th residual normalized by the measurement noise \(R_i\) at that epoch:

We normalize the postfits for the dot product to be unitless (otherwise it would be a mix of units if the measurements have different units).

Warning

In practice, an EKF does not need iteration, only a CKF *might* benefit from one.