mne-tools / mne-tools/mne-python

ENH: Repair channels on a per-epoch basis

Open
#8,950 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Now that we have #8896 we can redo #1869 such that we can repair channels on a per-epoch basis.

The challenge I think will be making it efficient, but I think this will actually not be too bad if we refactor the interpolation code:

  1. Do the slowest part once: self- and cross-dots between all channels
  2. Do the faster part each time we need to: pseudoinversion based on all "from" good channels to all "to" bad channels for the given epoch
  3. Use a simple, small LRU cache to store the from-to paired pinv results (if you use more than 100 different "bad" combinations, which should be very rare, you start to pay a price for having to redo some of the pinv calls, but even this probably won't be too bad).

In principle someday we could do this on raw data, but we have to figure out how to prevent discontinuities between the original and reconstructed data segments. This should be doable with some suitable smooth windowing but it's not as easy as the epochs case.

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 by reviewing #8896 and the earlier proposal in #1869, then locate the existing interpolation code and its epoch-related entry points. The work is complete when channel repair operates per epoch with shared self- and cross-dots, per-epoch pseudoinversion, and the proposed small LRU cache; the raw-data case remains future work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.