I want to add the event_dict in raw to the edf data as a label. My code is as follows:
import mne
import os
import pandas as pd
pd.options.display.max_rows = 1000
pd.options.display.max_columns = 10000
pd.options.display.width = 10000
testing_data_folder = mne.datasets.testing.data_path()
eeglab_raw_file = os.path.join("C:/Users/taoya/mne_data/MNE-testing-data/EEGLAB/test_raw.set")
eeglab_raw = mne.io.read_raw_eeglab(eeglab_raw_file)
event_from_annot, event_dict = mne.events_from_annotations(eeglab_raw)
print(event_from_annot)
print(event_dict)
event_dict result is {'rt': 1, 'square': 2}
.
and than conver raw to dataframe show is :
![image|690x74](upload://rJCJUtKcgvt517E1KloWAj7OU7N.png)
this shape is (30504, 33)。
when I use mne.Epochs
show shape is (14014, 35)
:
epochs = mne.Epochs(eeglab_raw, events=event_from_annot, event_id=event_dict,
preload=True, baseline=None)
epochs_df = epochs.to_data_frame()
print(epochs_df.head(5))
print(epochs_df.shape)
this dataframe show is :
Now I have two questions:
- Why does mne.Epochs reduce shape? Is it because of tmax and tmin。and how to keep shape?
- If I don’t use mne.Epochs, how do I add event_dict as a list of labels to the eeglab_raw dataframe
Thank you!