ERSP Average


  • Plugin name : ERSP Average
  • Version : 0.1
  • Author : Jussi T. Lindgren
  • Company : Inria
  • Short description : Averages a sequence of spectra per trial across multiple trials. The result is a sequence starting from t=0.
  • Documentation template generation date : Dec 3 2018


Example: Given an input sequence [t,s1,s2,t,s3,s4] for two trials with s* the spectra and t a stimulation denoting the trial start, the box returns 1/2*(s1+s3), 1/2*(s2+s4).

The ERSP Average box is intended to be used for computing Event-Related Spectral Perturbation (ERSP) plots. These plots show, starting from a stimulus onset, how the power spectrum develops over time on the average across the trials. This is not straightforwardly achievable with the other averaging boxes, as the OpenViBE Spectrum stream does not have a time dimension: a spectrum chunk is a matrix [frequency X channel], whereas to compute the average evolution of a spectra over time, we would need a tensor [frequency X channel X time] per trial and then average these across the trials.

To achieve the average, the ERSP Average box collects individual spectra, and computes the average when requested. In more detail, assume you have EEG data for trial t. Using other boxes, you can segment this trial to k spectral power estimates s1,s2,...,sk. Now what the ERSP average does is to average these estimates across the trials, and returns E[s1], E[s2], ..., E[sk], which you can then plot as the average evolution of the spectrum after the stimulus onset.


1. Input spectra

The spectrum stream to average

  • Type identifier : Spectrum (0x1f261c0a, 0x593bf6bd)

2. Control stream

  • Type identifier : Stimulations (0x6f752dd0, 0x082a321e)


1. Output spectra

A sequence of chunks encoding the evolution of the spectra after stimulus onset.

  • Type identifier : Spectrum (0x1f261c0a, 0x593bf6bd)


1. Trial start marker

The stimulation to identify the trial start (stimulus onset).

  • Type identifier : Stimulation (0x2c132d6e, 0x44ab0d97)
  • Default value : [ OVTK_GDF_Start_Of_Trial ]

2. Computation trigger

The stimulation to trigger the computation of the average.

  • Type identifier : Stimulation (0x2c132d6e, 0x44ab0d97)
  • Default value : [ OVTK_StimulationId_ExperimentStop ]


See the box tutorial ersp-average.mxs bundled with OpenViBE.


The box does not return anything until the computation trigger is received. After that, its output is set to start from time 0. Upon computation, its buffers and counters will be automatically cleared.