Mark events based on spikes

Is there any way in MNE that I can add events based on the spikes.

I am testing my dry human skull phantom, where an impulse stimulation is provided in a random time instances to the phantom and the activity is recorded through EEG. The EEG response is therefore spikes.

How can I mark the events on EEG based on spikes.

This is what the spikes look like. I need to create events based on spike

@mmagnuski @richard

You could try to make use of mne.preprocessing.annotate_amplitude() by setting its peak parameter (and bad_percent=100 to avoid marking channels as bad).

This won’t create events, but annotations, but you could convert them to events via mne.events_from_annotations().

Alternatively, you could pass the data of a single channel to mne.preprocessing.peak_finder() and then create the events manually.

Just to add to Richard’s answer - to have more control over peak finding you can also use scipy.signal.find_peaks. It returns sample indices corresponding to the peaks that can be easily turned into events array.

1 Like