AverageDescription
Namespace: FIFFLIB · Library: FIFF Library
#include <fiff/fiff_evoked_set.h>
struct FIFFLIB::AverageDescription
Top-level MNE-C ave-description record: comment, category list, shared rejection limits and output file paths.
Port of aveDataRec from MNE-C browser_types.h. Owns the list of AverageCategory entries, the shared RejectionParams, the skew-correction flag and the I/O paths (output ave file, event source, log file) so an entire batch-averaging job can be described as one value.
src/examples/ex_mne_api/main.cpp
// An MNE-C averaging description (mne_process_raw --ave), parsed and run on the raw recording
const QString aveDesc = tmp.filePath("audvis.ave");
QFile descFile(aveDesc);
ok &= descFile.open(QIODevice::WriteOnly | QIODevice::Text);
descFile.write("average {\n"
" category {\n"
" name \"Left Auditory\"\n"
" event 1\n"
" tmin -0.1\n"
" tmax 0.3\n"
" bmin -0.1\n"
" bmax 0.0\n"
" }\n"
"}\n");
descFile.close();
AverageDescription averaging;
MNEDescriptionParser::parseAverageFile(aveDesc, averaging);
const AverageCategory& leftCategory = averaging.categories.first(); // name, events, tmin/tmax, baseline
const RejectionParams& rejection = averaging.rej; // MNE-C defaults unless the file sets them (EEG 100 uV, ...)
QString log;
const FiffEvokedSet averages = FiffEvokedSet::computeAverages(raw, averaging, events.events, log);
Example
- Full source:
src/examples/ex_mne_api/main.cpp - Build target:
ex_mne_api(runs under CTest) - Data: mne-cpp-test-data
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 379
" }\n"
"}\n");
descFile.close();
AverageDescription averaging;
MNEDescriptionParser::parseAverageFile(aveDesc, averaging);
const AverageCategory& leftCategory = averaging.categories.first(); // name, events, tmin/tmax, baseline
const RejectionParams& rejection = averaging.rej; // MNE-C defaults unless the file sets them (EEG 100 uV, ...)
QString log;
const FiffEvokedSet averages = FiffEvokedSet::computeAverages(raw, averaging, events.events, log);
// mne.Epochs(event_id=1, tmin=-0.1, tmax=0.3, baseline=(-0.1, 0)).average(): 6 epochs, |MEG| 2.01258e-13, EEG 001 at 0 s 7.77233e-10
const bool averaged = averaging.categories.size() == 1 && leftCategory.doBaseline && leftCategory.comment == "Left Auditory" && leftCategory.events == QVector<unsigned int>{1} && rejection.eegReject == 100e-6f && averages.evoked.size() == 1;
ok &= expect(averaged && averages.evoked[0].nave == 6 && averages.evoked[0].data.cols() == 121 && near(averages.evoked[0].data.topRows(306).norm(), 2.0125814419559757e-13, 1e-5) && near(averages.evoked[0].data(315, 30), 7.77233498919796e-10, 1e-5),
"MNEDescriptionParser: an .ave description averages like mne.Epochs with a baseline");
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>
- Florian Schlembach <fschlembach@web.de>
- Lorenz Esch <lorenz.esch@tu-ilmenau.de>
- Gabriel Motta <gabrielbenmotta@gmail.com>
- Juan GPC <jgarciaprieto@mgh.harvard.edu>