using correlation as method for find_bads_ecg

Dear list

I can't get the correlation method to work for find_bads_ecg method
It always returns the error: ValueError: ECG003 not in channel list

method = 'correlation'

ekgEpochs = mne.preprocessing.create_ecg_epochs(raw)

ekgIndices, ekgScores = ica.find_bads_ecg(ekgEpochs, method=method)

It is in the ekgEpochs as seen below

ekgEpochs.info['ch_names'][:4]
Out[8]: ['EOG001', 'EOG002', 'ECG003', 'MEG0111']

it makes no difference whether I include ch_name = 'ECG003' in
create_ecg_epochs or in find_bads_ecg

Any thoughts on why this could be?

I'm running MNE 0.8.5 on MacOSX 10.9.5

Best

Lau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141015/0675da48/attachment.html

hi Lau,

would 'ECG003' be marked as bad? is it defined as an ECG channel
(check with pick_types)?

Alex

Out of curiosity, why would you prefer the correlation method over the default phase-locking method? The latter is more reliable and is based on a significance test.

-Denis

Hi Alex and Denis

@Alex:
picks = mne.pick_types(ekgEpochs.info, ecg=True)
ch_names = np.array(ekgEpochs.info['ch_names'])
In [22]: ch_names[picks][:10]
Out[22]:
array(['ECG003', 'MEG0111', 'MEG0112', 'MEG0113', 'MEG0121', 'MEG0122',
       'MEG0123', 'MEG0131', 'MEG0132', 'MEG0133'],
      dtype='|S7')

In [23]: ekgEpochs.info['bads']
Out[23]:

It seems to be in there and not marked as bad.

On a related note: The documentation for find_bads_eog refers to ecg
instead of eog throughout.

@Denis: Actually, for no other reason that that is what I did in an earlier
experiment, and I wanted to follow that analysis for the current experiment
as closely as possible. But I will take your word for the ctps being more
reliable.

Best

Lau

2014-10-16 2:30 GMT-05:00 Denis A. Engemann <denis.engemann at gmail.com>:

Out of curiosity, why would you prefer the correlation method over the
default phase-locking method? The latter is more reliable and is based on a
significance test.

-Denis

>
> hi Lau,
>
> would 'ECG003' be marked as bad? is it defined as an ECG channel
> (check with pick_types)?
>
> Alex
>
>> Dear list
>>
>> I can't get the correlation method to work for find_bads_ecg method
>> It always returns the error: ValueError: ECG003 not in channel list
>>
>> method = 'correlation'
>>
>> ekgEpochs = mne.preprocessing.create_ecg_epochs(raw)
>>
>> ekgIndices, ekgScores = ica.find_bads_ecg(ekgEpochs, method=method)
>>
>>
>> It is in the ekgEpochs as seen below
>>
>> ekgEpochs.info['ch_names'][:4]
>> Out[8]: ['EOG001', 'EOG002', 'ECG003', 'MEG0111']
>>
>> it makes no difference whether I include ch_name = 'ECG003' in
>> create_ecg_epochs or in find_bads_ecg
>>
>> Any thoughts on why this could be?
>>
>> I'm running MNE 0.8.5 on MacOSX 10.9.5
>>
>> Best
>>
>> Lau
>>
>>
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> Mne_analysis Info Page
>>
>>
>> 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
>> MyComplianceReport.com: Compliance and Ethics Reporting . 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
> Mne_analysis Info Page

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141016/97192734/attachment.html

hi Lau,

can you reproduce the problem with the sample dataset?
If not please share one of your files and the script that crashes.

Best,
Alex

Hi Alex

I cannot reproduce the problem with the sample data set.By the way, is
it the case that the sample data set is version 0.7? It keeps telling me
to update, but I can't seem to get a newer version
The code below works just fine:

import mne

import os

path = mne.datasets.sample.data_path()

os.chdir(path + '/MEG/sample')

raw = mne.io.Raw('sample_audvis_filt-0-40_raw.fif')

events = mne.read_events('sample_audvis_filt-0-40_raw-eve.fif')

eventID = {'aud_l': 1, 'aud_r': 2, 'vis_l': 3, 'vis_r': 4, 'smiley': 5,

'button': 32}

epochs = mne.Epochs(raw, events, eventID, tmin=-0.2, tmax=0.5)

ekg = mne.preprocessing.create_ecg_epochs(raw)

noiseCov = mne.read_cov('sample_audvis-cov.fif')

ica = mne.preprocessing.ICA(n_components=0.95, n_pca_components=64,

max_pca_components=100, noise_cov=noiseCov)

ica.fit(epochs)

ekgIndices, ekgScores = ica.find_bads_ecg(ekg, method='correlation')

What is the easiest way for me to share a file with you? The raw files
as they are now are pretty big.

Best

Lau

hi Lau,

maybe use dropbox or google drive? don't hesitate to make a tiny file
before sharing.

Alex

hi,

bug is fixed

https://github.com/mne-tools/mne-python/pull/1612

thanks for the bug report.

Alex