From d8b963f623ccbdf206a6a1ad09133fb539ea0b72 Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Mon, 24 Feb 2025 09:47:38 +0100 Subject: [PATCH] Fix ruff errors --- mne/cov.py | 1 + mne/dipole.py | 1 + mne/fixes.py | 7 ++++--- mne/report/report.py | 2 +- mne/utils/__init__.py | 2 ++ mne/viz/topo.py | 1 + 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mne/cov.py b/mne/cov.py index 802dd52548a..a27dbeea5ab 100644 --- a/mne/cov.py +++ b/mne/cov.py @@ -53,6 +53,7 @@ ) from .rank import _compute_rank from .utils import ( + _array_repr, _check_fname, _check_on_missing, _check_option, diff --git a/mne/dipole.py b/mne/dipole.py index 6f92fc59a26..906daba9c06 100644 --- a/mne/dipole.py +++ b/mne/dipole.py @@ -46,6 +46,7 @@ copy_function_doc_to_method_doc, fill_doc, logger, + pinvh, verbose, warn, ) diff --git a/mne/fixes.py b/mne/fixes.py index 1a3d7c41ff7..1b7f57228c8 100644 --- a/mne/fixes.py +++ b/mne/fixes.py @@ -1,4 +1,4 @@ -"""Compatibility fixes for older versions of libraries +"""Compatibility fixes for older versions of libraries. If you add content to this file, please give the version of the package at which the fix is no longer needed. @@ -70,7 +70,7 @@ def _median_complex(data, axis): def _safe_svd(A, **kwargs): - """Wrapper to get around the SVD did not converge error of death""" + """Workaround the SVD did not converge error of death.""" # Intel has a bug with their GESVD driver: # https://software.intel.com/en-us/forums/intel-distribution-for-python/topic/628049 # noqa: E501 # For SciPy 0.18 and up, we can work around it by using @@ -112,7 +112,7 @@ def rng_uniform(rng): def _validate_sos(sos): - """Helper to validate a SOS input.""" + """Help validate an SOS input.""" sos = np.atleast_2d(sos) if sos.ndim != 2: raise ValueError("sos array must be 2D") @@ -527,6 +527,7 @@ def _assess_dimension_(spectrum, rank, n_samples, n_features): def svd_flip(u, v, u_based_decision=True): + """Sign correction to ensure deterministic output from SVD.""" if u_based_decision: # columns of u, rows of v max_abs_cols = np.argmax(np.abs(u), axis=0) diff --git a/mne/report/report.py b/mne/report/report.py index 52ad97b9f3e..0fa7aa9e87c 100644 --- a/mne/report/report.py +++ b/mne/report/report.py @@ -80,7 +80,7 @@ from ..viz._brain.view import views_dicts from ..viz._scraper import _mne_qt_browser_screenshot from ..viz.misc import _get_bem_plotting_surfaces, _plot_mri_contours -from ..viz.utils import _ndarray_to_fig +from ..viz.utils import _get_plot_ch_type, _ndarray_to_fig _BEM_VIEWS = ("axial", "sagittal", "coronal") diff --git a/mne/utils/__init__.py b/mne/utils/__init__.py index 3674058a139..63ea264a98f 100644 --- a/mne/utils/__init__.py +++ b/mne/utils/__init__.py @@ -183,6 +183,7 @@ _arange_div, _hashable_ndarray, _custom_lru_cache, + _array_repr, ) from .mixin import ( SizeMixin, @@ -201,6 +202,7 @@ eigh, _get_blas_funcs, pinv, + pinvh, ) from .dataframe import ( _set_pandas_dtype, diff --git a/mne/viz/topo.py b/mne/viz/topo.py index 5e351bf8d97..1bbaeeb5e96 100644 --- a/mne/viz/topo.py +++ b/mne/viz/topo.py @@ -10,6 +10,7 @@ import numpy as np from .._fiff.pick import _picks_to_idx, channel_type, pick_types +from ..channels import find_layout from ..defaults import _handle_default from ..utils import Bunch, _check_option, _clean_names, _is_numeric, _to_rgb, fill_doc from .ui_events import ChannelsSelect, publish, subscribe