- MNE version: e.g. 0.24.0
- operating system: Windows 10
Columns 1-32 are EEG data, columns 33 are data indexes, and columns 34 are time scale information.
import pandas as pd
import numpy as np
import mne
import csv
from mne.preprocessing import ICA
from mne_icalabel import label_components
from mne.time_frequency import tfr_morlet
dataframe = pd.read_csv(“/MNEfile/mne_raw/wang/脑电/Data2.csv”)
data = dataframe.transpose().to_numpy()
arr=np.array(data)
newarr=np.multiply(arr,0.000001)
print(newarr)
ch_names = 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(newarr, info)
montage = mne.channels.make_standard_montage(“standard_1020”)
raw.set_montage(montage)
raw.plot(duration=5,n_channels=34,clipping=None)
raw.drop_channels(raw.info[‘bads’])
print(raw.info)
chan_types_dict={“Fp1”:“eog”,“Fp2”:“eog”}
raw.set_channel_types(chan_types_dict)
print(raw.info)
raw.set_eeg_reference(ref_channels=“average”)
raw=raw.filter(l_freq=0.1,h_freq=30)
filt_raw = raw.copy().filter(l_freq=1.0, h_freq=100.0)
filt_raw = filt_raw.set_eeg_reference(“average”)
ica=ICA(max_iter=“auto”,method=“infomax”,random_state=97,fit_params=dict(extended=True))
ica.fit(filt_raw)
ica
The error message is shown in the following figure
Jiao