When using raw.plot(), the image is wrong when the set ch_types

,
  • MNE version: MNE 1.2.1
  • operating system: macOS 12
  • Data Set : Seed-IV

import mne
import scipy.io as scio
data_path = “./eeg_raw_data/eeg_raw_data/1/1_20160518.mat”

file_name = “cz_eeg1”
raw_data = scio.loadmat(data_path)
index_list = [0, 2, 25, 29, 41, 49, 58, 60, 5, 13, 7, 11, 23, 31, 43, 47]
data = list(map(lambda i: raw_data[file_name][i], index_list))
ch_names = [“Fp1”,“Fp2”,“C3”,“C4”,“P7”,“P8”,“O1”,“O2”,“F7”,“F8”,“F3”,“F4”,“T7”,“T8”,“P3”,“P4”,]
info = mne.create_info(ch_names=ch_names, ch_types=[“eeg”]*16, sfreq=200)
raw = mne.io.RawArray(data, info, verbose=False)
raw.plot()
raw.compute_psd().plot()

When I add ch_types in mne.create_info, the μV of the plot image is very large, and when I delete it, the psd image cannot be displayed normally
CleanShot 2022-10-26 at 21.14.28@2x

If I delete, plot shows well but psd have problem

Hello,

MNE expects EEG data to be in Volts. Clearly, your data is not scaled correctly.
Regardless of the scale, you can set scalings="auto" to adapt the Y-range of the plot: raw.plot(scalings="auto") and you can use the +/- keys to interactively change the scale.

That said, I would strongly recommend to multiply data by the correct scaling to transform your data in Volts.

FYI, when you deleted the ch_types argument from create_info, it defaulted to 'misc', i.e. miscellaneous. As mentioned in the docstring of create_info, this is not a data channel type; thus when the PSD functions looks for data channels, it did not find any.

Mathieu

Thank you for your help, with your help I have processed the data correctly

data = list(map(lambda x: x / 1000000, list(map(lambda i: raw_data[file_name][i], index_list))))