-
Notifications
You must be signed in to change notification settings - Fork 34
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
[BUG] Fix memory error spectral_connectivity_time #175
Conversation
Currently the only method where spatial patterns are produced is MIC (not MIM or GC methods). I created a new variable mne-connectivity/mne_connectivity/spectral/epochs_multivariate.py Lines 820 to 822 in 93b2f83
I could have hard-coded this, however I am just thinking ahead to when #163 is finished and the array should also be initialised for CaCoh. |
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.
Is there a unit-test that we can add to prevent this from occurring, or is this an internal detail?
Personally, I would consider this more of a one-off oversight in the implementation from a mistake on my end. Tbh I wouldn't know where to start in defining an appropriate memory usage for a function such as this. |
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.
SG! LGTM minus a small nit
Co-authored-by: Adam Li <adam2392@gmail.com>
Fix for #174.
In short, the array for storing spatial patterns of connectivity used by the MIC method was unnecessarily being created for all methods. This could lead to memory errors when bivariate connectivity methods were being called on large numbers of connections.
This fix makes it so that the patterns array will only be instantiated in methods that require it, otherwise will be set to
None
. This does not cause any change in behaviour, since for methods where patterns are not used,None
was already being stored in thepatterns
attribute of the returned connectivity objects.This is a problem specific to
spectral_connectivity_time()
;spectral_connectivity_epochs()
was already using the fixed approach.