v2.0.0
Loading...
Searching...
No Matches
FIFFLIB::FiffCov Class Reference

covariance data More...

#include <fiff_cov.h>

Public Types

typedef QSharedPointer< FiffCovSPtr
typedef QSharedPointer< const FiffCovConstSPtr
typedef QSharedDataPointer< FiffCovSDPtr

Public Member Functions

 FiffCov ()
 FiffCov (QIODevice &p_IODevice)
 FiffCov (const FiffCov &p_FiffCov)
 ~FiffCov ()
void clear ()
bool isEmpty () const
FiffCov pick_channels (const QStringList &p_include=defaultQStringList, const QStringList &p_exclude=defaultQStringList)
FiffCov prepare_noise_cov (const FiffInfo &p_info, const QStringList &p_chNames) const
FiffCov regularize (const FiffInfo &p_info, double p_fMag=0.1, double p_fGrad=0.1, double p_fEeg=0.1, bool p_bProj=true, QStringList p_exclude=defaultQStringList) const
bool save (const QString &fileName) const
FiffCovoperator= (const FiffCov &rhs)

Static Public Member Functions

static FiffCov compute_from_epochs (const FiffRawData &raw, const Eigen::MatrixXi &events, const QList< int > &eventCodes, float tmin, float tmax, float bmin=0.0f, float bmax=0.0f, bool doBaseline=false, bool removeMean=true, unsigned int ignoreMask=0, float delay=0.0f)
static FiffCov computeGrandAverage (const QList< FiffCov > &covs)

Public Attributes

fiff_int_t kind
Eigen::VectorXi chClass
bool diag
fiff_int_t dim
QStringList names
Eigen::MatrixXd data
QList< FiffProjprojs
QStringList bads
fiff_int_t nfree
Eigen::VectorXd eig
Eigen::MatrixXd eigvec

Friends

std::ostream & operator<< (std::ostream &out, const FIFFLIB::FiffCov &p_FiffCov)

Detailed Description

covariance data

Fiff cov data, which corresponds to a covariance data matrix

Definition at line 83 of file fiff_cov.h.

Inheritance diagram for FIFFLIB::FiffCov:
Inheritance graph

Member Typedef Documentation

◆ ConstSPtr

typedef QSharedPointer<const FiffCov> FIFFLIB::FiffCov::ConstSPtr

Const shared pointer type for FiffCov.

Definition at line 87 of file fiff_cov.h.

◆ SDPtr

typedef QSharedDataPointer<FiffCov> FIFFLIB::FiffCov::SDPtr

Shared data pointer type for FiffCov.

Definition at line 88 of file fiff_cov.h.

◆ SPtr

typedef QSharedPointer<FiffCov> FIFFLIB::FiffCov::SPtr

Shared pointer type for FiffCov.

Definition at line 86 of file fiff_cov.h.

Constructor & Destructor Documentation

◆ FiffCov() [1/3]

FiffCov::FiffCov ( )

Constructs the covariance data matrix.

Definition at line 75 of file fiff_cov.cpp.

◆ FiffCov() [2/3]

FiffCov::FiffCov ( QIODevice & p_IODevice)

Constructs a covariance data matrix, by reading from a IO device.

Parameters
[in]p_IODeviceIO device to read from the evoked data set.

Definition at line 87 of file fiff_cov.cpp.

◆ FiffCov() [3/3]

FiffCov::FiffCov ( const FiffCov & p_FiffCov)

Copy constructor.

Parameters
[in]p_FiffCovCovariance data matrix which should be copied.

Definition at line 110 of file fiff_cov.cpp.

◆ ~FiffCov()

FiffCov::~FiffCov ( )

Destroys the covariance data matrix.

Definition at line 129 of file fiff_cov.cpp.

Member Function Documentation

◆ clear()

void FiffCov::clear ( )

Initializes the covariance data matrix.

Definition at line 135 of file fiff_cov.cpp.

◆ compute_from_epochs()

FiffCov FiffCov::compute_from_epochs ( const FiffRawData & raw,
const Eigen::MatrixXi & events,
const QList< int > & eventCodes,
float tmin,
float tmax,
float bmin = 0.0f,
float bmax = 0.0f,
bool doBaseline = false,
bool removeMean = true,
unsigned int ignoreMask = 0,
float delay = 0.0f )
static

Compute a noise covariance matrix from raw data based on event-locked epochs. Ported from compute_cov.c (MNE-C).

Parameters
[in]rawThe raw data.
[in]eventsEvent matrix (nEvents x 3): [sample, before, after].
[in]eventCodesWhich event codes to include.
[in]tminStart of time window relative to event (seconds).
[in]tmaxEnd of time window relative to event (seconds).
[in]bminBaseline start (seconds, relative to event). Only used if doBaseline is true.
[in]bmaxBaseline end (seconds, relative to event). Only used if doBaseline is true.
[in]doBaselineWhether to apply baseline correction before covariance computation.
[in]removeMeanWhether to remove sample mean from the covariance estimate.
[in]ignoreMaskBit mask ANDed away from event codes before matching (default: 0 = no masking).
[in]delayDelay in seconds applied to the event sample before extracting the epoch (default: 0).
Returns
The computed noise covariance matrix, or empty FiffCov on failure.

Definition at line 486 of file fiff_cov.cpp.

◆ computeGrandAverage()

FiffCov FiffCov::computeGrandAverage ( const QList< FiffCov > & covs)
static

Compute a weighted grand-average covariance from multiple covariance matrices, weighting each by its degrees of freedom (nfree).

Parameters
[in]covsList of covariance matrices to combine.
Returns
The grand-average covariance matrix, or empty FiffCov if covs is empty.

Definition at line 627 of file fiff_cov.cpp.

◆ isEmpty()

bool FIFFLIB::FiffCov::isEmpty ( ) const
inline

True if FIFF covariance is empty.

Returns
true if FIFF covariance is empty.

Definition at line 264 of file fiff_cov.h.

◆ operator=()

FiffCov & FiffCov::operator= ( const FiffCov & rhs)

Assignment Operator

Parameters
[in]rhsFiffCov which should be assigned.
Returns
the copied covariance matrix.

Definition at line 465 of file fiff_cov.cpp.

◆ pick_channels()

FiffCov FiffCov::pick_channels ( const QStringList & p_include = defaultQStringList,
const QStringList & p_exclude = defaultQStringList )

python pick_channels_cov

Pick channels from covariance matrix

Parameters
[in]p_includeList of channels to include (if empty, include all available). (optional).
[in]p_excludeChannels to exclude (if empty, do not exclude any). (optional).
Returns
Covariance solution restricted to selected channels.

Definition at line 151 of file fiff_cov.cpp.

◆ prepare_noise_cov()

FiffCov FiffCov::prepare_noise_cov ( const FiffInfo & p_info,
const QStringList & p_chNames ) const

Prepare noise covariance matrix. Before creating inverse operator.

Parameters
[in]p_infomeasurement info.
[in]p_chNamesChannels which should be taken into account.
Returns
the prepared noise covariance matrix.

Definition at line 179 of file fiff_cov.cpp.

◆ regularize()

FiffCov FiffCov::regularize ( const FiffInfo & p_info,
double p_fMag = 0.1,
double p_fGrad = 0.1,
double p_fEeg = 0.1,
bool p_bProj = true,
QStringList p_exclude = defaultQStringList ) const

Regularize noise covariance matrix

This method works by adding a constant to the diagonal for each channel type separatly. Special care is taken to keep the rank of the data constant.

Parameters
[in]p_infoThe measurement info (used to get channel types and bad channels).
[in]p_fMagRegularization factor for MEG magnetometers.
[in]p_fGradRegularization factor for MEG gradiometers.
[in]p_fEegRegularization factor for EEG.
[in]p_bProjApply or not projections to keep rank of data.
[in]p_excludeList of channels to mark as bad. If None, bads channels are extracted from both info['bads'] and cov['bads'].
Returns
the regularized covariance matrix.

Definition at line 326 of file fiff_cov.cpp.

◆ save()

bool FiffCov::save ( const QString & fileName) const

Save this covariance matrix to a FIFF file.

Parameters
[in]fileNameOutput file path.
Returns
true on success.

Definition at line 601 of file fiff_cov.cpp.

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const FIFFLIB::FiffCov & p_FiffCov )
friend

overloading the stream out operator<<

Parameters
[in]outThe stream to which the fiff covariance should be assigned to.
[in]p_FiffCovFiffCov which should be assigned to the stream.
Returns
the stream with the attached fiff covariance matrix.

Definition at line 271 of file fiff_cov.h.

Member Data Documentation

◆ bads

QStringList FIFFLIB::FiffCov::bads

List of bad channels.

Definition at line 253 of file fiff_cov.h.

◆ chClass

Eigen::VectorXi FIFFLIB::FiffCov::chClass

Channel classification vector.

Definition at line 247 of file fiff_cov.h.

◆ data

Eigen::MatrixXd FIFFLIB::FiffCov::data

Covariance data.

Definition at line 251 of file fiff_cov.h.

◆ diag

bool FIFFLIB::FiffCov::diag

If the covariance is stored in a diagonal order.

Definition at line 248 of file fiff_cov.h.

◆ dim

fiff_int_t FIFFLIB::FiffCov::dim

Dimension of the covariance (dim x dim).

Definition at line 249 of file fiff_cov.h.

◆ eig

Eigen::VectorXd FIFFLIB::FiffCov::eig

Vector of eigenvalues.

Definition at line 255 of file fiff_cov.h.

◆ eigvec

Eigen::MatrixXd FIFFLIB::FiffCov::eigvec

Matrix of eigenvectors (each row represents an eigenvector).

Definition at line 256 of file fiff_cov.h.

◆ kind

fiff_int_t FIFFLIB::FiffCov::kind

Covariance kind -> fiff_constants.h.

Definition at line 246 of file fiff_cov.h.

◆ names

QStringList FIFFLIB::FiffCov::names

Channel names.

Definition at line 250 of file fiff_cov.h.

◆ nfree

fiff_int_t FIFFLIB::FiffCov::nfree

Number of degrees of freedom.

Definition at line 254 of file fiff_cov.h.

◆ projs

QList<FiffProj> FIFFLIB::FiffCov::projs

List of available ssp projectors.

Definition at line 252 of file fiff_cov.h.


The documentation for this class was generated from the following files: