mne.io.RawArray fails when setting ch_type to 'eeg'

I’m trying to build the MNE data structure from an array using mne.io.RawArray.

This works well when setting ch_types = ‘misc’.Hhowever, when setting ch_types = ‘eeg’ (and change nothing else), the output from raw.plot() only shows vertical lines (while it showed nice signals in the first case).

The same happens when running this tutorial:
https://mne.tools/stable/auto_tutorials/simulation/10_array_objs.html#sphx-glr-auto-tutorials-simulation-10-array-objs-py

See in particular this section:

times = np.linspace(0, 1, sampling_freq, endpoint=False)
sine = np.sin(20 * np.pi * times)
cosine = np.cos(10 * np.pi * times)
data = np.array([sine, cosine])

info = mne.create_info(ch_names=['10 Hz sine', '5 Hz cosine'],
                       ch_types=['misc'] * 2,
                       sfreq=sampling_freq)

simulated_raw = mne.io.RawArray(data, info)
simulated_raw.plot(show_scrollbars=False, show_scalebars=False)

I then run the same code again while replacing ch_types=[‘misc’] * 2 with ch_types=[‘eeg’] * 2 and it fails, see pictures attached.

Any ideas what’s going wrong here?


We use a scaling factor of 1 for 'misc', whereas data of type 'eeg' has a scaling factor of 1e-6. Therefore, you have to scale your data accordingly if you are changing the data type.

1 Like

ah right, of course!
I changed the scaling and it’s working now, thank you!