You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As mentioned in #4400, these two montages seem to have duplicate channel positions:
mne/channels/montages/standard_postfixed.elc
mne/channels/montages/standard_primed.elc
Furthermore, we currently have no description for mne/channels/montages/10-5-System_Mastoids_EGI129.csd, which contains a total of 465 locations. The last 129 locations are just numbers. Besides the cumbersome file name, we should make sure that this is a valid and useful montage (this file was also not documented in the docstring of the read_montage function).
@dengemann any time to look in the next week or two to see if you can make sense of these files you added a few years back? It would be good to fix this for 0.15
Ah OK, might get a bit crowded then. What if there are more than 2 names, like 3 or 4? I guess we could also just leave it as it is. The plot then indicates that there's something wrong with the montage (which I still think is the case, at least for EEG there shouldn't be montages with duplicate names).
I guess setting transform=True by default can be done in a new PR.
Besides that, what do we do with the two montages that have multiple labels for identical locations? People will probably start plotting montages because there now is a method for that and notice that something is wrong. I'd either remove these two montages or de-duplicate the labels.
I am against those for the same reasons as before (maintainability and
backward compatibility), and still in favor of the less invasive change of
making the plotting function smarter to handle overlaps.
Then I propose to issue a warning if plotting such a montage and only plotting the first label. Handling more than one label per position will be difficult since there is already overlap with only one label per location.
Checking for duplicate labels is giving me a headache. First, I need to use scipy.spatial.distance.pdist and scipy.spatial.distance.squareform - MNE does not require SciPy, so how should this be handled? Second, figuring out if there are duplicate labels is easy, but finding their indices and plotting only one label is pretty hard. I'm really not sure if these two defect montages are really worth this effort. In the end, they are defective and I still think we should either remove them completely or remove the duplicate labels from the montages.
Thanks @larsoner. If SciPy is a hard dependency then I just use it. MNE's _compute_nearest returns a vector of all zeros, whereas scipy.spatial.distance.cdist works. I think I just found a solution without loops.
This gives me all duplicates in the rows, column 0 is the index of the first label and column 1 the index of the second (duplicate) label. Now I'm working on integrating all of this into the plot function (which is not that straightforward because Montage objects don't support removal of channels out of the box, but anyway I'll do it manually).
Activity
larsoner commentedon Jul 19, 2017
@dengemann any insight on these montages? You added them ages ago (2014)
cbrnr commentedon Jul 20, 2017
Something else I've noticed. The elements in the
ch_nameslist have different types, especially the ones with byte elements could be problematic:This was fixed in #4427.
larsoner commentedon Jul 20, 2017
Yes we should also fix those
agramfort commentedon Jul 28, 2017
not fixed by #4427 ?
cbrnr commentedon Jul 28, 2017
Not entirely, there's still the issue with duplicate locations and the weird montage.
jaeilepp commentedon Jul 28, 2017
I guess the things in the original post are still unanswered.
larsoner commentedon Aug 5, 2017
@dengemann any time to look in the next week or two to see if you can make sense of these files you added a few years back? It would be good to fix this for 0.15
larsoner commentedon Aug 16, 2017
ping @dengemann any insight on these?
dengemann commentedon Aug 16, 2017
larsoner commentedon Aug 16, 2017
So remove both or just one of these:
mne/channels/montages/standard_postfixed.elcmne/channels/montages/standard_primed.elcdengemann commentedon Aug 16, 2017
larsoner commentedon Aug 16, 2017
The mysterious
10-5-System_Mastoids_EGI129.csdfile is already gone from our repo, so I'll close this then25 remaining items
larsoner commentedon Aug 22, 2017
I was thinking of showing all names, separated by newlines. We'd have to do some testing to figure out the best option.
cbrnr commentedon Aug 22, 2017
Ah OK, might get a bit crowded then. What if there are more than 2 names, like 3 or 4? I guess we could also just leave it as it is. The plot then indicates that there's something wrong with the montage (which I still think is the case, at least for EEG there shouldn't be montages with duplicate names).
cbrnr commentedon Sep 20, 2017
I guess setting
transform=Trueby default can be done in a new PR.Besides that, what do we do with the two montages that have multiple labels for identical locations? People will probably start plotting montages because there now is a method for that and notice that something is wrong. I'd either remove these two montages or de-duplicate the labels.
larsoner commentedon Sep 20, 2017
cbrnr commentedon Sep 20, 2017
Then I propose to issue a warning if plotting such a montage and only plotting the first label. Handling more than one label per position will be difficult since there is already overlap with only one label per location.
larsoner commentedon Sep 20, 2017
That sounds reasonable to me.
cbrnr commentedon Sep 21, 2017
Checking for duplicate labels is giving me a headache. First, I need to use
scipy.spatial.distance.pdistandscipy.spatial.distance.squareform- MNE does not require SciPy, so how should this be handled? Second, figuring out if there are duplicate labels is easy, but finding their indices and plotting only one label is pretty hard. I'm really not sure if these two defect montages are really worth this effort. In the end, they are defective and I still think we should either remove them completely or remove the duplicate labels from the montages.larsoner commentedon Sep 21, 2017
We have a standard fast pairwise distance wrapper
_compute_nearest(..., return_dists=True).SciPy is a hard dependency of MNE
Does this work?
cbrnr commentedon Sep 21, 2017
Thanks @larsoner. If SciPy is a hard dependency then I just use it. MNE's
_compute_nearestreturns a vector of all zeros, whereasscipy.spatial.distance.cdistworks. I think I just found a solution without loops.larsoner commentedon Sep 21, 2017
Oh right because it gives the neighbor as zero.
cdistshould be finelarsoner commentedon Sep 21, 2017
One non-(explicit-)loop would be to turn the square distance matrix into a connectivity matrix and do:
And then unpack the first element of each item in
components. Is that what you're doing?cbrnr commentedon Sep 21, 2017
Here's what I'm doing right now:
This gives me all duplicates in the rows, column 0 is the index of the first label and column 1 the index of the second (duplicate) label. Now I'm working on integrating all of this into the plot function (which is not that straightforward because
Montageobjects don't support removal of channels out of the box, but anyway I'll do it manually).cbrnr commentedon Sep 21, 2017
Let's see if this works in #4592...