ICA with mne_python v0.8

Hello MNE users,

I started to use mne_python version 0.8 (great tool btw), and I have a
question related to ICA within the script plot_ica_from_raw.py

(http://martinos.org/mne/stable/auto_examples/preprocessing/plot_ica_from_ra
w.html#example-preprocessing-plot-ica-from-raw-py)

My question is related to the command ica.find_bads_eog that will return
'eog_inds' and 'scores'

In the example on the website the scores is a np.array with one dimension.

Whereas when I run it, I have a 2 dimension array

eog_inds, scores =ica.find_bads_eog(raw)

In[356]: scores

Out[356]:

[array([-0.00048168, -0.42372344, -0.0140817 , 0.02141039, 0.01795695,

       -0.06170853, -0.01864879, -0.00278151, -0.04799586, -0.02081424,

       -0.04495371, -0.00866799, 0.01401663, 0.0052837 , 0.00837509,

        0.0635164 , 0.01747246, -0.00974186, 0.19293349, 0.03663461,

       -0.03982205, -0.00588006, -0.04194552, 0.0367501 , -0.0095143 ,

        0.00641498, -0.00223432, -0.00572408, 0.01120724, -0.00707822,

        0.03354455, -0.01167412, -0.01716788, 0.0521022 , 0.01204061,

       -0.01250779, -0.02080896, -0.02087199, -0.06090518, 0.01263185,

        0.0617042 , -0.01924968, 0.07025745]),

array([ -6.90115011e-04, 2.01336477e-02, -1.94085728e-02,

         5.54494463e-03, 1.85259423e-02, -6.44562593e-02,

         9.22072187e-03, 2.48208247e-02, 6.48755505e-03,

         2.96724141e-02, -2.95860189e-02, -1.32707432e-02,

         2.55635523e-02, 8.35349233e-03, -1.40756479e-02,

        -7.64950200e-02, -1.91362435e-02, -5.59807386e-02,

        -5.37760229e-01, -1.44527756e-03, 2.62353032e-02,

         3.55718290e-03, 4.53971390e-03, -3.73325017e-02,

        -4.44052114e-02, 2.42345592e-02, 5.23123704e-02,

         6.99711147e-03, 4.66395629e-02, 1.14460067e-02,

        -1.71193294e-02, 8.64111157e-03, 2.42794389e-02,

        -1.02563756e-02, 2.66764223e-02, -1.22480541e-03,

        -6.26583675e-04, 7.31585385e-02, 3.24236294e-04,

        -3.61010677e-02, -2.74582253e-02, 1.88243641e-02,

        -5.08565452e-02])]

Now I compared with the command used in a previous version of mne_pyhton

eog_scores = ica.find_sources_raw(raw, target='EOG062',
score_func='pearson')

In [368]: eog_scores

Out[368]:

array([ 1.66649505e-02, 2.16342706e-02, 4.83022984e-03,

        -4.35487020e-04, -1.20631032e-02, -2.35856136e-02,

         1.23689301e-02, 8.71059801e-03, -1.01489847e-02,

         1.03843218e-03, -5.75965904e-03, 1.23044678e-05,

        -6.77430607e-03, -1.14913804e-02, -1.94694511e-03,

        -4.53459854e-02, -2.64928079e-03, -9.15942420e-03,

        -3.69825806e-01, 7.58370880e-03, -6.07496046e-03,

         2.34470256e-02, -1.30305829e-03, 2.84655600e-03,

        -2.25454800e-02, 8.44810084e-03, 1.41810585e-02,

         9.74897473e-04, 2.38848977e-02, -8.01684853e-03,

         1.35224050e-03, -1.48211516e-03, 9.42452704e-04,

        -6.67442395e-04, -3.01227394e-03, -7.98317803e-03,

         2.84740542e-03, -5.71626494e-03, -5.39340114e-03,

        -5.48041671e-03, -7.14136517e-03, 8.17430479e-03,

        -1.31954753e-02])

Here are my questions

1) I assume that with the new command I should specify scores[1] to use
accordingly for plotting and ranking?

Is the 2 arrays output an error in programming or are both values usefull?
If so can you explain what are the differences between both?

2) Why both commands do not return the same scores values? Is it
because the new command filtered the data & eog, which is not the case for
the oldest one?

Thanks in advance

Elisabeth

Hi Elisabeth,

Hello MNE users,

I started to use mne_python version 0.8 (great tool btw), and I have a
question related to ICA within the script plot_ica_from_raw.py

(
http://martinos.org/mne/stable/auto_examples/preprocessing/plot_ica_from_raw.html#example-preprocessing-plot-ica-from-raw-py
)

My question is related to the command ica.find_bads_eog that will return
?eog_inds? and ?scores?

In the example on the website the scores is a np.array with one dimension.

Whereas when I run it, I have a 2 dimension array

eog_inds, scores =ica.find_bads_eog(raw)

Yes, this is expected. I means you have 2 eog channels with scores for each
of them. The indices reflect a combination of the supra-threshold
components from each array of scores.

In[356]: scores

Out[356]:

[array([-0.00048168, -0.42372344, -0.0140817 , 0.02141039, 0.01795695,

       -0.06170853, -0.01864879, -0.00278151, -0.04799586, -0.02081424,

       -0.04495371, -0.00866799, 0.01401663, 0.0052837 , 0.00837509,

        0.0635164 , 0.01747246, -0.00974186, 0.19293349, 0.03663461,

       -0.03982205, -0.00588006, -0.04194552, 0.0367501 , -0.0095143 ,

        0.00641498, -0.00223432, -0.00572408, 0.01120724, -0.00707822,

        0.03354455, -0.01167412, -0.01716788, 0.0521022 , 0.01204061,

       -0.01250779, -0.02080896, -0.02087199, -0.06090518, 0.01263185,

        0.0617042 , -0.01924968, 0.07025745]),

array([ -6.90115011e-04, 2.01336477e-02, -1.94085728e-02,

         5.54494463e-03, 1.85259423e-02, -6.44562593e-02,

         9.22072187e-03, 2.48208247e-02, 6.48755505e-03,

         2.96724141e-02, -2.95860189e-02, -1.32707432e-02,

         2.55635523e-02, 8.35349233e-03, -1.40756479e-02,

        -7.64950200e-02, -1.91362435e-02, -5.59807386e-02,

        -5.37760229e-01, -1.44527756e-03, 2.62353032e-02,

         3.55718290e-03, 4.53971390e-03, -3.73325017e-02,

        -4.44052114e-02, 2.42345592e-02, 5.23123704e-02,

         6.99711147e-03, 4.66395629e-02, 1.14460067e-02,

        -1.71193294e-02, 8.64111157e-03, 2.42794389e-02,

        -1.02563756e-02, 2.66764223e-02, -1.22480541e-03,

        -6.26583675e-04, 7.31585385e-02, 3.24236294e-04,

        -3.61010677e-02, -2.74582253e-02, 1.88243641e-02,

        -5.08565452e-02])]

Now I compared with the command used in a previous version of mne_pyhton

eog_scores = ica.find_sources_raw(raw, target='EOG062',
score_func=?pearson?)

In [368]: eog_scores

Out[368]:

array([ 1.66649505e-02, 2.16342706e-02, 4.83022984e-03,

        -4.35487020e-04, -1.20631032e-02, -2.35856136e-02,

         1.23689301e-02, 8.71059801e-03, -1.01489847e-02,

         1.03843218e-03, -5.75965904e-03, 1.23044678e-05,

        -6.77430607e-03, -1.14913804e-02, -1.94694511e-03,

        -4.53459854e-02, -2.64928079e-03, -9.15942420e-03,

        -3.69825806e-01, 7.58370880e-03, -6.07496046e-03,

         2.34470256e-02, -1.30305829e-03, 2.84655600e-03,

        -2.25454800e-02, 8.44810084e-03, 1.41810585e-02,

         9.74897473e-04, 2.38848977e-02, -8.01684853e-03,

         1.35224050e-03, -1.48211516e-03, 9.42452704e-04,

        -6.67442395e-04, -3.01227394e-03, -7.98317803e-03,

         2.84740542e-03, -5.71626494e-03, -5.39340114e-03,

        -5.48041671e-03, -7.14136517e-03, 8.17430479e-03,

        -1.31954753e-02])

Here are my questions

1) I assume that with the new command I should specify scores[1] to
use accordingly for plotting and ranking?

Nope, the ranking is already done for free. Take the indices and checka
against the output of ica.plot_scores which is smart enough to deal with 2
score arrays.

Is the 2 arrays output an error in programming or are both values usefull?
If so can you explain what are the differences between both?

You need it for the plot, see this example from a study of mine:

2) Why both commands do not return the same scores values? Is it
because the new command filtered the data & eog, which is not the case for
the oldest one?

Yes, because the command has been extended and rewritten. The EOG finding
now filters both the ICA sources and the EOG channel to improve detection
using correlation.

I hope this helps, let me know if something remains unclear.

Denis

Thanks in advance

Elisabeth

__________________________________________________________

Dr Elisabeth Fonteneau

Neurolex Group

Department of Psychology

University of Cambridge

Downing Street, Cambridge CB2 3EB, UK

Phone: +44 1223 333 548

Email: ef309 at cam.ac.uk

Web: www.neurolex.psychol.cam.ac.uk/directory/ef309 at cam.ac.uk

_______________________________________________
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.

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