Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/changes/latest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Bugs

- Fix bug when printing a :class:`mne.io.RawArray` in the notebook (:gh:`9404` by `Alex Gramfort`_)

- Fix bug when computing rank from info for SSS data with only gradiometers or magnetometers (:gh:`9435` by `Alex Gramfort`_)

API changes
~~~~~~~~~~~
- Nothing yet
2 changes: 1 addition & 1 deletion mne/rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def _get_rank_sss(inst, msg='You should use data-based rank estimate instead',


def _info_rank(info, ch_type, picks, rank):
if ch_type == 'meg' and rank != 'full':
if ch_type in ['meg', 'mag', 'grad'] and rank != 'full':
try:
return _get_rank_sss(info)
except ValueError:
Expand Down
6 changes: 5 additions & 1 deletion mne/tests/test_rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ def test_maxfilter_get_rank(n_proj, fname, rank_orig, meg, tol_kind, tol):
assert raw.info['projs'] == []
mf = raw.info['proc_history'][0]['max_info']
assert mf['sss_info']['nfree'] == rank_orig
assert _get_rank_sss(raw) == rank_orig

assert compute_rank(raw, 'info')['meg'] == rank_orig
assert compute_rank(raw.copy().pick('grad'), 'info')['grad'] == rank_orig
assert compute_rank(raw.copy().pick('mag'), 'info')['mag'] == rank_orig

mult = 1 + (meg == 'separate')
rank = rank_orig - mult * n_proj
if n_proj > 0:
Expand Down