function

states.kalman.project.project_to_measurement

def project_to_measurement(mean: torch.Tensor, cov: torch.Tensor, d_meas: int) -> tuple[torch.Tensor, torch.Tensor]

Truncate a Kalman state and covariance to the measurement subspace.

Mirrors :class:`unitrack.gates.MotionGate`: when the state has higher dimension than the measurement (e.g. a 6-D CV state vs a 3-D centroid detection), the measurement matrix is taken as ``H = [I, 0]`` and the leading ``d_meas`` rows and columns are returned. When the dimensions already match the inputs are returned unchanged.

Parameters

NameTypeDescription
meantorch.Tensor``(..., D)`` state mean.
covtorch.Tensor``(..., D, D)`` state covariance.
d_measintMeasurement subspace dimension. Must be ``<= D``.

Returns

torch.Tensor — ``(..., d_meas)`` truncated mean.

Raises

  • ValueError — If ``d_meas`` is greater than the state dimension.

Source: unitrack/states/kalman/project.py:10