Skip to content

BUG: read_epochs for split files has incorrect events #5102

Closed

Description

@emilyps14

I have a large epochs file, that gets split into two files when I call epochs.save()
When I load it again using mne.read_epochs(), the events corresponding to the second file are incorrect, offset by [last epoch from the first file + tmax + 10s].

The bug comes from _concatenate_epochs.

This breaks the relationship between the raw file and the events list, which (aside from causing downstream problems with my code) can lead to an error in epochs.get_data if the data were loaded with preload=False.

Activity

  1. agramfort commented on Apr 5, 2018

    @agramfort
    SponsorMember
  2. emilyps14 commented on Apr 5, 2018

    @emilyps14
    ContributorAuthor

    `
    import os.path as op
    import mne

    data_path = op.join(mne.datasets.sample.data_path(), 'MEG', 'sample')
    raw = mne.io.read_raw_fif(op.join(data_path, 'sample_audvis_raw.fif'), preload=True)

    events = mne.make_fixed_length_events(raw,1)
    epochs = mne.Epochs(raw, events)
    epochs.save('test-epo.fif',split_size='100MB')

    epochs2 = mne.read_epochs('test-epo.fif',preload=False)
    epochs2.get_data() # throws error
    assert(all([e1==e2 for e1,e2 in zip(epochs.events[:,0],epochs2.events[:,0])])) # assertion error
    `

  3. agramfort commented on Apr 5, 2018

    @agramfort
    SponsorMember
  4. larsoner commented on Apr 5, 2018

    @larsoner
    Member

    I see what you did there :)

    Yes I can try hopefully next week

  5. larsoner commented on Apr 5, 2018

    @larsoner
    Member

    @emilyps14 can you see if #5103 fixes it for you?

  6. added this to the 0.16 milestone on Apr 5, 2018
  7. emilyps14 commented on Apr 5, 2018

    @emilyps14
    ContributorAuthor

    Yep, that fixes it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions