使用numpy库读取二进制数据文件及其它信息并使用mne库创建rawArray
import mne
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
base_path = "数据文件的目录"
data_addr = os.path.join(base_path , "EEG.data")
chanloc_addr = os.path.join(base_path , "chanlocs.csv")
data = np.fromfile(data_addr , dtype = np.float64)
chanloc = pd.read_csv(chanloc_addr)
data.shape = 30 , int(data.shape[0]/30)
chanl_names = chanloc["labels"].tolist()
info = mne.create_info(chanl_names , 1000 , ch_types = "eeg")
raw = mne.io.RawArray(data / 1e6, info)