[Mne_analysis] autoreject
Nathan Weisz
nathanweisz at me.com
Tue Jul 10 10:07:19 EDT 2018
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 <http://autoreject.github.io/>
>>> 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
> Am 10.07.2018 um 15:45 schrieb Mainak Jas <mainakjas at gmail.com>:
>
> 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 <http://epochs.info/>['bads'] before you apply autoreject?
>
> Mainak
>
> On Tue, Jul 10, 2018 at 5:47 AM, Nathan Weisz <nathanweisz at me.com <mailto:nathanweisz at me.com>> wrote:
> 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 <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 <http://raw.info/>['bads'] = []
>> picks = mne.pick_types(raw.info <http://raw.info/>, meg='grad', eeg=False, stim=False, eog=False, include=[], exclude=[])
>>
>> raw.info <http://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)
>
>
>
>
>
>
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu <mailto:Mne_analysis at nmr.mgh.harvard.edu>
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis <https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis>
>
>
> The information in this e-mail is intended only for the person to whom it is
> addressed. If you believe this e-mail was sent to you in error and the e-mail
> contains patient information, please contact the Partners Compliance HelpLine at
> http://www.partners.org/complianceline <http://www.partners.org/complianceline> . If the e-mail was sent to you in error
> but does not contain patient information, please contact the sender and properly
> dispose of the e-mail.
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> The information in this e-mail is intended only for the person to whom it is
> addressed. If you believe this e-mail was sent to you in error and the e-mail
> contains patient information, please contact the Partners Compliance HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in error
> but does not contain patient information, please contact the sender and properly
> dispose of the e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180710/6f55e808/attachment-0001.html
More information about the Mne_analysis
mailing list