fix: resolve comments
@@ -204,13 +204,11 @@ def test_resampling_edge_case(tmpdir, TR, nvols):
assert regressor.shape == (nvols, 1)
-@pytest.mark.parametrize(
- "TR, newTR, nvols, newvols",
- [(2.00000, 6.0, 90, 30),])
def test_downsampling(tmpdir, TR, newTR, nvols, newvols):
tmpdir.chdir()
os.makedirs('sub-01/func')
import numpy as np
+ TR, newTR, nvols, newvols = 2.00000, 6.0, 90, 30
Fs = 1 / TR
t = np.linspace(0, int(nvols / Fs), nvols, endpoint=False)
values = np.sin(0.025 * 2 * np.pi * t) + np.cos(0.1166 * 2 * np.pi * t)
@@ -232,7 +230,12 @@ def test_downsampling(tmpdir, TR, newTR, nvols, newvols):
dense_var = coll.variables['val'].to_dense(1.0 / TR)
regressor = dense_var.resample(1.0 / newTR).values
assert regressor.shape == (newvols, 1)
+ # This checks that the filtering has happened. If it has not, then
+ # this value for this frequency bin will be an alias and have a
+ # very different amplitude
assert np.allclose(np.abs(np.fft.fft(regressor.values.ravel()))[9],
0.46298273)
+ # This checks that the signal (0.025 Hz) within the new Nyquist
+ # rate actually gets passed through.
assert np.allclose(np.abs(np.fft.fft(regressor.values.ravel()))[4],
8.88189504)
