noise improvements

This commit is contained in:
Benoît Sierro
2023-11-02 15:12:46 +01:00
parent e1aa43eaf8
commit dff35df096
3 changed files with 18 additions and 0 deletions

View File

@@ -55,6 +55,20 @@ def test_time_and_back():
assert new_noise.psd == pytest.approx(noise.psd)
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
"""
signal = np.cos(np.arange(1024) * np.pi)
n1 = sc.noise.NoiseMeasurement.from_time_series(signal, 1, None, 1)
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]
def test_sampling():
f = np.geomspace(10, 2e6, 138)
spec = 1 / (f + 1)