[Mne_analysis] ICA failing to exclude bad channels

Denis-Alexander Engemann denis.engemann at gmail.com
Tue Jun 6 11:48:10 EDT 2017
Search archives:

Hi,

Did you try:

```Python
raw, ref_data = set_eeg_reference(raw, ref_channels=[],copy=False)
```

As far as I remember ref_channels=None just does nothing. Passing an empty
list should trigger average referencing.

Best,
Denis

On Tue, Jun 6, 2017 at 5:45 PM Lyam Bailey <Lyam.Bailey at dal.ca> wrote:

> Dear MNE users,
>
>
> Just a reminder - we were using the following lines of code to exclude bad
> channels:
>
>
> raw.info['bads'] = ['CP1',etc...]
> raw, ref_data = set_eeg_reference(raw, ref_channels=None,copy=False)
>
>
> It turns out that set_eeg_reference was not applying an average reference,
> which caused our problem. This is fixed by adding raw.apply_proj()
> immediately after the set_eeg_reference line.
>
>
> Kind regards
>
> Lyam
>
>
> ---------------------------------------------------------
>
> Lyam Bailey, BSc.
>
> Graduate Student
> Department of Psychology & Neuroscience
> Dalhousie University
>
> ------------------------------
> *From:* mne_analysis-bounces at nmr.mgh.harvard.edu <
> mne_analysis-bounces at nmr.mgh.harvard.edu> on behalf of Aaron Newman <
> Aaron.Newman at dal.ca>
> *Sent:* Tuesday, May 30, 2017 6:13:36 PM
> *To:* Discussion and support forum for the users of MNE Software
> *Subject:* Re: [Mne_analysis] ICA failing to exclude bad channels
>
>
> This sender failed our fraud detection checks and may not be who they appear to be. Learn about
> spoofing <http://aka.ms/LearnAboutSpoofing> Feedback
> <http://aka.ms/SafetyTipsFeedback>
> Hi all
>
> Just to provide a bit more background on behalf of Lyam - we definitely
> have the noisy channels explicitly listed in raw.info['bads'] and told
> ICA to ignore these. However, the single IC we get weights entirely on the
> period of the experiment when the bad channels were going crazy (which was
> one period in the middle of the experiment).
>
> Some additional background that might be helpful: We're using an ANT 72
> channel amp (same as the BrainProducts QuickAmp), which records the data
> relative to the average reference. An unfortunate consequence of that is
> that if any channels are particularly noisy (as they were here, due to bad
> electrodes), the noise gets introduced into all the other channels. So, as
> Lyam said, immediately after import we mark the bad channels as "bads" and
> then re-reference to the average of the remaining channels. Visually, this
> is quite effective at removing the artifacts - during the period where the
> artifacts were present, we can now see the EEG clearly and subjectively, it
> doesn't look any noisier or otherwise different from other periods of the
> experiment. I suppose it's possible that ICA is sensitive to residual crap
> in that section of the EEG that isn't obvious to the naked eye; however
> based on visual inspection I find it very difficult to believe that 99% of
> the variance in the entire dataset is attributable to such hypothetical,
> non-obvious residual noise.
>
> Anyway, Lyam will share the data and code with you, Alex, and hopefully
> you can help us out! This is not an isolated case - quite a few data sets
> were acquired in three different experiments before we replaced the bad
> electrodes, so we are highly motivated to find a solution!
>
> Thanks in advance,
> Aaron
>
> On Tue, 30 May 2017 at 06:36 Phillip Alday <Phillip.Alday at unisa.edu.au>
> wrote:
>
>> I suspect the problem may be in the definition of 'bads' -- Lyam are
>> you explicitly marking channels 'bad' or you expecting automatic
>> detection of bad channels (as e.g. some EEGLAB functions do)?
>>
>> Phillip
>>
>> On Tue, 2017-05-30 at 11:33 +0200, Alexandre Gramfort wrote:
>> > Dear Lyam,
>> >
>> > ICA does ignore the bad channels see for example:
>> >
>> > https://github.com/mne-tools/mne-python/blob/master/mne/preprocessing
>> > /ica.py#L408
>> >
>> > can you share a full gist of code to replicate the problem?
>> >
>> > Alex
>> >
>> >
>> > On Mon, May 29, 2017 at 8:37 PM, Lyam Bailey <Lyam.Bailey at dal.ca>
>> > wrote:
>> > >
>> > > Dear MNE users,
>> > >
>> > >
>> > > I'm trying to analyse some EEG data which contains a few very noisy
>> > > channels
>> > > (amplitude is often to the order of 1V). This seems to be causing
>> > > problems
>> > > with ICA, even after bad channels are excluded
>> > >
>> > >
>> > > I begin EEG preprocessing by excluding the bad channels, and then
>> > > re-referencing the data to the average of all remaining channels
>> > > with:
>> > >
>> > >
>> > > raw.info['bads'] = ['CP1',etc...]
>> > > raw, ref_data = set_eeg_reference(raw, ref_channels=None,
>> > > copy=False)
>> > >
>> > > After filtering and trial-by-trial artifact rejection, I run ICA
>> > > with:
>> > >
>> > > ica = mne.preprocessing.ICA(n_components=.99, method='fastica',
>> > >                             max_iter=500,
>> > > random_state=ica_random_state)
>> > > picks = mne.pick_types(epochs.info, meg=False,
>> > >                        eeg=True, eog=False, stim=False,
>> > > exclude='bads')
>> > > ica.fit(epochs)
>> > >
>> > > This usually outputs a single IC component, and does nothing to
>> > > address
>> > > blinks/saccades etc that are clearly present in the raw data. My
>> > > feeling is
>> > > that ICA is somehow failing to exclude the bad channels, meaning
>> > > that (in
>> > > the presence of much higher variance, introduced by the noisy
>> > > channels) it
>> > > is relatively blind to 'normal' artifacts in the EEG.
>> > >
>> > > Does anyone know why this might be happening? Any advice on the
>> > > problem
>> > > would be greatly appreciated!
>> > >
>> > > Regards
>> > > Lyam
>> > >
>> > > ---------------------------------------------------------
>> > >
>> > > Lyam Bailey, BSc.
>> > >
>> > > Graduate Student
>> > > Department of Psychology & Neuroscience
>> > > Dalhousie University
>> > >
>> > >
>> > > _______________________________________________
>> > > 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
>
> --
>
> Aaron J Newman, PhD
>
> Professor
>
> Director, RADIANT CREATE Neurotechnology Innovation Training Program
>
> Director, NeuroCognitive Imaging Lab (NCIL)
>
> FACULTY OF SCIENCE
>
> Department of Psychology & Neuroscience
>
> FACULTY OF MEDICINE
>
> Departments of Pediatrics, Psychiatry, and Surgery
>
> Aaron.Newman at dal.ca
>
> +1.902.488.1973 <+1%20902-488-1973> | fax: +1.902.494.6585
> <+1%20902-494-6585>
>
> Box 15000, Life Sciences Centre, Halifax NS B3H 4R2 Canada
>
> DALHOUSIE UNIVERSITY
>
> NCIL.science <http://ncil.science/>
> dal.ca/RADIANT <http://www.dal.ca/RADIANT>
> _______________________________________________
> 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/20170606/dc80e1ce/attachment-0001.html 


More information about the Mne_analysis mailing list