Skip to content
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

Major memory usage optimization in iEEG pipeline #127

Merged
merged 15 commits into from
Apr 3, 2023
Merged

Conversation

menoua
Copy link
Member

@menoua menoua commented Apr 2, 2023

Reference Issues/PRs

What does this implement/fix? Explain your changes.

Any other comments?

Comment on lines +241 to +242
raw_data['data'] = raw_data['data'][earliest_sample:latest_sample].copy()
raw_data['wav'] = raw_data['wav'][earliest_sample:latest_sample].copy()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you copy these here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a part of the memory optimization. Returning a slice of the numpy array keeps the entire array alive in memory. Copying momentarily increases memory usage, but then drops the larger array and only keeps the smaller one. I couldn't find a way to discard the unwanted parts without making a copy.

@@ -161,23 +160,30 @@ def filterbank_hilbert(x, fs, Wn=[1,150], n_jobs=-1):

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless you add a parameter like return_average and set it to False by default, the above Examples section is now broken

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separated this functionality into two functions now: filter_hilbert and filterbank_hilbert

@menoua menoua merged commit f795795 into hackathon Apr 3, 2023
@menoua menoua deleted the granular-logging branch April 3, 2023 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants