CovDescription
Namespace: MNELIB · Library: MNE Library
#include <mne/mne_process_description.h>
struct MNELIB::CovDescription
Covariance matrix computation specification.
Ported from covDataRec (MNE-C browser_types.h).
src/examples/ex_mne_api/main.cpp
// An MNE-C covariance description (mne_process_raw --cov): pre-stimulus data of events 1 and 2
const QString covDescPath = tmp.filePath("audvis.cov");
QFile covDescFile(covDescPath);
ok &= covDescFile.open(QIODevice::WriteOnly | QIODevice::Text);
covDescFile.write("cov {\n"
" eegReject 14.230782369752743e-9\n"
" def {\n"
" event 1\n"
" event 2\n"
" tmin -0.2\n"
" tmax 0.0\n"
" }\n"
"}\n");
covDescFile.close();
CovDescription covariance;
MNEDescriptionParser::parseCovarianceFile(covDescPath, covariance);
covariance.rej.megGradReject = covariance.rej.megMagReject = covariance.rej.eogReject = 0.0f; // EEG limit only
const CovDefinition& preStim = covariance.defs.first();
const FiffCov noiseCov = FiffCov::compute_from_epochs(raw, events.events, {1, 2}, preStim.tmin, preStim.tmax, preStim.bmin, preStim.bmax, preStim.doBaseline,
covariance.removeSampleMean, preStim.ignore, preStim.delay, &covariance.rej);
Example
- Full source:
src/examples/ex_mne_api/main.cpp - Build target:
ex_mne_api(runs under CTest)
Used in examples
ex_mne_api
MNE library: BEM surfaces, surface projection, ICP, source spaces and epochs.
src/examples/ex_mne_api/main.cpp, line 406
" }\n"
"}\n");
covDescFile.close();
CovDescription covariance;
MNEDescriptionParser::parseCovarianceFile(covDescPath, covariance);
covariance.rej.megGradReject = covariance.rej.megMagReject = covariance.rej.eogReject = 0.0f; // EEG limit only
const CovDefinition& preStim = covariance.defs.first();
const FiffCov noiseCov = FiffCov::compute_from_epochs(raw, events.events, {1, 2}, preStim.tmin, preStim.tmax, preStim.bmin, preStim.bmax, preStim.doBaseline,
covariance.removeSampleMean, preStim.ignore, preStim.delay, &covariance.rej);
// mne.compute_covariance(mne.Epochs(event_id=[1, 2], tmin=-0.2, tmax=0, baseline=None, reject=dict(eeg=14.23e-9)),
// keep_sample_mean=False, rank="full"): 6 of 12 epochs kept, nfree 365, C[EEG001, EEG001] = 8.784207369943824e-18
const int eeg001 = noiseCov.names.indexOf("EEG001");
ok &= expect(preStim.events == QVector<unsigned int>({1, 2}) && noiseCov.nfree == 365 && near(noiseCov.data(eeg001, eeg001), 8.784207369943824e-18, 1e-6),
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>