Doing Classic Univariate ERP Analyses

I’m currently just working on doing some traditional ERP analysis – i.e. extracting average sensor amplitude over a time window (i.e Fz amplitude, averaged over 300-500ms for each participant per each experimental condition) to then run frequentist statistical tests on.

I understand have got the data for a given subject and condition using:

data = epochs[condition].get_data(picks = "Fz")

But I need to select certain timepoints within this array. My EEG data has been downsampled to 200Hz and my epochs are from -0.2 seconds to +0.8 seconds (1 second overall, thus 200 samples). If I want to select data, say between +0.3ms and +0.5ms (i.e. from the 100th sample to the 140th sample) – how would I select this? The size of the array has left me confused.

The shape of the array is (n_epochs, n_channels, n_samples)

To convert time points to “sample indices”, you can use Epochs.time_as_index()

Another (IMHO easier) approach would be to simply crop the epochs to the desired range, e.g.,

epochs_cropped = (epochs[condition]
                  .crop(tmin=0.3, tmax=0.5)
1 Like