Skip to content

test: pin that relative visual measurements must not add absolute position information (T2-2) - #132

Merged
Telschow merged 1 commit into
mainfrom
test/t2-2-observability
Oct 19, 2026
Merged

Telschow merged 1 commit into
mainfrom
test/t2-2-observability

Conversation

@Telschow

Copy link
Copy Markdown
Owner

Closes #110

Tests only. git diff --stat shows no file under src/. Synthetic data, the benchmark's vision_only, vision_only_clone and gnss_only cases.

What the tests assert (tests/test_observability.py)

The cases go through navkit.benchmark.run_case, the code path the benchmark uses. The test file keeps the estimator result (a wrapper around ErrorStateKalmanFilter.run, in the test file) to read result.position_cov, which has shape (epochs, 3, 3). The prior is read from the run's recorded filter config (initial_pos_sigma_m), and every ratio comes from the covariance the run returned. No number was copied from the prompt.

  1. test_the_clone_never_becomes_more_certain_about_absolute_position_than_its_prior. For vision_only_clone, at every epoch the smallest eigenvalue of the position covariance and the trace stay at or above the prior (relative tolerance 1e-6). Growth is allowed and shrinkage below the prior is not; the docstring says so. The test also asserts that vision updates were fused and no GNSS fix was used, so it cannot pass for the wrong reason.
  2. test_the_anchor_model_still_becomes_more_certain_about_absolute_position_and_that_is_pinned. The control row. For vision_only the smallest position standard deviation falls to a fraction of the prior, pinned in a band, in the style of test_gnss_denial_still_over_trusts_vision_and_that_is_pinned: a documented defect that must stay visible. If the row stops violating the property, it fails loudly with "the control row no longer violates the property".
  3. test_an_absolute_sensor_shrinks_the_position_covariance_below_the_prior. For gnss_only (anchor model, no vision) the covariance does shrink below the prior. This shows the check separates information from an absolute sensor from information from relative poses.

Measured quantities, margins and reasons

Run on current main, prior sigma 1.0 m (read from the config), 6001 epochs per case.

Case Smallest eigenvalue over the prior variance (minimum over epochs) Smallest position std over the prior std Trace ratio (minimum)
vision_only_clone 1.0 exactly (at epoch 0); every later epoch is above it, the first step already by 6.25e-6 1.0 1.0; 2.519 at the end
vision_only (anchor) 0.01298 0.114 0.0183
gnss_only 0.0279 0.167 0.0399
  • Clone tolerance, 1e-6 relative. Measured: the clone's deviation below the prior is exactly 0.0, and the largest covariance asymmetry is 7.5e-16 absolute, so floating-point noise is far below 1e-12 relative. 1e-6 sits about six orders above that and is far below the smallest real violation (the anchor's smallest variance is about 1.3% of the prior). I did not relax it. The smallest eigenvalue does shrink slightly at 599 of the 6000 steps (each visual update), but growth between updates keeps it at or above the prior at every epoch; that is the property.
  • Anchor band, 0.05 < ratio < 0.25 of the prior std. Measured 0.114, which is the "about a tenth" the issue expected. The upper bound (a quarter of the prior) is more than twice the measured value: it fails if the defect is fixed or the control row stops violating. The lower bound is a little under half of it and fails if the defect gets much worse.
  • GNSS case. Smallest std ratio 0.167; the test requires below 0.5, and requires the prior-violation check to say so.

Mutation checks (not committed)

(a) The clone test with the anchor config (vision_only_clone with vision_model: anchor):

E       AssertionError: a direction of position became more certain
E       assert np.float64(0.012984755216011399) >= (1.0 - 1e-06)
FAILED tests/test_observability.py::test_the_clone_never_becomes_more_certain_about_absolute_position_than_its_prior
1 failed, 2 passed

(b) The anchor test with the clone config (vision_only with vision_model: clone):

E       AssertionError: the control row no longer violates the property
E       assert False
FAILED tests/test_observability.py::test_the_anchor_model_still_becomes_more_certain_about_absolute_position_and_that_is_pinned
1 failed, 2 passed

Both files restored; the three tests pass on the unmutated code.

Skipped

  • Yaw (attitude) variance: EstimatorResult exposes position_cov only, and the trajectory metadata holds no attitude block. Exposing it needs a change in src/, which this package does not make. The module docstring says so.

Other

  • One paragraph in docs/results.md points at the new test, with no typed numbers. tests/test_quoted_numbers.py and the other page tests pass.
  • The test count is regenerated (1589 collected).

Checks

ruff check, ruff format --check, mypy src, check_doc_tables.py, metrics.py --check, check_links.py pass. The new file runs in about 3 s. Full suite: 1558 passed, 29 skipped, 2 xfailed in 637.54s (0:10:37) (the skips are the dataset-dependent tests; the dataset is absent in this clone). The coverage ratchet is left to CI.

🤖 Generated with Claude Code

…ition information (T2-2)

Run vision_only_clone, vision_only and gnss_only through the benchmark's run_case
and read the per-epoch position covariance. The clone never claims a smaller
position variance than the initial prior, in any direction or in total. The
single-anchor control does, by a wide margin, and is pinned as the defect with a
band. A GNSS-aided run shrinks below the prior, which is correct, so the check
tells absolute information from relative information. One paragraph in
docs/results.md points at the test. Tests only, nothing under src/.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Telschow
Telschow merged commit 4cd4765 into main Oct 19, 2026
20 checks passed
@Telschow
Telschow deleted the test/t2-2-observability branch October 19, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test that relative visual updates add no absolute position information

1 participant