-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Caching channel interpolation matrix #4651
Comments
why not. @jasmainak had similar thoughts for autoreject work. One option I
suggested was to use joblib.Memory but there is maybe a simpler way... do
you have an API in mind?
|
I was thinking of just adding a public This would then make it possible to use different methods for caching depending on the situation, i.e., an autoreject function might locally cache them like you suggest, or a user could write them to disk. If there is a way to uniquely identify the matrix we could also implement module-wide caching like |
sounds like a plan
|
This would be a nice first step. Then when the parameter is used in
IIRC it will depend on At some point we might want to try using multipole moments (what MaxFilter does) instead of forward/inverse computations, it might be considerably faster. I would say let's not bother with automating the process for now, I agree it adds a (potentially much) more difficult layer of complexity as you suggest. |
This is also potentially relevant for #4491 |
Great initiative! In autoreject, I ended up copying the code from MNE and creating a private function called But, you don't necessarily need to use joblibs. I guess some kind of dictionary based memoizing might be good enough even for autoreject. |
Would it make sense to create a new object to return instead of an array? That way we could store a few properties (like the list of bad channels) that would make it possible to do some sanity checks before applying the matrix. But it would make saving more complicated. @jasmainak yeah I would suggest for now to expose the function to compute and apply the matrix, and leave the caching mechanism to the specific application. |
If the object subclasses |
Interpolating bad channels on multiple evoked objects can be quite slow, and the bottleneck is computation of the interpolation matrix. When the evoked objects are from the same raw file they ought to have the same bad channels, so the interpolation matrix is redundantly computed multiple times. How about exposing the function to compute the interpolation matrix and adding a parameter to
interpolate_channels()
that allows providing a precomputed interpolation matrix?The text was updated successfully, but these errors were encountered: