26 lines
717 B
Python
26 lines
717 B
Python
"""Tests for trajectory post-processing primitives."""
|
|
from __future__ import annotations
|
|
|
|
import numpy as np
|
|
|
|
from ai_mouse._postprocess import gaussian_smooth
|
|
|
|
|
|
def test_gaussian_smooth_preserves_endpoints() -> None:
|
|
x = np.array([1.0, 5.0, 3.0, 8.0, 2.0, 6.0, 4.0])
|
|
result = gaussian_smooth(x, sigma=1.0)
|
|
assert result[0] == 1.0
|
|
assert result[-1] == 4.0
|
|
|
|
|
|
def test_gaussian_smooth_short_input_unchanged() -> None:
|
|
x = np.array([1.0, 2.0, 3.0])
|
|
result = gaussian_smooth(x, sigma=1.0)
|
|
assert np.array_equal(result, x)
|
|
|
|
|
|
def test_gaussian_smooth_constant_unchanged() -> None:
|
|
x = np.full(20, 7.5)
|
|
result = gaussian_smooth(x, sigma=1.0)
|
|
assert np.allclose(result, x, atol=1e-6)
|