braindecode.functional.spherical_spline_kernel#

braindecode.functional.spherical_spline_kernel(pos_a, pos_b, stiffness=4, n_terms=50)[source]#

Spherical-spline covariance \(g(\cos\gamma)\) between two sets of positions.

\(g(x) = \frac{1}{4\pi}\sum_{n=1}^{N} \frac{2n + 1}{(n (n + 1))^m} P_n(x)\), with \(P_n\) the Legendre polynomials, \(\gamma\) the angle between the positions seen from the origin, \(m\) the stiffness and \(N\) the number of terms (MNE’s defaults: 4 and 50), as in [Perrin1989]. Positions are taken from the origin: subtract the head centre first. Pass it, or any function with this signature, to ChannelLayer as the strategy.

Parameters:
  • pos_a (Tensor) – (n_a, 3) and (n_b, 3) positions.

  • pos_b (Tensor) – (n_a, 3) and (n_b, 3) positions.

  • stiffness (int) – \(m\).

  • n_terms (int) – \(N\).

Returns:

(n_a, n_b), float64.

Return type:

Tensor

References

[Perrin1989]

Perrin, F., Pernier, J., Bertrand, O., & Echallier, J. F. (1989). Spherical splines for scalp potential and current density mapping. Electroencephalography and Clinical Neurophysiology, 72(2), 184-187. https://doi.org/10.1016/0013-4694(89)90180-6