You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import numpy as np
import mne
import matplotlib . pyplot as plt
# loading data
data = np . load ( " ABMD_results.npy " , allow_pickle = True ) . item ( )
samples = data [ ' data ' ]
cnt = 1
for sample in samples :
# 创建一个列表, 其中包含30个eeg1到eeg30的名称
channels = [ f " eeg { i } " for i in range ( 1 , 31 ) ]
# 创建一个列表, 其中包含30个eeg类型的元素
channel_types = [ " eeg " ] * 30
# 使用mne模块创建一个info对象, 其中包含上面创建的channels和channel_types列表
info = mne . create_info ( ch_names = channels ,
sfreq = 1100 ,
ch_types = channel_types )
# 使用mne模块创建一个RawArray对象, 其中包含sample和info对象
raw = mne . io . RawArray ( sample , info )
fig = raw . plot ( duration = 440 , n_channels = 30 , color = ' black ' , scalings = ' auto ' )
fig . savefig ( f " G: \ 脑电波 \ more_pic \\ { cnt } .jpg " )
# print(data['subject_ids'][cnt-1], data['text_ids'][cnt-1])
cnt = cnt + 1