Skip to main content

InvTfMxne

Namespace: INVLIB  ·  Library: Inverse Library

Python equivalent

mne.inverse_sparse.tf_mixed_norm in MNE-Python.

#include <inv/inv_tf_mxne.h>

class INVLIB::InvTfMxne

Time-Frequency Mixed-Norm Estimate (TF-MxNE) sparse inverse solver.

Solves the inverse problem in the time-frequency domain: min 0.5 * ||M - GZPhi||^2_F + alpha_space * ||Z||_21 + alpha_time * ||Z||_1

where Phi is a Gabor dictionary and Z are the TF coefficients, solved by FISTA. The L21 penalty enforces spatial sparsity (few active sources) while L1 enforces temporal sparsity (focal activations in time-frequency).

src/examples/ex_inv_api/main.cpp
// TF-MxNE: sparse in space and in a Gabor time-frequency dictionary; 40 samples at 150 Hz.
InvTfMxneParams tfParams;
tfParams.dAlphaSpace = 0.5 * alphaMax;
tfParams.dAlphaTime = 0.05 * alphaMax;
tfParams.dSFreq = evoked.info.sfreq;
tfParams.iNFreqs = 4;
tfParams.dFMin = 5.0;
tfParams.dFMax = 40.0;
const InvTfMxneResult tfMxne = InvTfMxne::compute(gain, measured, tfParams);

Static Methods​

compute(matGain, matData, params)​

Compute the TF-MxNE inverse solution.

Parameters:

  • matGain : const Eigen::MatrixXd & Forward gain matrix (n_channels × n_sources).

  • matData : const Eigen::MatrixXd & Measurement data (n_channels × n_times).

  • params : const InvTfMxneParams & TF-MxNE parameters.

Returns:


buildGaborDictionary(iNSamples, iNFreqs, dFMin, dFMax, dSFreq)​

Build a Gabor dictionary (tight frame) for time-frequency decomposition.

Parameters:

  • iNSamples : int Number of time samples.

  • iNFreqs : int Number of frequency bins.

  • dFMin : double Minimum frequency (Hz).

  • dFMax : double Maximum frequency (Hz).

  • dSFreq : double Sampling frequency (Hz).

Returns:

  • Eigen::MatrixXd — Gabor dictionary matrix (n_atoms × n_samples), where n_atoms = n_freqs * n_samples.

Example​

Used in examples​

ex_inv_api​

Inverse library: minimum-norm estimates, resolution matrices, label time courses, sparse solvers.

src/examples/ex_inv_api/main.cpp, line 262
tfParams.iNFreqs = 4;
tfParams.dFMin = 5.0;
tfParams.dFMax = 40.0;
const InvTfMxneResult tfMxne = InvTfMxne::compute(gain, measured, tfParams);
ok &= expect(!tfMxne.activeVertices.isEmpty() && tfMxne.activeVertices.size() <= 5 && tfMxne.activeVertices.contains(8),
QString("InvTfMxne: %1 V1 sources, including the strongest MxNE source 8").arg(tfMxne.activeVertices.size()));

Authors of this file​