v2.0.0
Loading...
Searching...
No Matches
spectral.h
Go to the documentation of this file.
1//=============================================================================================================
33
34#ifndef SPECTRAL_H
35#define SPECTRAL_H
36
37//=============================================================================================================
38// INCLUDES
39//=============================================================================================================
40
41#include "math_global.h"
42
43#include <vector>
44#include <utility>
45
46//=============================================================================================================
47// EIGEN INCLUDES
48//=============================================================================================================
49
50#include <Eigen/Core>
51
52//=============================================================================================================
53// QT INCLUDES
54//=============================================================================================================
55
56#include <QString>
57#include <QPair>
58#include <QSharedPointer>
59
60//=============================================================================================================
61// DEFINE NAMESPACE UTILSLIB
62//=============================================================================================================
63
64namespace UTILSLIB
65{
66
71 Eigen::RowVectorXd vecData;
72 Eigen::MatrixXd matTaper;
73 int iNfft;
74};
75
76//=============================================================================================================
86{
87
88public:
89 //=========================================================================================================
93 Spectral() = delete;
94
95 //=========================================================================================================
105 static Eigen::MatrixXcd computeTaperedSpectraRow(const Eigen::RowVectorXd &vecData,
106 const Eigen::MatrixXd &matTaper,
107 int iNfft);
108
109 //=========================================================================================================
120 static QVector<Eigen::MatrixXcd> computeTaperedSpectraMatrix(const Eigen::MatrixXd &matData,
121 const Eigen::MatrixXd &matTaper,
122 int iNfft,
123 bool bUseThreads = true);
124
125 //=========================================================================================================
133 static Eigen::MatrixXcd compute(const TaperedSpectraInputData& inputData);
134
135 //=========================================================================================================
142 static void reduce(QVector<Eigen::MatrixXcd>& finalData,
143 const Eigen::MatrixXcd& resultData);
144
145 //=========================================================================================================
156 static Eigen::RowVectorXd psdFromTaperedSpectra(const Eigen::MatrixXcd &matTapSpectrum,
157 const Eigen::VectorXd &vecTapWeights,
158 int iNfft,
159 double dSampFreq=1.0);
160
161 //=========================================================================================================
174 static Eigen::RowVectorXcd csdFromTaperedSpectra(const Eigen::MatrixXcd &vecTapSpectrumSeed,
175 const Eigen::MatrixXcd &vecTapSpectrumTarget,
176 const Eigen::VectorXd &vecTapWeightsSeed,
177 const Eigen::VectorXd &vecTapWeightsTarget,
178 int iNfft,
179 double dSampFreq = 1.0);
180
181 //=========================================================================================================
190 static Eigen::VectorXd calculateFFTFreqs(int iNfft, double dSampFreq);
191
192 //=========================================================================================================
201 static QPair<Eigen::MatrixXd, Eigen::VectorXd> generateTapers(int iSignalLength,
202 const QString &sWindowType = "hanning");
203
204 //=========================================================================================================
213 static std::pair<Eigen::MatrixXd, Eigen::VectorXd> generateTapers(int iSignalLength,
214 const std::string &sWindowType = "hanning");
215
216private:
217 //=========================================================================================================
225 static Eigen::MatrixXd hanningWindow(int iSignalLength);
226};
227
228//=============================================================================================================
229// INLINE DEFINITIONS
230//=============================================================================================================
231}//namespace
232
233#endif // SPECTRAL_H
Export/import macros and build-stamp accessors for MATHLIB.
#define MATHSHARED_EXPORT
Definition math_global.h:51
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
Per-row input bundle for parallel multi-taper spectral estimation (data row, taper matrix,...
Definition spectral.h:70
Eigen::RowVectorXd vecData
Definition spectral.h:71
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)
Definition spectral.cpp:202
static QVector< Eigen::MatrixXcd > computeTaperedSpectraMatrix(const Eigen::MatrixXd &matData, const Eigen::MatrixXd &matTaper, int iNfft, bool bUseThreads=true)
Definition spectral.cpp:86
static Eigen::RowVectorXd psdFromTaperedSpectra(const Eigen::MatrixXcd &matTapSpectrum, const Eigen::VectorXd &vecTapWeights, int iNfft, double dSampFreq=1.0)
Definition spectral.cpp:176
static QPair< Eigen::MatrixXd, Eigen::VectorXd > generateTapers(int iSignalLength, const QString &sWindowType="hanning")
Definition spectral.cpp:270
static Eigen::MatrixXcd compute(const TaperedSpectraInputData &inputData)
Definition spectral.cpp:157
static Eigen::MatrixXcd computeTaperedSpectraRow(const Eigen::RowVectorXd &vecData, const Eigen::MatrixXd &matTaper, int iNfft)
Definition spectral.cpp:58
static Eigen::VectorXd calculateFFTFreqs(int iNfft, double dSampFreq)
Definition spectral.cpp:256
static void reduce(QVector< Eigen::MatrixXcd > &finalData, const Eigen::MatrixXcd &resultData)
Definition spectral.cpp:167