Skip to content

Improve ICA component selection with the argument picks - #11369

Merged
larsoner merged 10 commits into
mne-tools:mainfrom
mscheltienne:ica_pick
Dec 15, 2022
Merged

larsoner merged 10 commits into
mne-tools:mainfrom
mscheltienne:ica_pick

Conversation

@mscheltienne

Copy link
Copy Markdown
Member

Closes #11274

This PR improves the selection of IC with the argument picks, especially making sure that the type and value provided are valid.

  • Adds an helper function _check_pick_components in utils/check.py (do you want it elsewhere?)
  • Replace picks = _picks_to_idx(ica.info, picks) (which picks on the channel names!) with _check_pick_components(ica, picks)
  • Improve the error message, c.f. Selection of ICA components when plotting properties #11274
  • Fix the docstring for picks in ica.plot_properties.

In #11274, I wasn't sure in which context a Browser figure would open a Properties figure on click: right click on the IC name in ica.plot_sources(inst)!

@mscheltienne mscheltienne changed the title Ica pick Improve ICA component selection with the argument picks Dec 14, 2022
@mscheltienne

Copy link
Copy Markdown
Member Author

If this approach works for you, I'll add tests for _check_pick_components.

Comment thread mne/utils/check.py Resolved
@mscheltienne

mscheltienne commented Dec 14, 2022 •

Copy link
Copy Markdown
Member Author

How about adding a pick_on argument to _picks_to_idx which can be either 'channels' (default) or 'components' to adapt the error messages to the ICA case?

Comment thread mne/viz/ica.py Resolved
@larsoner

Copy link
Copy Markdown
Member

How about adding a pick_on argument to _picks_to_idx

Sure!

@larsoner larsoner added this to the 1.3 milestone Dec 14, 2022
Comment thread doc/changes/latest.inc Resolved

@larsoner larsoner left a comment

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.

Marking for merge when green after a tiny latest.inc change, thanks @mscheltienne !

@larsoner
larsoner enabled auto-merge (squash) December 14, 2022 18:30
@mscheltienne

Copy link
Copy Markdown
Member Author

Hold that one, I'd like to improve a bit the error messages to differentiate between channel selection and component selection.
I'll do that tomorrow morning/late afternoon.

@larsoner

Copy link
Copy Markdown
Member

Sounds good -- FYI we plan to release Friday so getting it in tomorrow would be ideal!

@mscheltienne

Copy link
Copy Markdown
Member Author

@larsoner Good to merge, the failure is not related.

@larsoner
larsoner enabled auto-merge (squash) December 15, 2022 16:07
@larsoner
larsoner merged commit 6c403d3 into mne-tools:main Dec 15, 2022
@larsoner

Copy link
Copy Markdown
Member

Thanks @mscheltienne !

@mscheltienne
mscheltienne deleted the ica_pick branch December 15, 2022 22:10
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.

Selection of ICA components when plotting properties

2 participants