ICA code clean up

Hi

some comments on inconsistencies found on
http://martinos.org/mne/dev/auto_tutorials/plot_ica_from_raw.html also
observed when actually performing ICA on data.

In your tutorial, you use: n_max_ecg, n_max_eog = 3,1

Then you effectively find 3 components for ECG (in red in the graphs: IC
59, 33 and 32) but 2 components for EOG (IC 39 and 59)in section 2.
1. If we understand properly, IC 59 captures both ECG and EOG arfifacts, is
this correct?
2. In section 3, there are four components showing up in read on the top
left graph and these are IC 33, 34, 40, and 60. There's a problem of
numbering here? Shift of 1???

In our data:
we applied ICA to raw data :
- we used the same codes specifying n_max_ecg, n_max_eog = 3,3
- 2 components were found for ECG (IC 0 and IC 38 in red with the indexing
starting at 0)

[image: Inline image 2]

- 2 components are found for EOG (4 in red; 2 for each EOG channels
(vertical and horizontal, I am assuming the scores below are or each EOG
channel)

[image: Inline image 3]

When using the ica.plot_sources for ECG only, 3 components (ICA 001; 007;
039) show up in red even though the ecg_inds only contains 2 components
(indices 0 and 38). Thus, 2 problems here: you need fix the indices issues
(??) and why 3 components and not 2?

[image: Inline image 4]

With this, I am unsure of which ICA are actually being applied in the next
steps.

For the EOG, the exact same 3 component names are indicated on the figure
and eog_inds = [6, 38]

[image: Inline image 5]

Can you please explain what is correct and what is not above? and see in
the codes where indices get lost etc...

Thanks, best wishes,
Virginie

Hi Virginie,

glad you are finally using our ICA :wink:
Let me reply inline:

Hi

some comments on inconsistencies found on
http://martinos.org/mne/dev/auto_tutorials/plot_ica_from_raw.html also
observed when actually performing ICA on data.

In your tutorial, you use: n_max_ecg, n_max_eog = 3,1

Then you effectively find 3 components for ECG (in red in the graphs: IC
59, 33 and 32) but 2 components for EOG (IC 39 and 59)in section 2.
1. If we understand properly, IC 59 captures both ECG and EOG arfifacts,
is this correct?
2. In section 3, there are four components showing up in read on the top
left graph and these are IC 33, 34, 40, and 60. There's a problem of
numbering here? Shift of 1???

You pick n_max_XXX components effectively, but the algorithm may propose
more above threshold components. You pick the k first biggest, sorted by
score.
Then the index shift is a peculiarity, as long as you are looking at
component plots you see indices.
Once you look at ICA components in a Raw or Epochs object (ica.get_sources
or certain plot methods) the numbers refer to channel names and hence
regular numbers. I know it can be confusing, we will eventually find a
solution.

In our data:
we applied ICA to raw data :
- we used the same codes specifying n_max_ecg, n_max_eog = 3,3
- 2 components were found for ECG (IC 0 and IC 38 in red with the indexing
starting at 0)

[image: Inline image 2]

The SNR of the detection metric looks very good.

- 2 components are found for EOG (4 in red; 2 for each EOG channels
(vertical and horizontal, I am assuming the scores below are or each EOG
channel)

yes, two channels, you also see that the one component does not score high
on the other channel.
we could improve the labeling here.

[image: Inline image 3]

When using the ica.plot_sources for ECG only, 3 components (ICA 001; 007;
039) show up in red even though the ecg_inds only contains 2 components
(indices 0 and 38). Thus, 2 problems here: you need fix the indices issues
(??) and why 3 components and not 2?

there is no indexing issue. I fear while trying to make this consistent we
stopped somewhere in the middle.

the overlay plots are not selective, they just display all components that
are marked bad.
Currently we do not have an API or data structure that gives you post hoc
reasons for which a component was selected. Could be improved if enough
people say this is important to them.
Apparently the late ECG wave looks like an EOG for this ICA solution, so
you have 3 components, ok?

[image: Inline image 4]

With this, I am unsure of which ICA are actually being applied in the next
steps.

For the EOG, the exact same 3 component names are indicated on the figure
and eog_inds = [6, 38]

see above

[image: Inline image 5]

Can you please explain what is correct and what is not above? and see in
the codes where indices get lost etc...

Let me know if it is clearer now.

Best,
Denis

Thanks, best wishes,
Virginie

--
Virginie van Wassenhove
Virginie.van.Wassenhove at gmail.com
work: +33(0)1.69.08.1667
skype: virginie_vw
https://sites.google.com/site/virginievanwassenhove/

_______________________________________________
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/20151013/6ea42b2c/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reconstructed_ECGsources.png
Type: image/png
Size: 66108 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151013/6ea42b2c/attachment-0004.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reconstructed_E0Gsources.png
Type: image/png
Size: 77794 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151013/6ea42b2c/attachment-0005.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_scores_ECG.png
Type: image/png
Size: 24348 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151013/6ea42b2c/attachment-0006.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_scores_EOG.png
Type: image/png
Size: 33156 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151013/6ea42b2c/attachment-0007.png

Hi Denis, all,

You pick n_max_XXX components effectively, but the algorithm may propose

more above threshold components. You pick the k first biggest, sorted by
score.

Great! It would be useful to specify that the color codes for the proposed
k first components irrespective of the predefined choice of max components.

Then the index shift is a peculiarity, as long as you are looking at
component plots you see indices.
Once you look at ICA components in a Raw or Epochs object (ica.get_sources
or certain plot methods) the numbers refer to channel names and hence
regular numbers. I know it can be confusing, we will eventually find a
solution.

OK, I am glad this is only surface stuff and not a computational issue.

[image: Inline image 2]

The SNR of the detection metric looks very good.

agree

there is no indexing issue. I fear while trying to make this consistent we
stopped somewhere in the middle.

ok, that's reassuring

the overlay plots are not selective, they just display all components that

are marked bad.

ok

Currently we do not have an API or data structure that gives you post hoc
reasons for which a component was selected. Could be improved if enough
people say this is important to them.

Explicit selection criteria can't hurt and would be useful if stated
somewhere.

Apparently the late ECG wave looks like an EOG for this ICA solution, so
you have 3 components, ok?

yes

Let me know if it is clearer now.

Yep, it is clearer and hope it can be useful for others as well

Thanks very muchly!
-V