I had to convert my epochs to dataframe in order to make an operation, but now a I want to convert again to epochs form with already did. is there a eay way? of do I have to creat the epochs again as show in the example Creating MNE objects from data arrays — MNE 0.15 documentation?
- MNE version: e.g. 0.24.0
- operating system: Windows 10
As far as I know, that is not easy, and using
EpochsArray would be the way to approach it. Probably much easier is finding a way to do your operation without converting to DataFrame, probably using epochs.apply_function(). Can you tell us more about what this operation is that you needed to perform on the data? We might be able to help you figure out how to do it using
Side note: you’re linking to documentation of MNE version 0.15. That was released in 2017, more than 5 years ago. If you are actually using version 0.15, please please please update to the latest stable version.
I convert to dataframe because I need to do a permutation, in order to obtain the p-value, an then thresholding the epochs data with values less than 0.05, according to pvalue. I already have the thresholding of the epochs, but for me I’ve been difficult to return into epochs as object. However, I don’t know if i could do this process without dataframe method.
Thank you in advance
Hmm, OK. Doing a permutation might not be possible with
epochs.apply_function() but it depends on exactly what you’re permuting… if you’re shuffling time points it might work, but if you’re shuffling epoch conditions then probably not. Can you clarify? (or better yet, provide reproducible example code?)
I already solved my problem with X=epochs.get_data() and X= [:,:,0], I used the example of permutation_t_test.
Thank you for you help.