mne-tools / mne-tools/mne-python

Bug: event_repeated metadata incompatibility

Open
#7,732 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

mne.Epochs event_repeated parameter does not play well metadata:

import mne
import numpy as np
import pandas as pd
raw_data = np.random.randn(2, 10000)
info = mne.create_info(2, 1000.)
raw = mne.io.RawArray(raw_data, info)

opts = dict(raw=raw, tmin=0, tmax=.001, baseline=None)

No problem when there are no repeated events and metadata

events = [[0, 0, 1], [1, 0, 1]]
metadata = pd.DataFrame(events, columns=['onset', 'duration', 'value'])

epochs = mne.Epochs(events=events, metadata=metadata, **opts)

No problem when repeated events and no metadata

events = [[1, 0, 1], [1, 0, 1]]
epochs = mne.Epochs(events=events, event_repeated='drop', **opts)

problem when repeated events and metadata

events = [[1, 0, 1], [1, 0, 1]]
epochs = mne.Epochs(events=events, event_repeated='drop', metadata=metadata, **opts)

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 running the provided reproducer with mne.Epochs, event_repeated='drop', and metadata. Trace how repeated events are removed and how metadata rows are aligned; done means the repeated-event case works with metadata without an incompatibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.