The content of. csv EEG data includes the first 32 columns of EEG, 33 columns of data index, and 34 columns of time scale
- MNE version: e.g. 0.24.0
- operating system: Windows 10
import pandas as pd
import numpy as np
import mne
import csv
from mne.preprocessing import ICA
from mne.time_frequency import tfr_morlet
dataframe = pd.read_csv(“/MNEfile/mne_raw/李至鑫/脑电/Data2.csv”)
data = dataframe.transpose().to_numpy()
ch_names = [‘Fp1’, ‘Fp2’, ‘Fz’, ‘F3’, ‘F4’, ‘F7’, ‘F8’, ‘FCz’, ‘FC3’, ‘FC4’, ‘FT7’, ‘FT8’, ‘Cz’, ‘C3’, ‘C4’, ‘T3’, ‘T4’, ‘CPz’, ‘CP3’, ‘CP4’, ‘TP7’, ‘TP8’, ‘Pz’, ‘P3’, ‘P4’, ‘T5’, ‘T6’, ‘Oz’, ‘O1’, ‘O2’, ‘HEOL’, ‘HEOR’,‘Data indexing’,‘Time scale’]
ch_types = [‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’,
… ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’, ‘eeg’,‘misc’, ‘misc’, ‘misc’, ‘misc’]
sampling_freq = 256
info = mne.create_info(ch_names= ch_names, ch_types= ch_types, sfreq= sampling_freq)
raw = mne.io.RawArray(data, info)
montage = mne.channels.make_standard_montage(“standard_1020”)
raw.set_montage(montage)
chan_types_dict={“Fp1”:“eog”,“Fp2”:“eog”}
raw.set_channel_types(chan_types_dict)
print(raw.info)
raw.plot(duration=5,n_channels=28,clipping=None)