Skip to main content

Simulate

Namespace: RTPROCESSINGLIB  ·  Library: DSP Library

Module

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.

Python equivalent

mne.simulation.simulate_stc / simulate_evoked in MNE-Python.

#include <dsp/simulate.h>

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors.

Provides functions equivalent to MNE-Python's mne.simulation module: simulateStc(): create synthetic source time courses

simulateEvoked(): generate synthetic evoked data from forward model


Functions

simulateStc(activeVertices, allVertices, params)

[InvSourceEstimate](/docs/api/inv/inv-source-estimate) simulateStc(const Eigen::VectorXi & activeVertices, const Eigen::VectorXi & allVertices, const SimulateStcParams & params);

Create a synthetic source time course.

Generates an InvSourceEstimate with Gaussian-envelope waveforms at specified source vertices. Each active source has a Gaussian temporal profile centered at different times.

Parameters:

  • activeVertices : const Eigen::VectorXi & Vertex indices for active sources.

  • allVertices : const Eigen::VectorXi & Full vertex index vector for the source space.

  • params : const SimulateStcParams & Simulation parameters (sfreq, tmin, duration).

Returns:


simulateStcFromWaveforms(waveforms, activeVertices, allVertices, tmin, tstep)

[InvSourceEstimate](/docs/api/inv/inv-source-estimate) simulateStcFromWaveforms(const Eigen::MatrixXd & waveforms, const Eigen::VectorXi & activeVertices, const Eigen::VectorXi & allVertices, float tmin, float tstep);

Create a synthetic source time course from custom waveforms.

Parameters:

  • waveforms : const Eigen::MatrixXd & Waveform data (n_active_sources x n_times).

  • activeVertices : const Eigen::VectorXi & Vertex indices for the active sources.

  • allVertices : const Eigen::VectorXi & Full vertex index vector.

  • tmin : float Start time (s).

  • tstep : float Time step (s).

Returns:


simulateEvoked(fwd, stc, info, noiseCov, nave, seed)

[FiffEvoked](/docs/api/fiff/fiff-evoked) simulateEvoked(const [MNEForwardSolution](/docs/api/mne/mne-forward-solution) & fwd, const [InvSourceEstimate](/docs/api/inv/inv-source-estimate) & stc, const [FiffInfo](/docs/api/fiff/fiff-info) & info, const [FiffCov](/docs/api/fiff/fiff-cov) & noiseCov, int nave, int seed);

Simulate evoked data from a source estimate and forward model.

Projects the source estimate through the forward model to generate sensor-space data, optionally adding noise from a noise covariance.

Equivalent to MNE-Python's mne.simulation.simulate_evoked().

Parameters:

  • fwd : const MNEForwardSolution & Forward solution (gain matrix).

  • stc : const InvSourceEstimate & Source time course.

  • info : const FiffInfo & Measurement info (for output channel info).

  • noiseCov : const FiffCov & Noise covariance for additive noise (optional).

  • nave : int Number of averages (noise scaled by 1/sqrt(nave)).

  • seed : int Random seed for noise generation.

Returns:


simulateEvokedNoiseless(fwd, stc, info)

[FiffEvoked](/docs/api/fiff/fiff-evoked) simulateEvokedNoiseless(const [MNEForwardSolution](/docs/api/mne/mne-forward-solution) & fwd, const [InvSourceEstimate](/docs/api/inv/inv-source-estimate) & stc, const [FiffInfo](/docs/api/fiff/fiff-info) & info);

Simulate evoked data without noise.

Projects source estimate through forward model (no noise added).

Parameters:

Returns:


Authors of this file