Skip to content

Error in _check_compensation_grade for ICA on EEG data after switching from v15 to v16 #5265

Closed

Description

@SophieHerbst

Dear all,
a script that ran under Version 15 now throws an error for every subject I tried. I am computing ICAs on epoched MEG and EEG data separately. The error occurs only for the EEG data.

The error:

File "/home/sh252228/anaconda2/lib/python2.7/site-packages/mne/utils.py", line 2213, in _check_compensation_grade
    name2, inst2.compensation_grade))
*** TypeError: %d format: a number is required, not NoneType

I realized that inst.compensation_grade is empty, while inst2.compensation_grade = 0

A snippet of my code:

ica_parameters = dict(n_components = .9999, method = 'fastica',  decim = 3, random_state = 23)
nip='az180202'

 # load data, hp filtered for ICA
 filename = root_directory + '/filtered/' + nip + '/' + nip + '_' + 'filtered4ICA_tsss_epo.fif'
 ICAData =  mne.read_epochs(filename, preload=True)
 
 ###################### run ICA ########################         
 picks_meg = mne.pick_types(ICAData.info, meg=True, eeg=False)
 picks_eeg = mne.pick_types(ICAData.info, meg=False, eeg=True)
     
  all_picks = dict({'meg':picks_meg,'eeg':picks_eeg})
     
  # Compute ICA, separately for EEG and MEG data 
  for ch_type in ['eeg']: # 'meg',
        print(ch_type)
        picks = all_picks[ch_type]
        
        # Apply ICA
        ica = ICA(n_components=ica_parameters['n_components'], 
                 method=ica_parameters['method'], random_state=ica_parameters['random_state'])
        print(ica)
            
        # Fit it to the data 
        ica.fit(ICAData, picks=picks, decim=ica_parameters['decim'], 
                reject=reject[ch_type])

I uploaded the data here: https://somaxluan.hd.free.fr/owncloud/index.php/s/3Ccgbp4g18Gf1Q4

Thank you!
Sophie

Activity

  1. agramfort commented on Jun 7, 2018

    @agramfort
    SponsorMember

    @SophieHerbst is it with current master or version 0.16.1 ?

  2. SophieHerbst commented on Jun 7, 2018

    @SophieHerbst
    ContributorAuthor

    0.16.1, yes
    python version is 2.7.14

  3. cbrnr commented on Jun 7, 2018

    @cbrnr
    Contributor

    @SophieHerbst what is the reject object you are passing as reject=reject[ch_type]?

  4. cbrnr commented on Jun 7, 2018

    @cbrnr
    Contributor

    But yes, I can reproduce this error. No idea what the compensation grade is, but it seems to be something MEG-specific, so it should not be checked for EEG data...

  5. SophieHerbst commented on Jun 7, 2018

    @SophieHerbst
    ContributorAuthor

    reject=dict(meg = dict(mag=10e-12, grad=500e-12),
    eeg = dict(eeg=3000e-6))

    Sorry, forgot that.

  6. agramfort commented on Jun 7, 2018

    @agramfort
    SponsorMember

    @cbrnr can you replicate with current master?

    @larsoner or @bloyl can you have a look at you worked most recently on this code?

  7. cbrnr commented on Jun 7, 2018

    @cbrnr
    Contributor

    Yep, I can replicate with the current master.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions