How to specify units.

Hello.

I would like to plot ERP waveform, but I am having trouble understanding how to adjust the values on the vertical axis.
I have a data file named dataAllMember that contains all the data of all the subjects, and I am trying to generate the overall waveform with the code below.
The EEG values in the raw data are in μV, but the actual output (attached image) shows 1e6 in the upper left corner.
I am guessing that the default setting is to read the value as a numerical value with a unit of V and convert it to μV for processing.
The code is based on MNE Python’s tutorial on ERP calculation.
How can I solve this problem?

Thank you in advance.

data_info = mne.create_info(ch_names, sfreq, ch_types)
data_raw = mne.io.RawArray(dataAllMember.T, data_info)
data_raw = data_raw.filter(l_freq, h_freq)

events = mne.find_events(data_raw, stim_channel  = " EXT", min_duration = 0.01)
event_id_new = {"standard": 10, "new": 1}
epochs_new = mne.Epochs(data_raw, events, event_id_new, tmin = -0.1, tmax = 0.7, preload = True)
reject_criteria = dict(eog = 80, eeg=100)
epochs_new.drop_bad(reject=reject_criteria)

s_aud = epochs_new["standard"].average()
n_aud = epochs_new["new"].average()
epochs_new.equalize_event_counts(["standard", "new"])

evokeds = dict(standard = s_aud, new = n_aud)
mne.viz.plot_compare_evokeds(evokeds, picks=None, combine='mean')

The docstring of EpochsArray says for the data parameter “see notes for proper units of measure.” The notes then tell you that you should use unit V for EEG data. It sounds like you are passing it data in μV instead. Don’t do that.

FYI, in MNE-Python everything is stored in SI units. Sometimes our plotting functions will convert the units before plotting, just so that the axis labels don’t range from say 0.000001 to 0.000006 V, but instead from 1 to 6 μV. Again this is only on the plot, the underlying data object still stores the numbers in SI units. This is documented here: Algorithms and other implementation details — MNE 1.2.2 documentation

1 Like