FiffEvoked
Namespace: FIFFLIB · Library: FIFF Library
mne.Evoked in MNE-Python.
#include <fiff/fiff_evoked.h>
class FIFFLIB::FiffEvoked
Single averaged evoked response: time axis, data, baseline, channel info and averaging metadata.
Holds one FIFFB_EVOKED block: times, data, first / last sample indices, baseline, kind, nave, comment and the FiffInfo describing the channels. Use FiffEvokedSet for recordings that contain multiple averaging conditions.
QFile aveFile(dir + "/sample_audvis-ave.fif");
FiffEvokedSet evokedSet(aveFile); // all conditions of an -ave.fif file
const FiffEvoked& leftAuditory = evokedSet.evoked[0];
Public Methods
FiffEvoked()
Constructs a fiff evoked data.
FiffEvoked(p_IODevice, setno, t_baseline, proj, p_aspect_kind)
Constructs fiff evoked data, by reading from a IO device.
Parameters:
-
p_IODevice : QIODevice & IO device to read from the evoked data set.
-
setno : QVariant The set to pick. Dataset ID number (int) or comment/name (str). Optional if there isonly one data set in file.
-
t_baseline : QPair< float, float > The time interval to apply rescaling / baseline correction. If None do not apply it. If baseline is (a, b). the interval is between "a (s)" and "b (s)". If a is None the beginning of the data is used and if b is None then b is set to the end of the interval. If baseline is equal ot (None, None) all the time interval is used. If None, no correction is applied.
-
proj : bool Apply SSP projection vectors (optional, default = true).
-
p_aspect_kind : fiff_int_t Either "FIFFV_ASPECT_AVERAGE" or "FIFFV_ASPECT_STD_ERR". The type of data to read. Only used if "setno" is a str.
FiffEvoked(p_FiffEvoked)
Copy constructor.
Parameters:
- p_FiffEvoked : const FiffEvoked &
Fiffevoked data which should be copied.
operator=(other)
Copy assignment.
Every member has value semantics, so the compiler-generated member-wise assignment is correct. It is declared explicitly because declaring a copy constructor and/or a destructor deprecates the implicitly generated one.
Parameters:
- other : const FiffEvoked & Object to assign from.
Returns:
- FiffEvoked & — reference to this object.
~FiffEvoked()
Destroys the FiffEvoked.
ch_names()
Returns list of channel names stored in fiff info -> this is to stay consistent with python.
Returns:
- QStringList — List of channel names.
clear()
Initializes fiff evoked data.
aspectKindToString()
Provides the python Evoked string formatted aspect_kind, which is stored in kind: "average" <-> FIFFV_ASPECT_AVERAGE, "standard_error" <-> FIFFV_ASPECT_STD_ERR or "unknown".
Returns:
- QString — string formatted aspect_kind.
isEmpty()
Returns whether FiffEvoked is empty.
Returns:
- bool — true if is empty, false otherwise.
pick_channels(include, exclude)
fiff_pick_channels_evoked
Pick desired channels from evoked-response data
Parameters:
-
include : const QStringList &
- Channels to include (if empty, include all available).
-
exclude : const QStringList &
- Channels to exclude (if empty, do not exclude any).
Returns:
- FiffEvoked — the desired fiff evoked data.
setInfo(p_info, applyProj)
Set a new fiff measurement info.
Parameters:
-
p_info : const FiffInfo & Info to set.
-
applyProj : bool Apply SSP projection vectors (optional, default = true).
operator+=(newData)
Inputs a new data set and recalculates the average.
This function also iterates the nave parameter by one.
Parameters:
- newData : const Eigen::MatrixXd & the new data set which is to be added to the current average.
Returns:
- FiffEvoked & — the updated
FiffEvoked.
applyBaselineCorrection(p_baseline)
Applies baseline correction to the evoked data.
Parameters:
- p_baseline : QPair< float, float > & time definition of the baseline in seconds [from, to].
Static Methods
read(p_IODevice, p_FiffEvoked, setno, t_baseline, proj, p_aspect_kind)
fiff_read_evoked
Wrapper for the FiffEvokedDataSet::read_evoked static function
Read one evoked data set
Parameters:
-
p_IODevice : QIODevice & An fiff IO device like a fiff QFile or QTCPSocket.
-
p_FiffEvoked : FiffEvoked & The read evoked data.
-
setno : QVariant the set to pick. Dataset ID number (int) or comment/name (str). Optional if there isonly one data set in file.
-
t_baseline : QPair< float, float > The time interval to apply rescaling / baseline correction. If None do not apply it. If baseline is (a, b). the interval is between "a (s)" and "b (s)". If a is None the beginning of the data is used and if b is None then b is set to the end of the interval. If baseline is equal ot (None, None) all the time interval is used. If None, no correction is applied.
-
proj : bool Apply SSP projection vectors (optional, default = true).
-
p_aspect_kind : fiff_int_t Either "FIFFV_ASPECT_AVERAGE" or "FIFFV_ASPECT_STD_ERR". The type of data to read. Only used if "setno" is a str.
Returns:
- bool — true if successful, false otherwise.
combine(evokeds, weights)
Merges evoked data by weighted addition or subtraction (mne.combine_evoked).
All data sets must have the same channels and time instants. The result carries the union of the bad channels, the weighted sum of the data, a comment such as "0.474 × A + 0.526 × B" and nave = 1 / sum(w_i^2 / nave_i), rounded to an integer as required by the FIFF format.
Parameters:
-
evokeds : const QList< FiffEvoked > & The evoked data sets.
-
weights : const Eigen::VectorXd & One weight per data set.
Returns:
- FiffEvoked — The combined evoked data, or an empty
FiffEvokedif the inputs are inconsistent.
combine(evokeds, weights)
Merges evoked data with a predefined weighting strategy (weights="nave" or "equal").
Parameters:
-
evokeds : const QList< FiffEvoked > & The evoked data sets.
-
weights : CombineWeights The weighting strategy.
Returns:
- FiffEvoked — The combined evoked data, or an empty
FiffEvokedif the inputs are inconsistent.
Example
- Full source:
src/examples/ex_fiff_api/main.cpp - Build target:
ex_fiff_api(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_clustered_inverse_pwl_rap_music_raw
Example of the computation of a raw clustered inverse Powell RAP-MUSIC.
FiffEvoked evoked = data.average(raw.info, tmin * raw.info.sfreq, floor(tmax * raw.info.sfreq + 0.5), vecSel);
ex_clustered_inverse_rap_music_raw
Example of the computation of a raw clustered inverse rap music.
FiffEvoked evoked = data.average(raw.info, tmin * raw.info.sfreq, floor(tmax * raw.info.sfreq + 0.5), vecSel);
ex_fiff_api
FIFF library: measurement info, channels, digitizer, transforms, projectors, covariance, events,.
QFile aveFile(dir + "/sample_audvis-ave.fif");
FiffEvokedSet evokedSet(aveFile); // all conditions of an -ave.fif file
const FiffEvoked& leftAuditory = evokedSet.evoked[0];
// mne.read_evokeds: 4 conditions, "Left Auditory" nave 55, 376 x 421 samples starting at -0.1998 s
ok &= expect(evokedSet.evoked.size() == 4 && leftAuditory.comment == "Left Auditory" && leftAuditory.nave == 55 && leftAuditory.data.cols() == 421 && std::fabs(leftAuditory.times(0) + 0.19979521f) < 1e-6f,
"FiffEvokedSet/FiffEvoked: 4 conditions; Left Auditory averages 55 epochs over 421 samples");
Also used in ex_inv_beamformer, ex_inverse_pwl_rap_music, ex_inverse_rap_music, ex_mne_api, ex_averaging, ex_clustered_inverse_mne, ex_clustered_inverse_mne_raw, ex_connectivity, ex_connectivity_comparison, ex_disp_3D, ex_dsp_rt, ex_fiff_structure, ex_histogram, ex_interpolation, ex_inv_api, ex_inv_dipole_fit, ex_inverse_mne, ex_inverse_mne_raw, ex_make_inverse_operator, ex_read_evoked, ex_tf_plot.
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>