MNE-CPP  0.1.9
A Framework for Electrophysiology
Public Member Functions | Static Public Member Functions | List of all members
UTILSLIB::Spectral Class Reference

Computes spectral measures of input data. More...

#include <spectral.h>

Public Member Functions

 Spectral ()=delete
 

Static Public Member Functions

static Eigen::MatrixXcd computeTaperedSpectraRow (const Eigen::RowVectorXd &vecData, const Eigen::MatrixXd &matTaper, int iNfft)
 
static QVector< Eigen::MatrixXcd > computeTaperedSpectraMatrix (const Eigen::MatrixXd &matData, const Eigen::MatrixXd &matTaper, int iNfft, bool bUseThreads=true)
 
static Eigen::MatrixXcd compute (const TaperedSpectraInputData &inputData)
 
static void reduce (QVector< Eigen::MatrixXcd > &finalData, const Eigen::MatrixXcd &resultData)
 
static Eigen::RowVectorXd psdFromTaperedSpectra (const Eigen::MatrixXcd &matTapSpectrum, const Eigen::VectorXd &vecTapWeights, int iNfft, double dSampFreq=1.0)
 
static Eigen::RowVectorXcd csdFromTaperedSpectra (const Eigen::MatrixXcd &vecTapSpectrumSeed, const Eigen::MatrixXcd &vecTapSpectrumTarget, const Eigen::VectorXd &vecTapWeightsSeed, const Eigen::VectorXd &vecTapWeightsTarget, int iNfft, double dSampFreq=1.0)
 
static Eigen::VectorXd calculateFFTFreqs (int iNfft, double dSampFreq)
 
static QPair< Eigen::MatrixXd, Eigen::VectorXd > generateTapers (int iSignalLength, const QString &sWindowType="hanning")
 
static std::pair< Eigen::MatrixXd, Eigen::VectorXd > generateTapers (int iSignalLength, const std::string &sWindowType="hanning")
 

Detailed Description

Computes spectral measures of input data.

Computes spectral measures of input data such as spectra, power spectral density, cross-spectral density.

Definition at line 85 of file spectral.h.

Constructor & Destructor Documentation

◆ Spectral()

UTILSLIB::Spectral::Spectral ( )
delete

deleted default constructor (static class).

Member Function Documentation

◆ calculateFFTFreqs()

VectorXd Spectral::calculateFFTFreqs ( int  iNfft,
double  dSampFreq 
)
static

Calculates the FFT frequencies

Parameters
[in]iNfftFFT length.
[in]dSampFreqsampling frequency of the input data.
Returns
FFT frequencies.

Definition at line 278 of file spectral.cpp.

◆ compute()

MatrixXcd Spectral::compute ( const TaperedSpectraInputData inputData)
static

Computes the tapered spectra for a row vector. This function gets called in parallel.

Parameters
[in]inputDataThe input data.
Returns
The tapered spectra for one data row.

Definition at line 171 of file spectral.cpp.

◆ computeTaperedSpectraMatrix()

QVector< MatrixXcd > Spectral::computeTaperedSpectraMatrix ( const Eigen::MatrixXd &  matData,
const Eigen::MatrixXd &  matTaper,
int  iNfft,
bool  bUseThreads = true 
)
static

Calculates the full tapered spectra of a given input matrix data. This function calculates each row in parallel.

Parameters
[in]matDatainput matrix data (time domain), for which the spectrum is computed.
[in]matTapertapers used to compute the spectra.
[in]iNfftFFT length.
[in]bUseThreadsWhether to use multiple threads.
Returns
tapered spectra of the input data.

Definition at line 100 of file spectral.cpp.

◆ computeTaperedSpectraRow()

MatrixXcd Spectral::computeTaperedSpectraRow ( const Eigen::RowVectorXd &  vecData,
const Eigen::MatrixXd &  matTaper,
int  iNfft 
)
static

Calculates the full tapered spectra of a given input row data

Parameters
[in]vecDatainput roww data (time domain), for which the spectrum is computed.
[in]matTapertapers used to compute the spectra.
[in]iNfftFFT length.
Returns
tapered spectra of the input data.

Definition at line 72 of file spectral.cpp.

◆ csdFromTaperedSpectra()

Eigen::RowVectorXcd Spectral::csdFromTaperedSpectra ( const Eigen::MatrixXcd &  vecTapSpectrumSeed,
const Eigen::MatrixXcd &  vecTapSpectrumTarget,
const Eigen::VectorXd &  vecTapWeightsSeed,
const Eigen::VectorXd &  vecTapWeightsTarget,
int  iNfft,
double  dSampFreq = 1.0 
)
static

Calculates the cross-spectral density of the tapered spectra of seed and target

Parameters
[in]vecTapSpectrumSeedtapered spectrum of the seed.
[in]vecTapSpectrumTargettapered spectrum of the target.
[in]vecTapWeightsSeedtaper weights of the seed.
[in]vecTapWeightsTargettaper weights of the target.
[in]iNfftFFT length.
[in]dSampFreqsampling frequency of the input data.
Returns
cross-spectral density of the tapered spectra of seed and target.

Definition at line 224 of file spectral.cpp.

◆ generateTapers() [1/2]

QPair< MatrixXd, VectorXd > Spectral::generateTapers ( int  iSignalLength,
const QString &  sWindowType = "hanning" 
)
static

Calculates a hanning window of given length

Parameters
[in]iSignalLengthlength of the hanning window.
[in]sWindowTypetype of the window function used to compute tapered spectra.
Returns
Qpair of tapers and taper weights.

Definition at line 292 of file spectral.cpp.

◆ generateTapers() [2/2]

std::pair< MatrixXd, VectorXd > Spectral::generateTapers ( int  iSignalLength,
const std::string &  sWindowType = "hanning" 
)
static

Calculates a hanning window of given length

Parameters
[in]iSignalLengthlength of the hanning window.
[in]sWindowTypetype of the window function used to compute tapered spectra.
Returns
Qpair of tapers and taper weights.

Definition at line 310 of file spectral.cpp.

◆ psdFromTaperedSpectra()

Eigen::RowVectorXd Spectral::psdFromTaperedSpectra ( const Eigen::MatrixXcd &  matTapSpectrum,
const Eigen::VectorXd &  vecTapWeights,
int  iNfft,
double  dSampFreq = 1.0 
)
static

Calculates the power spectral density of given tapered spectrum

Parameters
[in]vecTapSpectrumtapered spectrum, for which the PSD is calculated.
[in]vecTapWeightstaper weights.
[in]iNfftFFT length.
[in]dSampFreqsampling frequency of the input data.
Returns
power spectral density of a given tapered spectrum.

Definition at line 198 of file spectral.cpp.

◆ reduce()

void Spectral::reduce ( QVector< Eigen::MatrixXcd > &  finalData,
const Eigen::MatrixXcd &  resultData 
)
static

Reduces the taperedSpectra results to a final result. This function gets called in parallel.

Parameters
[out]finalDataThe final data data.
[in]resultDataThe resulting data from the computation step.

Definition at line 181 of file spectral.cpp.


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