mne-tools / mne-tools/mne-python

Wrong logic excluding event codes with just one event in read_raw_egi

Open
#11,626 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description of the problem

I believe when creating a RawMFF object, the logic for excluding events with just one event is wrong (line 434), it rejects them if event.sum() <= 1, but event.sum() could be more than 1 since it contains the event id (1 to n_events), a more appropriate to do this would be something like np.count_nonzero(event) <= 1

Also, in the documentation for read_raw_egi, which uses RawMFF, it says

The event channels to be ignored when creating the synthetic trigger. Defaults to None. If None, channels that have more than one event and the sync and TREV channels will be ignored.

which I believe is also wrong.

I can submit a PR once this is confirmed.

Related, I think it might be helpful to keep events that only occur once, they could be important tags that indicate start/end of experiments for example, a suitable place might be in the annotations.

Steps to reproduce
Import raw mff files
Link to data

No response

Expected results

All one-shot events excluded

Actual results

Only the first one-shot event (with ID 0) is excluded

Additional information

Draft PR #11627

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 line 434 of mne/io/egi/egimff.py and compare the exclusion logic with the read_raw_egi documentation. Review draft PR #11627 and confirm the intended treatment of event channels containing a single event; done means the implementation, documentation, and observed RawMFF behavior agree.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.