Skip to content

Allow opening epoched EEGLAB .set files without any events #6610

Closed

Description

@alamkanak

It is obvious that when you have an epoched .set file exported from eeglab with no events in it, mne fails to load it with read_epochs_eeglab or read_raw_eeglab. When trying to open with read_epochs_eeglab, it throws the error:

IndexError: list index out of range

I also tried to open it by setting events parameter to empty array and None but it still failed. And when trying to open with read_raw_eeglab, it throws the error:

TypeError: The number of trials is 43. It must be 1 for raw files. Please use mne.io.read_epochs_eeglab if the .set file contains epochs.

I really need to open the epoched set file with no events in it.

Activity

  1. agramfort commented on Jul 29, 2019

    @agramfort
    SponsorMember
  2. agramfort commented on Jul 29, 2019

    @agramfort
    SponsorMember
  3. mmagnuski commented on Jul 29, 2019

    @mmagnuski
    Member

    @agramfort Eeglab reader should work in this case too, I think (it would work in eeglab from what I remember). The easiest is if you rename both files so that eeg.data matches the name of the fdt file.

    @alamkanak Which mne-python version are you using? There have been problems with no events some time ago but they were fixed. Can you reproduce the problem with mne-python master branch? Could you also paste the full error traceback when trying to open the file with read_epochs_eeglab?

  4. mmagnuski commented on Jul 29, 2019

    @mmagnuski
    Member

    Ok, I looked at the files. The reading fails on master due to the fact that this is an epochs file without events. Also the EEG.epoch field is empty. This is very uncommon, @alamkanak how did you obtain those files?

  5. changed the title [-]Allow opening EEGLAB .set files without any events[/-] [+]Allow opening epoched EEGLAB .set files without any events[/+] on Jul 29, 2019
  6. alamkanak commented on Jul 29, 2019

    @alamkanak
    Author

    @mmagnuski Thank you for looking into it. To obtain that file, I epoched the EEG from -1000ms to -100ms in eeglab. So the eeg signals end 100ms before the events. This is because I am only interested in that part of the signals. I had to crop that in eeglab due to a standard pipeline and I must not do that later with mne.

  7. mmagnuski commented on Jul 29, 2019

    @mmagnuski
    Member

    @alamkanak Thanks, which eeglab version were you using then? I am just wondering if eeglab always drops information about epoching events if they are outside of epoch's range (even in EEG.epoch). Maybe you know @jona-sassenhagen?
    The problem with such epochs behavior is that because you no longer have any information about the events that were used in epoching you wouldn't be able to compare conditions etc. In fact, mne assumes that you always have event information if you have epoched eeglab data. However if this is standard eeglab behavior (not saving any event information for epoching events outside of epoch range) - then we should probably add support for this.
    For now it would be easiest for you @alamkanak if you epoch -1000 to 0 ms for example. Then the event info will be retained and you would be able to read the epochs into mne.

  8. larsoner commented on Aug 20, 2019

    @larsoner
    Member

    I'd be fine with emitting a warning that events information has been lost and still reading the file, @mmagnuski can you make a PR?

  9. mmagnuski commented on Aug 20, 2019

    @mmagnuski
    Member

    Sure, I can do it this week - would we populate event_id and events and other necessary fields (not sure what other) with some default values then?

  10. larsoner commented on Aug 20, 2019

    @larsoner
    Member

    Yes I would just make events = np.column_stack((np.arange(len(epochs)), 0, np.ones(len(epochs), int))) and event_id=dict(unknown=1)

  11. self-assigned this
    on Aug 23, 2019
  12. agramfort commented on Dec 28, 2019

    @agramfort
    SponsorMember

    @mmagnuski do you still plan to look into this?

  13. mmagnuski commented on Dec 29, 2019

    @mmagnuski
    Member

    Yes, sorry, I completely forgot. But I won't be able to do it this year. I can get to it on Friday, though.

  14. agramfort commented on Dec 30, 2019

    @agramfort
    SponsorMember
  15. guoyongjian111 commented on Nov 26, 2021

    @guoyongjian111

    so i have a rest eeg data(.set), epochs=119,but events = 0 ,what should i do can read this data?please

  16. added this to the 1.0 milestone on Jan 6, 2022
  17. modified the milestones: 1.0, 1.1 on Feb 11, 2022
  18. modified the milestones: 1.1, 1.2 on Jun 4, 2022
  19. removed this from the 1.2 milestone on Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions