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{
72 Eigen::RowVectorXd vecData;
73 Eigen::MatrixXd matTaper;
74 int iNfft;
75};
76
77//=============================================================================================================
89{
90public:
91 //=========================================================================================================
95 Spectral() = delete;
96
97 //=========================================================================================================
107 static Eigen::MatrixXcd computeTaperedSpectraRow(const Eigen::RowVectorXd& vecData,
108 const Eigen::MatrixXd& matTaper,
109 int iNfft);
110
111 //=========================================================================================================
122 static QVector<Eigen::MatrixXcd> computeTaperedSpectraMatrix(const Eigen::MatrixXd& matData,
123 const Eigen::MatrixXd& matTaper,
124 int iNfft,
125 bool bUseThreads = true);
126
127 //=========================================================================================================
135 static Eigen::MatrixXcd compute(const TaperedSpectraInputData& inputData);
136
137 //=========================================================================================================
144 static void reduce(QVector<Eigen::MatrixXcd>& finalData,
145 const Eigen::MatrixXcd& resultData);
146
147 //=========================================================================================================
158 static Eigen::RowVectorXd psdFromTaperedSpectra(const Eigen::MatrixXcd& matTapSpectrum,
159 const Eigen::VectorXd& vecTapWeights,
160 int iNfft,
161 double dSampFreq = 1.0);
162
163 //=========================================================================================================
176 static Eigen::RowVectorXcd csdFromTaperedSpectra(const Eigen::MatrixXcd& vecTapSpectrumSeed,
177 const Eigen::MatrixXcd& vecTapSpectrumTarget,
178 const Eigen::VectorXd& vecTapWeightsSeed,
179 const Eigen::VectorXd& vecTapWeightsTarget,
180 int iNfft,
181 double dSampFreq = 1.0);
182
183 //=========================================================================================================
192 static Eigen::VectorXd calculateFFTFreqs(int iNfft, double dSampFreq);
193
194 //=========================================================================================================
203 static QPair<Eigen::MatrixXd, Eigen::VectorXd> generateTapers(int iSignalLength,
204 const QString& sWindowType = "hanning");
205
206 //=========================================================================================================
215 static std::pair<Eigen::MatrixXd, Eigen::VectorXd> generateTapers(int iSignalLength,
216 const std::string& sWindowType = "hanning");
217
218private:
219 //=========================================================================================================
227 static Eigen::MatrixXd hanningWindow(int iSignalLength);
228};
229
230//=============================================================================================================
231// INLINE DEFINITIONS
232//=============================================================================================================
233} //namespace
234
235#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:71
Eigen::RowVectorXd vecData
Definition spectral.h:72
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