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

BUG: read_epochs for split files has incorrect events #5102

Closed
emilyps14 opened this issue Apr 5, 2018 · 6 comments
Closed

BUG: read_epochs for split files has incorrect events #5102

emilyps14 opened this issue Apr 5, 2018 · 6 comments
Milestone

Comments

@emilyps14
Copy link
Contributor

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.

@agramfort
Copy link
Member

agramfort commented Apr 5, 2018 via email

@emilyps14
Copy link
Contributor Author

emilyps14 commented Apr 5, 2018

`
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
`

@agramfort
Copy link
Member

agramfort commented Apr 5, 2018 via email

@larsoner
Copy link
Member

larsoner commented Apr 5, 2018

I see what you did there :)

Yes I can try hopefully next week

@larsoner
Copy link
Member

larsoner commented Apr 5, 2018

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

@larsoner larsoner added this to the 0.16 milestone Apr 5, 2018
@emilyps14
Copy link
Contributor Author

Yep, that fixes it. Thanks!

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

No branches or pull requests

3 participants