[Mne_analysis] Automatic artifact rejection on continuous data

Nico Adelhöfer nico.adelhoefer at st.ovgu.de
Thu Jul 28 02:18:09 EDT 2016
Search archives:

This looks exactly like what I'd need, but I get the error

"Cannot change channel type for channel O2 in projector "Average EEG  
reference""

I tried:

raw.set_channel_types({'O1':'eog'})




Quoting Eric Larson <larson.eric.d at gmail.com>:

> Have you tried:
>
> http://mne-tools.github.io/stable/generated/mne.io.Raw.html#mne.io.Raw.set_channel_types
>
> Eric
>
>
> On Wed, Jul 27, 2016 at 2:51 PM, Nico Adelhöfer <nico.adelhoefer at st.ovgu.de>
> wrote:
>
>> Thanks again!
>>
>> Is there a way to adjust the info of my raw data? The "reject"
>> parameter expects certain channel types.
>> I created an info instance:
>>
>>      inf =
>>
>> mne.create_info(12,512,['misc','misc','eog','eog','eeg','eeg','eeg','eeg','eeg','eeg'])
>>
>> but I don't know how to change this information in my raw variable. I
>> tried to change it manually like
>>
>>      raw.info['chs'][2]['kind'] == 'eog'
>>
>> but then I get an error that this type is not found. Changing the
>> pick.py file (e.g. line 46 to: elif kind == FIFF.FIFFV_EOG_CH or
>> 'eog') before the command above did not change the kind and is also
>> not the preferable way I guess. I could not find a solution on the MNE
>> website.
>>
>>
>>
>>
>> Quoting Mainak Jas <mainakjas at gmail.com>:
>>
>> > On Wed, Jul 27, 2016 at 5:36 PM, Nico Adelhöfer <
>> nico.adelhoefer at st.ovgu.de>
>> > wrote:
>> >
>> >> Thanks! I got it working so far with Jean-Remi's method, but using
>> >> _segment_raw gives me an attribute error.
>> >>
>> >> I read that the "reject" parameter is the peak-to-peak amplitude. Are
>> >> there other rejection parameters such as maximum allowed voltage step,
>> >> or lowest allowed activity?
>> >>
>> >
>> > You also have the parameter "flat" which will remove epochs with too low
>> a
>> > peak-to-peak amplitude.
>> >
>> > Mainak
>> >
>> >
>> >> Quoting Mikołaj Magnuski <mmagnuski at swps.edu.pl>:
>> >>
>> >> > Just adding to Jean-Remi’s answer:
>> >> > you can quickly and easily chop data into segments using _segment_raw:
>> >> >
>> >> > from mne.epochs import _segment_raw
>> >> > epochs = _segment_raw(raw_eeg, segment_length=2.)
>> >> >
>> >> > This chops the data into 2-s long segments.
>> >> > ​
>> >> >
>> >> > 2016-07-25 15:30 GMT+02:00 JR KING <jeanremi.king at gmail.com>:
>> >> >
>> >> >> Hi Nico,
>> >> >>
>> >> >> To reject chunks of continuous data, the best is probably to first
>> chop
>> >> it
>> >> >> into small segments, which comes down to creating adjacent
>> events/epoch
>> >> and
>> >> >> apply your favorite rejection threshold, i.e.
>> >> >>
>> >> >> chunk_size = 1000
>> >> >> chunk_starts = np.arange(0, raw.n_times, chunk_size)
>> >> >> events = np.c_[chunk_starts, np.zeros((len(chunk_starts),
>> >> 2))].astype(int)
>> >> >> epochs = mne.Epochs(raw, events, dict(chunk=0), tmin=0,
>> tmax=chunk_size
>> >> *
>> >> >> raw.info['sfreq'], reject=dict(mag=5e-12))
>> >> >>
>> >> >> Don't forget to check out the artefact correction tutorial:
>> >> >>
>> >>
>> http://martinos.org/mne/stable/auto_tutorials/plot_artifacts_detection.htm
>> >> >>
>> >> >> the gallery examples:
>> >> >>
>> >> >>
>> >>
>> http://martinos.org/mne/stable/auto_examples/preprocessing/plot_find_eog_artifacts.html
>> >> >>
>> >> >>
>> >>
>> http://martinos.org/mne/stable/auto_examples/preprocessing/plot_find_ecg_artifacts.html
>> >> >>
>> >> >>
>> >>
>> http://martinos.org/mne/stable/auto_examples/preprocessing/plot_interpolate_bad_channels.html
>> >> >>
>> >> >> as well as Jas' autoreject repository:
>> >> >> https://github.com/jasmainak/autoreject
>> >> >>
>> >> >> Hope that helps,
>> >> >>
>> >> >> Jean-Rémi
>> >> >>
>> >> >> On 25 July 2016 at 08:44, Nico Adelhöfer <nico.adelhoefer at st.ovgu.de
>> >
>> >> >> wrote:
>> >> >>
>> >> >>> Is there a way to set parameters for automatic artifact rejection on
>> >> >>> continuous data in MNE? I'm especially interested in setting
>> >> >>> parameters such as "maximum allowed voltage step" or "maximum and
>> >> >>> minimum amplitude". Is there a command that achieves this on raw
>> data?
>> >> >>>
>> >> >>> _______________________________________________
>> >> >>> 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.
>> >> >>>
>> >> >>>
>> >> >>
>> >> >> _______________________________________________
>> >> >> 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.
>> >> >>
>> >> >>
>> >> >
>> >> > --
>> >> >
>> >> > ------------------------------
>> >>
>> >>
>> >>
>> >> _______________________________________________
>> >> Mne_analysis mailing list
>> >> Mne_analysis at nmr.mgh.harvard.edu
>> >> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>> >>
>>
>>
>>
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>





More information about the Mne_analysis mailing list