mne-tools / mne-python

MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
https://mne.tools
BSD 3-Clause "New" or "Revised" License
2.7k stars 1.31k forks source link

How to create raw and then epochs from self data array #4189

Closed thisroot closed 7 years ago

thisroot commented 7 years ago

Hello, for several days I can not solve the problem. I have an array (x,y). Now I create a raw object who contain items of my array.

mne_info = mne.create_info(ch_names = raw['info'].chanels_names, 
                               sfreq = raw['info'].frequency,
                               ch_types = raw['info'].ch_types, 
                               montage = raw['info'].montage)

raw_mne = mne.io.RawArray(array, mne_info)

np.where(raw_mne == array[0][0]) => true 

then i create events array =>

[
[0,0,2]
[4943,0,1]
[9325,0,1]
...
]

And make epochs object

epochs = mne.Epochs(raw_train,
                                     events,
                                     event_id=labels,
                                     add_eeg_ref=False, 
                                     preload = True, 
                                     tmin = 0, tmax = 4.499)

There has several questions: events contains not cutting ranges, and i don't know these ranges. I set up Tmax variable and to get epochs. does correctly I realized that the ends of each activity are cropped until 4500 miliseconds? Why after cutting object epochs return old events?

But now I can not find the value of my original array in an array of epochs

data_epochs = epochs.get_data()
np.where(data_epochs == array[0][0]) => False

I can not understand what I'm doing wrong

jaeilepp commented 7 years ago

Can you provide a runnable piece of code that demonstrates this problem.

agramfort commented 7 years ago

closing due to no answer