Skip to content
Snippets Groups Projects
Commit 131e78e1 authored by valentin.emiya's avatar valentin.emiya
Browse files

fix bug in resample test (not well understood)

parent 1c21cb56
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -265,10 +265,12 @@ class TestWaveform:
# Floating values with ratios that are exact rationals
for (old_fs, new_fs) in [(1, 1.5), (0.5, 3), (100.1, 200.2)]:
print('Testing resampling {}/{}, signal length = {}'
.format(new_fs, old_fs, w.shape[0]))
w = Waveform(self.x_mono, fs=old_fs)
w.resample(fs=new_fs)
assert w.fs == new_fs
assert w.length == int(np.floor(new_fs * self.length / old_fs))
assert w.length == int(new_fs * self.length / old_fs)
# Floating values with ratios that are not well approximated
# by rationals
......@@ -279,7 +281,7 @@ class TestWaveform:
w.resample(fs=new_fs)
np.testing.assert_almost_equal(w.fs, new_fs)
np.testing.assert_almost_equal(
w.length, int(np.floor(new_fs * self.length / old_fs)))
w.length, int(new_fs * self.length / old_fs))
# Negative frequency sampling
with pytest.raises(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment