mne-tools/mne-python — pull request #273 by Eric89GXL (2012-12-15 05:26:39+00:00)
Title: FIX: Read/write of epochs, dealing with raw property

@dengemann, are you okay with having to pass the sample offset into epochs.to_nitime instead of inferring it from the underlying raw instance? This is the only thing other than reading data that uses the epochs.raw instance.

The alternative approach is having to save raw_first_samp as a property of epochs, and save/load it with the object. I find this less than ideal since it seems unnecessary -- most of mne-python does timings relative to first_samp anyway, so it would seem more consistent with our methodology not to store it for that reason, too. However, I'd also understand if you prefer not to have to remember the raw.first_samp to use, so storing it can be done if you think it would be better...

@agramfort this is to fix two bugs with the read/write:

1) Dropped epochs were not reflected with dropped events. By moving the data-reading before the event-saving, this is fixed.

2) epochs.copy() would fail after reading epochs from disk, as the epochs.raw property was not set. Thus I thought the best way to deal with this was to set `epochs.raw = None` on load, or whenever data are preloaded (since epochs.raw should not be needed after that).