erpimage#

erpimage(data, sortvar=None, times=None, title='', avewidth=1, decimate=0, *options, target=None, title_fontsize=None, rng=None, **kwargs)#

Image single trials sorted and smoothed across trials, as EEGLAB erpimage.

The positional arguments follow EEGLAB: data is (frames, trials) for one channel (or a (1, frames*trials) concatenation), sortvar holds one value per trial (trials with NaN are dropped), times is latencies in ms or [start_ms, frames, srate], avewidth is the moving-average width in trials and decimate the window advance. EEGLAB options follow either as 'key', value tokens (erpimage(data, rt, times, '', 5, 1, 'erp', 'cbar')) or as keywords (erp=True, cbar=True). Supported options: align, timewarp, renorm, noplot, NoShow, nosort, replace_ties, valsort, phasesort, ampsort, sortwin, showwin, plotamps, limits, sortvar_limits, signif, caxis, erp (1 to 4 percentile ERPs), erpalpha, erpstd, erp_grid, erp_vltg_ticks, rmerp, coher, srate, cycles, cbar, cbar_title, topo, spec, specaxis, horz, vert, auxvar, sortvarpercent, noxlabel, yerplabel, avg_type, img_trialax_label, img_trialax_ticks, baseline, baselinedb, filt and plotmode.

Numbers match EEGLAB. Where EEGLAB’s behavior contradicts its own help, EEGPrep follows the help: sortidx indexes the input trials, noplot hides only the sortvar trace, and erpalpha draws unbiased random signs for its permutation test (EEGLAB’s sign(randn-0.5) is +1 only 31% of the time, sccn/eeglab#976), so erpalpha thresholds differ slightly from MATLAB. Non-integer boxcar widths raise ValueError, as MATLAB R2025b does. Invalid inputs raise ValueError; the notes EEGLAB prints and continues past (clamped widths, removed NaN trials, ignored options) are logged through logging.

Parameters:
  • target (Any) – Matplotlib Figure or SubFigure to draw into instead of a new figure window; not allowed with NoShow.

  • title_fontsize (float | None) – font size of the image title.

  • rng (Any) – seed, numpy.random.Generator or RandomState for the coherence bootstrap and the erpalpha permutations.

  • data (Any)

  • sortvar (Any)

  • times (Any)

  • title (str)

  • avewidth (Any)

  • decimate (Any)

  • options (Any)

  • kwargs (Any)

Returns:

ErpimageResult with the 15 EEGLAB outputs and the figure (None with NoShow).

Raises:
  • TypeError – target is not a Matplotlib Figure or SubFigure.

  • ValueError – invalid data, sorting variable or option values.

Return type:

ErpimageResult