autoreject

External Email - Use Caution

Hi,

i am trying to explore a little the "autoreject" tools. specifically i am trying to apply following example:
https://autoreject.github.io/auto_examples/plot_auto_repair.html#sphx-glr-auto-examples-plot-auto-repair-py

to a dataset recorded in salzburg.

i adapted the code to chop out 2s epochs from the fif file. the rest should be the same as in the tutorial example (which works great btw). code below.

however i am getting an error message that is over the top of my head.

(executing lines 34 to 36 of "<tmp 1>")

Running autoreject on ch_type=grad
Traceback (most recent call last):
File "<tmp 1>", line 36, in <module>
ar.fit(epochs)
File "/Users/b1019548/anaconda3/lib/python3.6/site-packages/autoreject/autoreject.py", line 878, in fit
self.consensus, self.verbose)
File "/Users/b1019548/anaconda3/lib/python3.6/site-packages/autoreject/autoreject.py", line 683, in _run_local_reject_cv
local_reject.fit(epochs)
File "/Users/b1019548/anaconda3/lib/python3.6/site-packages/autoreject/autoreject.py", line 600, in fit
epochs.copy(), picks=self.picks_, verbose=self.verbose)
File "/Users/b1019548/anaconda3/lib/python3.6/site-packages/autoreject/autoreject.py", line 367, in compute_thresholds
verbose=verbose)
File "/Users/b1019548/anaconda3/lib/python3.6/site-packages/autoreject/utils.py", line 231, in clean_by_interp
interpolate_bads(inst_clean, picks=picks, reset_bads=True, mode='fast')
File "/Users/b1019548/anaconda3/lib/python3.6/site-packages/autoreject/utils.py", line 279, in interpolate_bads
_interpolate_bads_meg_fast(inst, picks=meg_picks_interp, mode=mode)
File "/Users/b1019548/anaconda3/lib/python3.6/site-packages/autoreject/utils.py", line 392, in _interpolate_bads_meg_fast
assert ch_names_a == ch_names_b
AssertionError

this is likely due to my ignorance in the proper use of autoreject. but the error message makes it difficult for me to infer what the problem might be. i would appreciate any pointers.

best,
nathan

import numpy as np

n_interpolates = np.array([1, 4, 32])
consensus_percs = np.linspace(0, 1.0, 11)

##

import mne # noqa
from mne.utils import check_random_state # noqa

from autoreject import (AutoReject, set_matplotlib_defaults) # noqa

check_random_state(42)

data_path = '/Users/b1019548/Desktop/Data_Sternberg/'
raw_fname = data_path + 'jens_H.fif'
raw = mne.io.read_raw_fif(raw_fname, preload=True)

events = mne.make_fixed_length_events(raw, id=1, duration=2)

raw.info['bads'] =
picks = mne.pick_types(raw.info, meg='grad', eeg=False, stim=False, eog=False, include=, exclude=)

raw.info['projs'] = list()

epochs = mne.Epochs(raw, events, tmin=0, tmax=2,
baseline=(None, 0), reject=None,
verbose=False, detrend=0, preload=True)

##
ar = AutoReject(n_interpolates, consensus_percs, picks=picks,
thresh_method='random_search', random_state=42)
ar.fit(epochs)
epochs_clean = ar.transform(epochs)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180710/8163ca16/attachment-0001.html

External Email - Use Caution

Hi Nathan,

It appears you do not have the latest version of autoreject. Could you try
upgrading to the latest version from pip
and trying again? Also what do you have in epochs.info['bads'] before you
apply autoreject?

Mainak

External Email - Use Caution

Hi Mainak,

thanks for the reply.

i am indeed not experienced in python. i mindlessly copy-pasted instructions from here:
http://autoreject.github.io/&gt;

pip install -U autoreject

Requirement already up-to-date: autoreject in ./anaconda3/lib/python3.6/site-packages (0.1)

is this the most recent version?

regarding your other question:

epochs.info['bads']

best,
nathan

External Email - Use Caution

Hi Nathan,

The code and the version look good. I am wondering if there may be any
Salzburg peculiarities with the fif file. Could you share some of the data
with us? (also privately).

Best,
Denis