Skip to main content

SimulateStcParams

Namespace: RTPROCESSINGLIB  ·  Library: DSP Library

#include <dsp/simulate.h>

struct UTILSLIB::SimulateStcParams

Parameters for source time course simulation.

src/examples/ex_dsp_analysis/main.cpp
const VectorXi vertices = VectorXi::LinSpaced(5, 100, 104);
MatrixXd waveforms(2, 4);
waveforms << 1.0, 2.0, 3.0, 4.0,
-1.0, 0.0, 1.0, 0.0;
const INVLIB::InvSourceEstimate stc = simulateStcFromWaveforms(waveforms, (VectorXi(2) << 101, 104).finished(), vertices, 0.0f, 0.01f);

SimulateStcParams gaussians; // one Gaussian bump per active vertex, seeded
gaussians.sfreq = 200.0f;
gaussians.duration = 0.5f;
const INVLIB::InvSourceEstimate random = simulateStc((VectorXi(1) << 102).finished(), vertices, gaussians);

Example​

Used in examples​

ex_dsp_analysis​

DSP library: Welch PSD, FIR filtering, peak finding, envelope correlation, SPHARA and simulation.

src/examples/ex_dsp_analysis/main.cpp, line 190
SimulateStcParams gaussians; // one Gaussian bump per active vertex, seeded
gaussians.sfreq = 200.0f;
gaussians.duration = 0.5f;
const INVLIB::InvSourceEstimate random = simulateStc((VectorXi(1) << 102).finished(), vertices, gaussians);
ok &= expect(stc.data.rows() == 5 && stc.data.row(1) == waveforms.row(0) && stc.data.row(4) == waveforms.row(1) && stc.data.row(0).isZero() && std::fabs(stc.tstep - 0.01f) < 1e-7f && random.data.cols() == 100 && std::fabs(random.data.row(2).maxCoeff() - 1.0) < 0.01 && random.data.row(0).isZero(),
"simulateStcFromWaveforms places rows on their vertices; simulateStc draws a unit Gaussian bump");

Authors of this file​