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

updated eeglab.py to account for SET files that contain trials but no… #12704

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

drpedapati
Copy link

Reference issue

No issue

What does this implement/fix?

This pull request implements a robust method for handling EEGLAB files that contain epoched data but lack explicit event information. Specifically:

  1. It introduces a new function generate_boundary_events that creates synthetic boundary events for epoched data without events.
  2. It modifies the existing create_events_from_eeglab function to use this new method when appropriate.
  3. It ensures that the generated events array is always a NumPy array of 64-bit integers, resolving compatibility issues with MNE functions.

These changes allow MNE to properly process EEGLAB files that have been epoched but have lost their event information during preprocessing or export. This is particularly useful for researchers working with legacy datasets or those using EEGLAB processing pipelines that may not preserve event information in all cases.

Additional information

  • This implementation assumes that epochs in the data are contiguous. If there are known gaps between epochs in certain datasets, additional parameters may need to be added to the generate_boundary_events function to account for this.
  • The boundary events are given a unique event code (1 in this implementation). Users should be advised to check that this does not conflict with existing event codes in their datasets.
  • Extensive testing has been done with various EEGLAB files, including those with and without event information, to ensure backward compatibility and correct handling of different data structures.
  • Documentation has been updated to reflect these changes and provide guidance on using these functions with problematic datasets.

Copy link

welcome bot commented Jul 9, 2024

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

Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a very tiny file we could use to test this code on the CI?

mne/io/eeglab/eeglab.py Outdated Show resolved Hide resolved
mne/io/eeglab/eeglab.py Outdated Show resolved Hide resolved
mne/io/eeglab/eeglab.py Outdated Show resolved Hide resolved
mne/io/eeglab/eeglab.py Outdated Show resolved Hide resolved
drpedapati and others added 4 commits July 13, 2024 18:58
Co-authored-by: Alexandre Gramfort <[email protected]>
Co-authored-by: Alexandre Gramfort <[email protected]>
Co-authored-by: Alexandre Gramfort <[email protected]>
Co-authored-by: Alexandre Gramfort <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants