pytfd_compat/tests/test_windows.py

19 lines
522 B
Python

import numpy as np
from pytfd_compat.windows import coerce_window, get_window
def test_named_window_lengths():
assert get_window("hanning", 8).shape == (8,)
assert get_window("kaiser", 8, beta=8.0).shape == (8,)
def test_coerce_window_array_round_trip():
window = np.array([1.0, 2.0, 3.0])
np.testing.assert_array_equal(coerce_window(window), window)
def test_coerce_window_callable():
window = coerce_window(lambda n: np.ones(n), length=4)
np.testing.assert_array_equal(window, np.ones(4))