Skip to content

MRG Ica plot - #2251

Merged
dengemann merged 36 commits into
mne-tools:masterfrom
jaeilepp:ica-plot
Jul 14, 2015
Merged

MRG Ica plot#2251
dengemann merged 36 commits into
mne-tools:masterfrom
jaeilepp:ica-plot

Conversation

@jaeilepp

Copy link
Copy Markdown
Contributor

Here's a plotter for ICA components (item at #2213). The interactive selection doesn't work yet and neither does scrolling horizontally, but I wanted to show what I've done so far, because I'm not sure if this is what you guys wanted in the first place. I'm no expert in using ICA, so comments are welcome.
screenshot from 2015-06-30 15 33 23
The plotter has basically the same interactive functions as does other browser functions. This PR also includes quite a bit of re-factoring of the existing browser functions.

@larsoner

larsoner commented Jun 30, 2015 via email

Copy link
Copy Markdown
Member

Comment thread mne/preprocessing/ica.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should avoid mutable defaults e.g. lists.

@agramfort

Copy link
Copy Markdown
Member

cool

let us know when it's ready. If not yet.

@mainakjas

Copy link
Copy Markdown
Contributor

awesome ! how should I test this? Is there an example I can run?

@jaeilepp

jaeilepp commented Jul 1, 2015

Copy link
Copy Markdown
Contributor Author

I added a line in the example that uses this function. If you're gonna run it many times, it's probably wise to save the ica solution and use that.

@jaeilepp

jaeilepp commented Jul 2, 2015

Copy link
Copy Markdown
Contributor Author

I made it so that the plotting function now returns the updated list of components marked for exclusion, as selected by the user. Would it be okay to exclude the components straight away on closing the figure (ica.exclude)? At the moment it only updates the list, but is inconsistent with other plot functions because it returns a tuple of figure and list instead of just the figure.

Comment thread mne/preprocessing/ica.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did we already discuss why not simply updating ICA.exclude?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

On 2 juil. 2015, at 16:06, Denis A. Engemann notifications@github.com wrote:

In mne/preprocessing/ica.py:

  •        Defaults to (1., 0., 0.) (red).
    
  •    show : bool
    
  •        Show figures if True. Defaults to True.
    
  •    block : bool
    
  •        Whether to halt program execution until the figure is closed.
    
  •        Useful for selecting components for exclusion on the fly
    
  •        (click on line). May not work on all systems / platforms.
    
  •        Defaults to False.
    
  •    Returns
    

  •    fig : Instance of matplotlib.figure.Figure
    
  •        The figure.
    
  •    exclude : list
    
  •        Updated list of components marked for exclusion.
    
  •    """
    
    did we already discuss why not simply updating ICA.exclude?


Reply to this email directly or view it on GitHub.

@dengemann

Copy link
Copy Markdown
Member

Would it be okay to exclude the components straight away on closing the figure (ica.exclude)?

I would opt for that.

@agramfort

Copy link
Copy Markdown
Member

+1

On 2 juil. 2015, at 16:07, Denis A. Engemann notifications@github.com wrote:

Would it be okay to exclude the components straight away on closing the figure (ica.exclude)?

I would opt for that.


Reply to this email directly or view it on GitHub.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is quite crazy. It opens 12 or 13 figures ! anything can be done about it? cc @dengemann

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to leave it like this, it has been very useful for tracking bugs in the past.

@mainakjas

Copy link
Copy Markdown
Contributor

There is no help button here. I suppose you'll add that soon?

@jaeilepp

jaeilepp commented Jul 3, 2015

Copy link
Copy Markdown
Contributor Author

The help button positioning is partly dependent on the layout remake at #2214. I'd rather wait for it to be merged before implementing it here.

@dengemann

Copy link
Copy Markdown
Member

@jaeilepp @mainakjas @agramfort I still think we should just overwrite plot_sources or so. Not sure we should add new methods.

@mainakjas

Copy link
Copy Markdown
Contributor

On Fri, Jul 3, 2015 at 10:18 AM, Denis A. Engemann <notifications@github.com

wrote:

@jaeilepp https://github.com/jaeilepp @mainakjas
https://github.com/mainakjas @agramfort https://github.com/agramfort
I still think we should just overwrite plot_sources or so. Not sure we
should add new methods.

+1 I agree. What we have is a more sophisticated version of plot_sources,
right?


Reply to this email directly or view it on GitHub
#2251 (comment)
.

@dengemann

Copy link
Copy Markdown
Member

plot_sources,
right?

yes and plot_sources was the weakest of the plotting functions at least for raw. The evoked counterpart is really useful.

@dengemann

Copy link
Copy Markdown
Member

... which reminds us of the fact that we should also recycle the epochs viz here. I would suspect that is at least as useful as the raw viz for ICA.

@agramfort

agramfort commented Jul 3, 2015 via email

Copy link
Copy Markdown
Member

@jaeilepp

jaeilepp commented Jul 6, 2015

Copy link
Copy Markdown
Contributor Author

Epoch plotter implemented. Is there any sense in marking bad epochs here? Should it be disabled? Also, is the exclude parameter needed? Ica object already has an exclude attribute, which is basically the same. Same goes for raw plotter. So basically the use case would change so that the user updates the ica.exclude before plotting to see the components marked for exclusion.

@dengemann

Copy link
Copy Markdown
Member

No sense, so yes, it should be disabled

On 06 Jul 2015, at 12:34, jaeilepp notifications@github.com wrote:

Epoch plotter implemented. Is there any sense in marking bad epochs here? Should it be disabled? Also, is the exclude parameter needed? Ica object already has an exclude attribute, which is basically the same. Same goes for raw plotter. So basically the use case would change so that the user updates the ica.exclude before plotting to see the components marked for exclusion.


Reply to this email directly or view it on GitHub.

@jaeilepp

jaeilepp commented Jul 6, 2015

Copy link
Copy Markdown
Contributor Author

I changed the plot_sources to use these new functions for epochs and raw instances. See if you're happy.

Comment thread doc/source/whats_new.rst Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad indent

@agramfort

agramfort commented Jul 6, 2015 via email

Copy link
Copy Markdown
Member

@jaeilepp

jaeilepp commented Jul 7, 2015

Copy link
Copy Markdown
Contributor Author

Usability feedback. Not for this PR but it would be great to preview the topography of source from the browser.

Did you mean like this? I implemented it here, since it was quite easy to do.
screenshot from 2015-07-07 12 23 25
The component can be shown by clicking on the y axis label. I don't think it's going to work on every data since it relies on getting the layout from the data.
The indexing is actually inconsistent (ICA 109 = IC 108). I'll change that...

@dengemann

Copy link
Copy Markdown
Member

The indexing is actually inconsistent (ICA 109 = IC 108). I'll change that...

Now it's a good moment to attack that (cc @teonlamont). I'd do it at the plotting level, not at the level of the sources as raw function.

I'm still wondering though what's better. It's actually correct: ICA component #109 has the python index 108, wheras component #0 does not exist. We do the same for the channels btw.

@jaeilepp

jaeilepp commented Jul 7, 2015

Copy link
Copy Markdown
Contributor Author

I'm still wondering though what's better. It's actually correct: ICA component #109 has the python index 108, wheras component #0 does not exist. We do the same for the channels btw.

Yeah, I intuitively thought that the indexing should start from 1, but all the existing plotting functions seem to be using 0 for ICA.

@jaeilepp

jaeilepp commented Jul 7, 2015

Copy link
Copy Markdown
Contributor Author

I guess this is ready for review, but it still needs some testing.

@jaeilepp jaeilepp changed the title WIP Ica plot Ica plot Jul 7, 2015
@teonbrooks

Copy link
Copy Markdown
Member

closes #2000 #2043.
are we able to mark bad ICs from the browser like in the raw/epochs viewer?

also, what's the verdict on the indexing, are we plotting the ICs to start at 1 e.g. ICA 001 for all the plots now? do we still exclude based on the python index? if so, should we support exclude to take IC label to be in line with info['bads']? I think @agramfort and me mentioned it as a solution at one point #2019 (comment). for me, as long as we have a consistent use of names across the board, I'm happy.

btw, the topo view is super useful

@jaeilepp

Copy link
Copy Markdown
Contributor Author

Ready for review.

@jaeilepp jaeilepp changed the title Ica plot MRG Ica plot Jul 14, 2015
@agramfort

Copy link
Copy Markdown
Member

I am happy

+1 for merge

@dengemann ?

@dengemann

Copy link
Copy Markdown
Member

@jaeilepp we still don't see the EOG channels / ECG channels in the ICA time series, do we? I'll merge but please open an issue for later. Thanks for the wonderful work!

dengemann added a commit that referenced this pull request Jul 14, 2015
@dengemann
dengemann merged commit ce320f5 into mne-tools:master Jul 14, 2015
@agramfort

agramfort commented Jul 14, 2015 via email

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants