-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Adjust labelling to actual naming of ICs #4320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
EMG channels were missing for the create_info function
Added emg channel type for use in the create_info function
During ICA, plotting of sources results in different labelling
|
we keep getting these bug reports about channel names that don't correspond to indices. when we write is this really worth changing? |
Codecov Report
@@ Coverage Diff @@
## master #4320 +/- ##
==========================================
+ Coverage 84.42% 84.42% +<.01%
==========================================
Files 346 346
Lines 62897 62897
Branches 9672 9672
==========================================
+ Hits 53099 53103 +4
+ Misses 7118 7115 -3
+ Partials 2680 2679 -1 |
|
Given the persistent confusion I think we should change something. To me
each new report adds to evidence that we have a bad design that needs
fixing.
We could try labeling as `ICA[3]` or so instead of `ICA #3`, but I still
don't think it's very good.
I'm starting to think that it would be better for ICA to number their
channel names from zero. It creates an inconsistency with other channel
types, yes, but I think it will create less confusion than the current
implementation.
|
|
agreed
I give up :)
let's call the ICA channels ICA 000, ICA 001, etc...
|
|
Thanks for being the final straw @stfnrpplngr, closing this as dup of #3889 where we'll continue discussion |
|
Reopened because this is already along the lines of the right fix. @stfnrpplngr 3 more things are necessary to get this in:
Do you have time to look into these? We're happy to walk you through them if you want to learn how. |
|
If someone could walk me through, that would be great. |
|
For (1), look through these to see if there is any mention of numbering differences:
Also look through #3633, #2019, #2000, #1622 to see if they mention updating docs anywhere else that we could fix. For (2), you'd add a For (3) run |
|
@stfnrpplngr do you have time to give it a try, or should someone else take over? |
Adjusting the naming of sources to the naming in ica.plot_components()
Adding channel_start argument and deprecation warning Suggested changes regarding pull request
| raw = mne.io.read_raw_fif(raw_fname, preload=True) | ||
| # 1Hz high pass is often helpful for fitting ICA | ||
| raw.filter(1., 40., n_jobs=2, fir_design='firwin') | ||
| raw.filter(1, 40, n_jobs=2) # 1Hz high pass is often helpful for fitting ICA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
Sorry, this probably happened updating from the master branch
|
@larsoner would you mind having a look on it again? |
| DeprecationWarning) | ||
| if channel_start not in (0, 1): | ||
| raise ValueError('channel_start must be 0 or 1, got %s' % | ||
| (channel_start,)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we actually really need a parameter for this? Or is the plan to remove it after the deprecation cycle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See suggestion above
But maybe we don't need the cycle and can just make the API change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd opt for not deprecating. We could even twitter vote ... Let's just get it right once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC that simple change is what @stfnrpplngr had as the commit two months ago. :(
Sorry for the back and forth @stfnrpplngr, but can you change it just to use the index (no need for the param / deprecation I suggested before)? Other than that, the other thing I see is that doc/whats_new.rst needs to be updated in the API section saying that the ICA labeling now starts from 0.
| ch_info = info['chs'] = [] | ||
| for ii in range(self.n_components_): | ||
| this_source = 'ICA %03d' % (ii + 1) | ||
| this_source = 'ICA %03d' % (ii) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could really just make clear that these are the indices. We have a similari issue in #4049 and should solve it consistently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes maybe using the # sign
so "ICA #1" is clear that it's index 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather do [0] than #1. But earlier you seemed happy with the current implementation...
|
My apologies @stfnrpplngr <https://github.com/stfnrpplngr> I did not follow
closely enough so far. If you guys prefer a depracation I won't stop you.
But don't do it for me.
…On Mon, Aug 14, 2017 at 4:43 PM Eric Larson ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In mne/preprocessing/ica.py
<#4320 (comment)>:
> @@ -224,7 +224,17 @@ class ICA(ContainsMixin):
def __init__(self, n_components=None, max_pca_components=None,
n_pca_components=None, noise_cov=None, random_state=None,
method='fastica', fit_params=None, max_iter=200,
- verbose=None): # noqa: D102
+ verbose=None, channel_start=None): # noqa: D102
+
+ if channel_start is None:
+ channel_start = 1
+ warn('channel_start will default to 1 in 0.15, but change '
+ 'to 0 in 0.16. Set it explicitly to avoid this warning',
+ DeprecationWarning)
+ if channel_start not in (0, 1):
+ raise ValueError('channel_start must be 0 or 1, got %s' %
+ (channel_start,))
IIRC that simple change is what @stfnrpplngr
<https://github.com/stfnrpplngr> had as the commit two months ago. :(
Sorry for the back and forth @stfnrpplngr <https://github.com/stfnrpplngr>,
but can you change it just to use the index (no need for the param /
deprecation I suggested before)? Other than that, the other thing I see is
that doc/whats_new.rst needs to be updated in the API section saying that
the ICA labeling now starts from 0.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4320 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB0firV-IeKxHtTEVK5G5wC9lnRXIT_xks5sYF0YgaJpZM4N7IFj>
.
|
|
I don't feel strongly either way, @stfnrpplngr feel free to revert to the simpler way or keep the current deprecation, up to you. Then we need |
|
I would like to keep it containing the deprecation warning hopefully guaranteeing less confusion on the user site. The |
|
so now the plan is to have ICA 000 as first ica channel? to everything is zero indexed? |
Yep |
| n_pca_components=None, noise_cov=None, random_state=None, | ||
| method='fastica', fit_params=None, max_iter=200, | ||
| verbose=None): # noqa: D102 | ||
| verbose=None, channel_start=None): # noqa: D102 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add channel_start before verbose, and also document it
|
ok let's see if it's actually less confusing for everyone...
|
| API | ||
| ~~~ | ||
|
|
||
| - Add ``channel_start`` parameter in :func:`mne.preprocessing.ica` to make explicit that ICA component labelling starts from 1 in 0.15, default will change to 0 in 0.16 by `Stefan Repplinger`_ and `Eric Larson`_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
over indented
|
ok keep it simple stupid. Start naming at 0
|
|
With no deprecation? That's okay with me I guess, and it sounded like @dengemann thought it was overkill, too. @stfnrpplngr I'll close this, cherry-pick your commits (there are a couple that do what we want) and open a new PR. Thanks for the fix and iterations! |
BTW this suggestion is the opposite of how it works in ICA viz currently. "ICA #000" is index 0. Just more evidence that our current scheme is unintuitive. |
I'm not sure whether this is a bug, just observed the following.

Plotting the time-locked sources doing an ICA, results in different labelling clicking on the components' lines:
Changing the proposed line in

_export_info()solves the problem: