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))))