-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
WIP ENH: interpolate EEG channels per epoch #1869
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
WIP ENH: interpolate EEG channels per epoch #1869
Conversation
e2c4216 to
4607fbd
Compare
4607fbd to
2f6d009
Compare
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.
Reshaping seems to affect the numbers slightly, I don't know why:
In [14]: x = np.random.normal(0, 1, (50, 50))
In [15]: x2 = np.reshape(x, (1, 50, 50))
In [21]: interp = np.random.normal(0, 1, (1,50))
In [25]: np.array_equal(interp.dot(x), interp[:,None,:].dot(x2)[:,0,0])
Out[25]: False
In [26]: np.allclose(interp.dot(x), interp[:,None,:].dot(x2)[:,0,0])
Out[26]: TrueThere 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.
It's possible that the order of operations could differ slightly depending on the striding / array-continuous direction. You could try re-casting both to have the same striding to see if they match. I could also imagine that having continuity in one direction that allowed you to use SSE/AVX SIMD instructions could change the numbers slightly since the summation could effectively be binned differently. Can't remember how strict the linear algebra / implementations are for those operations...
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 that sounds reasonable, when I recast the single epoch data I get exact matches (christianbrodbeck@557d9da)
|
All I did was extract the code for creating the goods/bads indexes and morph matrix so they can be cached when applying multiple times. |
|
The Appveyor problem seems to be related to downloading the datasets |
|
@christianbrodbeck it just occurred to me that an alternative would be to set the values to |
|
@christianbrodbeck what's up here? Wanna move on? |
|
I've implemented it for myself, I thought you did not like the API I suggested? |
I think meanwhile everyone agrees tjat we need this stuff! |
|
What about the API then? For myself I want the information to be as sparse as possible, because I want to save it along with the raw file and epoching instructions rather than build it into a data object directly. Hence list of lists of channel names seemed the most straight forward to me. |
|
@christianbrodbeck do you plan to work on this again? If so, perhaps it should go in the mne-sandbox repo until we settle on the best interpolation/cleaning tools. That way it can get in and used by people instead of sitting idle too long. |
|
Well I currently don't have any EEG data but I'm happy to clean it up if we settle on an API. |
|
@christianbrodbeck I think FASTER went into |
|
also might be useful to do this for MEG not just EEG interpolation |
|
@Eric89GXL it already needs non-straight forward rebasing, I'll leave that for when it actually gets added. |
|
@christianbrodbeck are you still interested in seeing / adding this feature? I'm not sure what the overlap is like with @jasmainak what is the overlap like between |
|
There is certainly some overlap. I'm wondering how much interest there is in terms of having the epoch-wise interpolation + viz for epoch-wise bad channels in MNE. It would be quite helpful in terms of reducing code duplication. Right now, we copy quite a bit of MNE interpolation code. |
|
I agree that a (private) API to do epochs wise interp in MNE would be useful. It should reduce code in autoreject + make comparison of other methods easier (outside of autoreject) it should work indeed with all channel types. |
|
I‘m not actively using it at the moment but I could look into updating this PR if the API question is resolved. I won‘t have time until about two weeks from now though.
|
|
Is this still considered for future inclusion? I would really appreciate this feature. |
|
question is how to parametrize this.
|
|
Just to bump this issue: I'd go with a dictionary of |
|
A boolean mask would be cleanest to my eye. Memory requirements will stay low enough not to be a concern |
|
Is the comment about not interpolating meg still the case? If so then if one has eeg + meg the boolean mask would have to contain many Falses for all the meg channels or the mask would only concern eeg channels (or |
|
We can interpolate MEG and EEG data nowadays |
|
Still |
|
Now that #8896 I think there is a path forward for this functionality, but it probably makes sense to start fresh given the changes there and the conflicts here. So I'll close but we can refer to this code if needed when we implement a solution |
No public API because @agramfort wants to wait for FASTER to discuss it.