Skip to content

Info rank computation fails if picking only 'grad' or 'mag' #9428

Closed

Description

@agramfort

try to run this:

import os.path as op
import mne
from mne.datasets import somato

data_path = somato.data_path()
subject = '01'
task = 'somato'
raw_fname = op.join(data_path, 'sub-{}'.format(subject), 'meg',
                    'sub-{}_task-{}_meg.fif'.format(subject, task))

raw = mne.io.read_raw_fif(raw_fname)
events = mne.find_events(raw, stim_channel='STI 014')
picks = mne.pick_types(raw.info, meg=True, eeg=False, eog=True, stim=False)
event_id, tmin, tmax = 1, -1., 3.
baseline = (None, 0)
epochs = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks,
                    baseline=baseline, reject=dict(grad=4000e-13, eog=350e-6),
                    preload=True)
evoked = epochs.average()

print('Rank with all MEG')
print(mne.compute_rank(evoked, 'info'))

print('Rank with only GRAD')
print(mne.compute_rank(evoked.copy().pick('grad'), 'info'))

you will get:

Rank with all MEG
{'meg': 64}
Rank with only GRAD
{'grad': 204}

it shows you that if you pick the grad it ignores the rank computation derived from maxfilter.

@larsoner thoughts?

thx @PABannier for spotting the bug...

Activity

  1. larsoner commented on May 27, 2021

    @larsoner
    Member

    Agreed this seems like a bug

  2. agramfort commented on May 28, 2021

    @agramfort
    SponsorMemberAuthor
  3. larsoner commented on May 28, 2021

    @larsoner
    Member

    Yep, should be able to take a look next week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions