From acf0d4f645d065c6fa8843816a255dc9506a7d91 Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Wed, 2 Feb 2022 18:26:50 +0100 Subject: [PATCH] update pre-commit hooks, update to stable black --- .pre-commit-config.yaml | 8 ++++---- .zenodo.json | 2 +- examples/run_full_prep.py | 2 +- pyprep/utils.py | 6 +++--- tests/test_removeTrend.py | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d2c9cdec..f970436e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.1.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -13,15 +13,15 @@ repos: - id: check-case-conflict - id: check-docstring-first - repo: https://github.com/pycqa/isort - rev: 5.8.0 + rev: "5.10.1" hooks: - id: isort - repo: https://github.com/psf/black - rev: 21.6b0 + rev: "22.1.0" hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 3.9.2 + rev: "4.0.1" hooks: - id: flake8 additional_dependencies: [flake8-docstrings] diff --git a/.zenodo.json b/.zenodo.json index 70bf2137..a01b7520 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -80,4 +80,4 @@ "resource_type": "software" } ] - } \ No newline at end of file + } diff --git a/examples/run_full_prep.py b/examples/run_full_prep.py index 747ab0c6..056aafbe 100644 --- a/examples/run_full_prep.py +++ b/examples/run_full_prep.py @@ -129,7 +129,7 @@ EEG_raw_matlab = sio.loadmat(fname_mat1) EEG_raw_matlab = EEG_raw_matlab["save_data"] EEG_raw_diff = EEG_raw - EEG_raw_matlab -EEG_raw_mse = (EEG_raw_diff / EEG_raw_max ** 2).mean(axis=None) +EEG_raw_mse = (EEG_raw_diff / EEG_raw_max**2).mean(axis=None) fig, axs = plt.subplots(5, 3, sharex="all", figsize=(16, 12)) plt.setp(fig, facecolor=[1, 1, 1]) diff --git a/pyprep/utils.py b/pyprep/utils.py index a8460a1a..0666016d 100644 --- a/pyprep/utils.py +++ b/pyprep/utils.py @@ -283,7 +283,7 @@ def _eeglab_calc_g(pos_from, pos_to, stiffness=4, num_lterms=7): # Calculate Legendre coefficients for the given degree and stiffness factors = [0] for n in range(1, num_lterms + 1): - f = (2 * n + 1) / (n ** stiffness * (n + 1) ** stiffness * 4 * np.pi) + f = (2 * n + 1) / (n**stiffness * (n + 1) ** stiffness * 4 * np.pi) factors.append(f) return legval(EI, factors) @@ -452,8 +452,8 @@ def _correlate_arrays(a, b, matlab_strict=False): """ if matlab_strict: - SSa = np.sum(a ** 2, axis=1) - SSb = np.sum(b ** 2, axis=1) + SSa = np.sum(a**2, axis=1) + SSb = np.sum(b**2, axis=1) SSab = np.sum(a * b, axis=1) return SSab / (np.sqrt(SSa) * np.sqrt(SSb)) else: diff --git a/tests/test_removeTrend.py b/tests/test_removeTrend.py index 34b4c1f3..fabeb379 100644 --- a/tests/test_removeTrend.py +++ b/tests/test_removeTrend.py @@ -27,9 +27,9 @@ def test_highpass(): error1 = lowpass_filt1 - highfreq_signal error2 = lowpass_filt2 - highfreq_signal error3 = lowpass_filt3 - highfreq_signal - assert np.sqrt(np.mean(error1 ** 2)) < 0.1 - assert np.sqrt(np.mean(error2 ** 2)) < 0.1 - assert np.sqrt(np.mean(error3 ** 2)) < 0.1 + assert np.sqrt(np.mean(error1**2)) < 0.1 + assert np.sqrt(np.mean(error2**2)) < 0.1 + assert np.sqrt(np.mean(error3**2)) < 0.1 def test_detrend(): @@ -45,4 +45,4 @@ def test_detrend(): signal_trend, detrendType="Local detrend", sample_rate=100 ) error3 = signal_detrend - signal - assert np.sqrt(np.mean(error3 ** 2)) < 0.1 + assert np.sqrt(np.mean(error3**2)) < 0.1