[7f9fb8]: / doc / _includes / channel_interpolation.rst

Download this file

71 lines (42 with data), 3.6 kB

orphan:

Bad channel repair via interpolation

Spherical spline interpolation (EEG)

In short, data repair using spherical spline interpolation :footcite:`PerrinEtAl1989` consists of the following steps:

  • Project the good and bad electrodes onto a unit sphere
  • Compute a mapping matrix that maps N good channels to M bad channels
  • Use this mapping matrix to compute interpolated data in the bad channels

Spherical splines assume that the potential V(ri) at any point ri on the surface of the sphere can be represented by:

V(ri) = c0 + Nj = 1cigm(cos(ri, rj))

where the C = (c1, ..., cN)T are constants which must be estimated. The function gm(⋅) of order m is given by:

gm(x) = (1)/(4π)n = 1(2n + 1)/((n(n + 1))m)Pn(x)

where Pn(x) are Legendre polynomials of order n.

To estimate the constants C, we must solve the following two equations simultaneously:

GssC + Tsc0 = X
TsTC = 0

where Gss ∈ RN×N is a matrix whose entries are Gss[i, j] = gm(cos(ri, rj)) and X ∈ RN×1 are the potentials V(ri) measured at the good channels. Ts = (1, 1, ..., 1) is a column vector of dimension N. Equation :eq:`matrix_form` is the matrix formulation of Equation :eq:`model` and equation :eq:`constraint` is like applying an average reference to the data. From equation :eq:`matrix_form` and :eq:`constraint`, we get:

\begin{bmatrix} c0 C  = \begin{bmatrix} TsT 0Ts Gss

Ci is the same as matrix \begin{bmatrix} TsT 0Ts Gss but with its first column deleted, therefore giving a matrix of dimension (N + 1)×N.

Now, to estimate the potentials  ∈ RM×1 at the bad channels, we have to do:

 = GdsC + Tdc0

where Gds ∈ RM×N computes gm(ri, rj) between the bad and good channels. Td = (1, 1, ..., 1) is a column vector of dimension M. Plugging in equation :eq:`estimate_constant` in :eq:`estimate_data`, we get

 = \begin{bmatrix} Td Gds\begin{bmatrix} c0 C  = \begin{bmatrix} Td GdsCi

To interpolate bad channels, one can simply do:

>>> evoked.interpolate_bads(reset_bads=False)  # doctest: +SKIP

and the bad channel will be fixed.

Examples:

  • :ref:`ex-interpolate-bad-channels`