Plotting issue after specifying channel type

OS: Windows 10
Python: 3.8
MNE: 0.22.0

Hello,

I am experiencing some difficulty creating a ‘raw’ object from a Matlab file that contains my preprocessed EEG data. When I try to plot the raw data with raw.plot(), the signal is completely garbled. However, when I remove the ‘ch_types’ parameter of the info object and have the raw object consist entirely of ‘misc’ channels, the data is rendered normally. Interestingly, raw.plot_psd() seems to function normally regardless of whether I specify channel types. Has anybody else experienced this issue? Any advice would be appreciated.

Plot backend settings

matplotlib.use(‘Qt5Agg’)

Import data

mat_data = read_mat(r’C:\Users\Desktop\EEG_cut_proc\PreprocessedFiles\001_self_preprocessed.mat’)
data = np.array(mat_data[‘EEG’][‘data’])

Create info and raw objects

ch_names = mat_data[‘EEG’][‘chanlocs’][‘labels’]
sampling_freq = 500
info = mne.create_info(ch_names, ch_types=[‘eeg’]*64 , sfreq=sampling_freq)
raw = mne.io.RawArray(data,info)
raw.set_montage(‘standard_1005’)

%matplotlib qt
raw.plot()

image
image

Thank you

Hello,

This seems to be a scaling issue. MNE expects EEG data to be specified in Volts and multiplies the values by 1e6 for plotting in uV. Misc channels, on the other hand, are rescaled for plotting by the factor 1e3, that’s why the data looks okay when you’re using this channel type.

This all indicates that your input data is probably in mV or uV, and you should scale it to Volts before creating your MNE raw object by multiplying the values by either 1e-3 or 1e-6.

Hi Richard,

You were right, the input data was in uV. Multiplying the values by 1e-6 resolved the issue.

Thank you for the quick response.

Best regards

1 Like