Skip to content

read_raw_egi always exclude first isolated event #11672

@nafraw

Description

@nafraw

Description of the problem

The version I am using is "1.3.1". When reading mff file from an EGI system, I found that an event may be accidentally excluded if the first (1-indexed) event is discrete (one sample only) and only happen once.

The problem is that:

  1. under "def _read_events(input_fname, info)" of events.py, at line 32, events[n][i] = n + 1 will make 0th event as 1. If that event only happens once in the entire recording, there will be only one non-zero element and the value is 1.
  2. Then, when reaching line 424 of egimff.py or line 196 of egi.py, the condition "if event.sum() <= 1 and event_codes[ii]:" becomes True because event.sum() == 1
  3. As a result, that event is appended in "more_excludes" in the line after.

A simple solution:
Making "event.sum() <= 1" as "event.sum() < 1" for both:

  1. line 424 of egimff.py
  2. line 196 of egi.py
    However, I don't know if this would trigger another issue.

Steps to reproduce

with an mff file that has the event file (.xml) started with an event that only happened once.
Run:
mne.io.read_raw_egi(file, preload=True)
Then:
The output message reads that event is excluded.

Link to data

No response

Expected results

The event should not be excluded

Actual results

The event is excluded

Additional information

Platform: Windows-10-10.0.19044-SP0
Python: 3.8.13 (default, Mar 28 2022, 06:59:08) [MSC v.1916 64 bit (AMD64)]

mne: 1.3.1
numpy: 1.21.5 {MKL 2021.4-Product with 8 threads}
scipy: 1.7.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions