Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/pyrecest/evaluation/summarize_filter_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def summarize_filter_results(
"Provided both last_filter_states and last_estimates. Using last_estimates."
)
filter_results = last_estimates
elif last_estimates is not None:
filter_results = last_estimates
elif last_filter_states is not None:
filter_results = last_filter_states
else:
Expand Down
27 changes: 27 additions & 0 deletions tests/test_evaluation_summarize_filter_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,33 @@ def test_rejects_jax_backend_explicitly(self):
last_estimates=np.empty((0, 0), dtype=object),
)

@unittest.skipIf(
pyrecest.backend.__backend_name__ in ("pytorch", "jax"),
reason="Not supported on this backend",
)
def test_accepts_last_estimates_without_last_filter_states(self):
groundtruths = np.empty((1, 1), dtype=object)
groundtruths[0, 0] = np.array([1.0, 2.0])
last_estimates = np.array([[[1.0, 4.0]]])
filter_configs = [{"name": "estimate-only"}]

with warnings.catch_warnings():
warnings.simplefilter("ignore")
summarized = summarize_filter_results(
scenario_config={"manifold": "Euclidean", "mtt": False},
filter_configs=filter_configs,
runtimes=np.array([[0.25]]),
groundtruths=groundtruths,
run_failed=np.array([[False]]),
last_estimates=last_estimates,
)

self.assertIs(summarized, filter_configs)
self.assertAlmostEqual(summarized[0]["error_mean"], 2.0)
self.assertAlmostEqual(summarized[0]["error_std"], 0.0)
self.assertAlmostEqual(summarized[0]["time_mean"], 0.25)
self.assertAlmostEqual(summarized[0]["failure_rate"], 0.0)

@unittest.skipIf(
pyrecest.backend.__backend_name__ in ("pytorch", "jax"),
reason="Not supported on this backend",
Expand Down
Loading