Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_raw_egi always exclude first isolated event #11672

Closed
nafraw opened this issue May 3, 2023 · 2 comments · Fixed by #12300
Closed

read_raw_egi always exclude first isolated event #11672

nafraw opened this issue May 3, 2023 · 2 comments · Fixed by #12300
Labels

Comments

@nafraw
Copy link

nafraw commented May 3, 2023

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

@nafraw nafraw added the BUG label May 3, 2023
@welcome
Copy link

welcome bot commented May 3, 2023

Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴

@drammock
Copy link
Member

drammock commented May 3, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants