convert discontinuous data to continuous

Hi MNE users,

I’ve epoched my data to remove artifacts using make_fixed_length_epochs() function. Is there any way to convert the 3D epoched data (EpochschannelsSamples) back to the initial type and format (2D data (Channels*Samples))?

Thank you,

Hello @Mostafa,

are you sure you really want to do that? The reconstructed continuous data will most likely have discontinuities if you removed any epochs, and this can cause problems down the road…

setting aside whether it is a good idea, there is some code in this answer that will get you there.

1 Like

Thank you @richard and @drammock . You are right. it doesn’t look a good idea. I found another way around to solve my problem.

Hello @Mostafa , how did you go by this? I am faced with same issue.
Is working with the averaged or evoked object the correct thing here?

Hi @eyamu ,
As Richard mentioned above, it’s not a good idea as the removed epochs would create discontinuities in your data. However, if you still want to do that, you can use the following code.

data = epochs.get_data()
pseudo_raw_data = np.hstack(data)
pseudo_raw = mne.io.RawArray(pseudo_raw_data, epochs.info)
1 Like