feat(lib): add gaussian_smooth to _postprocess
This commit is contained in:
25
tests/unit/test_postprocess.py
Normal file
25
tests/unit/test_postprocess.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""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)
|
||||
Reference in New Issue
Block a user