Why is there an error message "Assertion Error" when drawing a power spectrum for. csv EEG data

  • MNE version: e.g. 0.24.0
  • operating system: Windows 10

EEG data in. csv format, with the first 32 being EEG data, the 33rd channel being the data index, and the 34th channel being the time scale.

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/lili/nao/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)
print(raw)
print(raw.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.compute_psd().plot()

Effective window size : 8.000 (s)
Traceback (most recent call last):
File “”, line 1, in
File “”, line 12, in compute_psd
File “F:\MNEfile\python_install\Lib\site-packages\mne\io\base.py”, line 2232, in compute_psd
return Spectrum(
^^^^^^^^^
File “F:\MNEfile\python_install\Lib\site-packages\mne\time_frequency\spectrum.py”, line 1146, in init
self._compute_spectra(data, fmin, fmax, n_jobs, method_kw, verbose)
File “F:\MNEfile\python_install\Lib\site-packages\mne\time_frequency\spectrum.py”, line 445, in _compute_spectra
result = self._psd_func(
^^^^^^^^^^^^^^^
File “”, line 12, in psd_array_welch
File “F:\MNEfile\python_install\Lib\site-packages\mne\time_frequency\psd.py”, line 233, in psd_array_welch
assert np.allclose(good_mask, good_mask[[0]], equal_nan=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError