Sphara
Namespace: RTPROCESSINGLIB · Library: DSP Library
This page documents a header-level module — a collection of free functions that share an algorithmic topic. There is no enclosing C++ class; the functions live directly in the library namespace.
#include <dsp/sphara.h>
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors.
SPHARA represents a discrete EEG / MEG sensor montage as a triangulated manifold and decomposes its spatial degrees of freedom into the eigen- functions of the discrete Laplace–Beltrami operator on that mesh. Truncating the expansion at the lowest iNBaseFct harmonics suppresses high spatial frequencies that are dominated by sensor noise and reference artefacts, giving a denoising / smoothing projector that is the spatial-domain analogue of a low-pass filter.
makeSpharaProjector assembles the dense ``(iOperatorDim × iOperatorDim) projection matrix from a stack of pre-computed basis functions. The vecIndices argument maps the rows of the basis-function matrix back to channel indices in the full data matrix, and iSkip lets a single basis set be reused for interleaved sensor triplets such as the Neuromag / MEGIN VectorView gradiometer pairs.
Reference: Graichen U. et al., NeuroImage 86 (2014) 467–478.
Functions
makeSpharaProjector(matBaseFct, vecIndices, iOperatorDim, iNBaseFct, iSkip)
Eigen::MatrixXd makeSpharaProjector(const Eigen::MatrixXd & matBaseFct, const Eigen::VectorXi & vecIndices, int iOperatorDim, int iNBaseFct, int iSkip);
Constructs a SPHARA operator.
Parameters:
-
matBaseFct : const Eigen::MatrixXd & The SPHARA basis functions.
-
vecIndices : const Eigen::VectorXi & The indices of the positions in the final oeprator which are to be filled with the basis functions weights (i.e. these indices could respond to the indices of gradioemteres in a VectorView system).
-
iOperatorDim : int The dimensions of the final SPHARA operator. Make sure that these correspond to the dimensions of the data matrix you want tol multiply with the SPHARA operator.
-
iNBaseFct : int The number of SPHARA basis functions to take.
-
iSkip : int The value to skip when reading the vecIndices variabel. I.e. use this when dealing with VectorView triplets, which include two gradiometers.
Returns:
- Eigen::MatrixXd — Returns the final SPHARA operator with dimensions (iOperatorDim,iOperatorDim).
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>