You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error in _check_compensation_grade for ICA on EEG data after switching from v15 to v16 #5265
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])
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...
Activity
agramfort commentedon Jun 7, 2018
@SophieHerbst is it with current master or version 0.16.1 ?
SophieHerbst commentedon Jun 7, 2018
0.16.1, yes
python version is 2.7.14
cbrnr commentedon Jun 7, 2018
@SophieHerbst what is the
rejectobject you are passing asreject=reject[ch_type]?cbrnr commentedon Jun 7, 2018
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...
SophieHerbst commentedon Jun 7, 2018
reject=dict(meg = dict(mag=10e-12, grad=500e-12),
eeg = dict(eeg=3000e-6))
Sorry, forgot that.
agramfort commentedon Jun 7, 2018
@cbrnr can you replicate with current master?
@larsoner or @bloyl can you have a look at you worked most recently on this code?
cbrnr commentedon Jun 7, 2018
Yep, I can replicate with the current master.
Add test reissue mne-tools#5265
Add test re: issue mne-tools#5265
Fix check compensation on ica with EEG (#5270)
Fix check compensation on ica with EEG (mne-tools#5270)