Skip to content

Commit 4b0bf06

Browse files
committed
pre-commit run
1 parent e38d59c commit 4b0bf06

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

CPAC/nuisance/tests/test_bandpass.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@
2020
from importlib.resources import files
2121
from pathlib import Path
2222

23+
import numpy as np
2324
from numpy.typing import NDArray
2425
import pytest
25-
import numpy as np
26-
import scipy.fft import fft
26+
from scipy.fft import fft
2727

28-
from CPAC.nuisance.bandpass import read_1D
29-
from CPAC.nuisance.bandpass import ideal_bandpass
28+
from CPAC.nuisance.bandpass import ideal_bandpass, read_1D
3029

3130
RAW_ONE_D: Traversable = files("CPAC").joinpath("nuisance/tests/regressors.1D")
3231

@@ -51,12 +50,16 @@ def test_read_1D(start_line: int, tmp_path: Path) -> None:
5150
assert len(header) == 5 - start_line
5251

5352

54-
@pytest.mark.parametrize("lowcut, highcut, in_freq, out_freq", [
55-
(0.005, 0.05, 0.01, 0.2),
56-
(0.01, 0.1, 0.02, 0.15),
57-
(0.02, 0.08, 0.04, 0.12),
58-
])
53+
@pytest.mark.parametrize(
54+
"lowcut, highcut, in_freq, out_freq",
55+
[
56+
(0.005, 0.05, 0.01, 0.2),
57+
(0.01, 0.1, 0.02, 0.15),
58+
(0.02, 0.08, 0.04, 0.12),
59+
],
60+
)
5961
def test_ideal_bandpass_with_various_cutoffs(lowcut, highcut, in_freq, out_freq):
62+
"""Test the ideal bandpass filter with various cutoff frequencies."""
6063
sample_period = 1.0
6164
t = np.arange(512) * sample_period
6265
signal = np.sin(2 * np.pi * in_freq * t) + np.sin(2 * np.pi * out_freq * t)
@@ -71,4 +74,4 @@ def test_ideal_bandpass_with_various_cutoffs(lowcut, highcut, in_freq, out_freq)
7174
idx_out = np.argmin(np.abs(freqs - out_freq))
7275

7376
assert filt_fft[idx_in] > 0.5 * orig_fft[idx_in]
74-
assert filt_fft[idx_out] < 0.1 * orig_fft[idx_out]
77+
assert filt_fft[idx_out] < 0.1 * orig_fft[idx_out]

0 commit comments

Comments
 (0)