Find peaks amplitude and latency in EEG data python, preferably using MNE

835 Views Asked by At

I have EEG data, for which I want to calculate the peaks' amplitudes and latencies. I'm working with MNE, and found the method get_peak in the Evoked object. However, I want to find peaks on epochs data (not averaged). How can I do it? I didn't see similar functions for the epochs object. I would prefer to do it through MNE, but other python libraries can also work. It's important that there is an option to get the amplitude and latency of the peaks, and choose a time window for detection.

In addition, I didn't understand if the get_peak returns only the highest peak, or something else? If there is more than one peak.

Thanks!

1

There are 1 best solutions below

0
On BEST ANSWER

You can create an Evoked data structure from a single trial by just selecting a single trial from your Epochs structure and then applying .average(), e.g., as follows:

tmp_evoked = all_epochs[subj][cond][trial].average()

The above assumes you have an all_epochs object organized as trials within conditions within subjects (i.e., you're working at the group level). If your Epochs object has only one subject, then it would just be:

tmp_evoked = all_epochs[cond][trial].average()

You can further refine this to find the peak at only one channel as:

tmp_evoked = all_epochs[subj][cond][trial].pick(chan).average()