mne-tools / mne-tools/mne-python

Current multitaper implementation too slow for continuous raw data

Open
#11,383 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ENH
Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

Describe the new feature or enhancement

Currently, it is basically impossible to use raw.compute_psd(method="multitaper", bandwidth=1). For long data, it calculates hundreds of DPSS windows and therefore it takes way too long. In the example below, I used bandwidth=1 which is one of the fastest settings but it takes 6 minutes for a single raw array with shape (376 x 277s * 600Hz) (taken from this tutorial). I did not have time to test how long it takes for bandwidth=4 but probably more than 20 minutes on an M1 MacBook Pro.

Describe your proposed implementation

I am not very familiar with multitapers. However, it should be really easy to speed up the implementation, by simply calculating the multitapers on epochs of the raw data and averaging afterwards.

I discussed this at the CuttingMEEG conference with @britta-wstnr and I think she agreed.

Describe possible alternatives

Multitaper too slow: Jupyter Notebook

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the raw.compute_psd(method="multitaper", bandwidth=1) entry point and review the linked raw overview tutorial and multitaper_too_slow notebook for the reported workload. Compare the current continuous-data behavior with the proposed epoch-based calculation and averaging approach. Done means multitaper PSD for long raw data is substantially faster while preserving the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.