diff --git a/src/scgenerator/noise.py b/src/scgenerator/noise.py index 286665e..b18e284 100644 --- a/src/scgenerator/noise.py +++ b/src/scgenerator/noise.py @@ -45,7 +45,7 @@ class NoiseMeasurement: def from_time_series( cls, signal: Sequence[float], - dt: float, + dt: float = 1.0, window: str | None = "Hann", num_segments: int = 1, force_no_dc: bool = True, diff --git a/tests/test_noise.py b/tests/test_noise.py index d002666..3e470e2 100644 --- a/tests/test_noise.py +++ b/tests/test_noise.py @@ -58,7 +58,7 @@ def test_time_and_back(): def test_nyquist(): """ generating a time series and tranforming it back yields the same spectrum. - Using segements, the nyquist frequency at least is the same + Using segements, the nyquist frequency is exactly spread out over the frequency bin width """ signal = np.cos(np.arange(1024) * np.pi) @@ -66,7 +66,7 @@ def test_nyquist(): n3 = sc.noise.NoiseMeasurement.from_time_series(signal, 1, None, 3) n15 = sc.noise.NoiseMeasurement.from_time_series(signal, 1, None, 15) - assert n1.psd[-1] == n3.psd[-1] == n15.psd[-1] + assert n1.psd[-1] == n3.psd[-1] * 2 == n15.psd[-1] * 8 def test_sampling():