Skip to content

Commit 4e12888

Browse files
committed
FIX: expose sum and maxval modes in public API per reviewer feedback
1 parent 056761b commit 4e12888

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

doc/changes/dev/13754.bugfix.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Fix ``mode`` parameter in :func:`~mne.minimum_norm.get_point_spread` and :func:`~mne.minimum_norm.get_cross_talk` to correctly map public mode names (``'max'``, ``'svd'``) to internal names, and raise :class:`ValueError` for invalid mode values, by :newcontrib:`Famous077`.
1+
Fix ``mode`` parameter in :func:`~mne.minimum_norm.get_point_spread` and :func:`~mne.minimum_norm.get_cross_talk` to correctly map public mode names (``'max'``, ``'svd'``) to internal names, expose previously hidden modes ``'sum'`` and ``'maxval'`` in the public API, and raise :class:`ValueError` for invalid mode values, by :newcontrib:`Famous077`.

mne/minimum_norm/resolution_matrix.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ def _get_psf_ctf(
160160
"max": "maxnorm",
161161
"svd": "pca",
162162
"mean": "mean",
163+
"sum": "sum",
164+
"maxval": "maxval",
163165
}
164166
funcs, pca_var = _summarise_psf_ctf(
165167
funcs, _mode_map[mode], n_comp, return_pca_vars, nn
@@ -199,10 +201,10 @@ def _get_psf_ctf(
199201

200202
def _check_get_psf_ctf_params(mode, n_comp, return_pca_vars):
201203
"""Check input parameters of _get_psf_ctf() for consistency."""
202-
valid_modes = (None, "mean", "max", "svd")
204+
valid_modes = (None, "mean", "max", "svd", "sum", "maxval")
203205
if mode not in valid_modes:
204206
raise ValueError(f"mode must be one of {valid_modes}, got {mode!r} instead.")
205-
if mode in [None, "mean"] and n_comp > 1:
207+
if mode in [None, "mean", "sum"] and n_comp > 1:
206208
msg = f"n_comp must be 1 for mode={mode}."
207209
raise ValueError(msg)
208210
if mode != "svd" and return_pca_vars:

mne/minimum_norm/tests/test_resolution_matrix.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ def test_resolution_matrix_free(src_type, fwd_volume_small):
6868
)
6969
assert_array_almost_equal(rm_mne_free, rm_mne_free.T)
7070
# check various summary and normalisation options
71-
for mode in [None, "mean", "max", "svd"]:
71+
for mode in [None, "mean", "max", "svd", "sum", "maxval"]:
7272
n_comps = [1, 3]
73-
if mode in [None, "sum", "mean"]:
73+
if mode in [None, "mean", "sum"]:
7474
n_comps = [1]
7575
for n_comp in n_comps:
7676
for norm in [None, "max", "norm", True]:
@@ -184,9 +184,9 @@ def test_resolution_matrix_fixed():
184184
# Some arbitrary vertex numbers
185185
idx = [1, 100, 400]
186186
# check various summary and normalisation options
187-
for mode in [None, "mean", "max", "svd"]:
187+
for mode in [None, "mean", "max", "svd", "sum", "maxval"]:
188188
n_comps = [1, 3]
189-
if mode in [None, "mean"]:
189+
if mode in [None, "mean", "sum"]:
190190
n_comps = [1]
191191
for n_comp in n_comps:
192192
for norm in [None, "max", "norm", True]:

0 commit comments

Comments
 (0)