mne-python

Does python mne raw object represent a single trail? if so, how to average across many trials?


I'm new to python MNE and EEG data in general.

From what I understand, MNE raw object represent a single trial (with many channels). Am I correct? What is the best way to average data across many trials?

Also, I'm not quite sure what the mne.Epochs().average() represents. Can anyone pls explain?

Thanks a lot.


Solution

  • From what I understand, MNE raw object represent a single trial (with many channels). Am I correct?

    An MNE raw object represents a whole EEG recording. If you want to separate the recording into several trials, then you have to transform the raw object into an "epoch" object (with mne.Epochs()). You will receive an object with the shape (n_epochs, n_channels and n_times).

    What is the best way to average data across many trials? Also, I'm not quite sure what the mne.Epochs().average() represents. Can anyone pls explain?

    About "mne.Epochs().average()": if you have an "epoch" object and want to combine the data of all trials into one whole recording again (for example, after you performed certain pre-processing steps on the single trials or removed some of them), then you can use the average function of the class. Depending on the method you're choosing, you can calculate the mean or median of all trials for each channel and obtain an object with the shape (n_channels, n_time).

    Not quite sure about the best way to average the data across the trials, but with mne.epochs.average you should be able to do it with ease. (Personally, I always calculated the mean for all my trials for each channel. But I guess that depends on the problem you try to solve)