|
mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
Tools for working with PSDs. More...
Tools for working with PSDs.
Definition in file psdUtils.hpp.
#include <type_traits>#include <Eigen/Dense>#include <iostream>#include "../mxlib.hpp"#include "../math/ft/fftT.hpp"#include "../math/vectorUtils.hpp"Go to the source code of this file.
Namespaces | |
| namespace | mx |
| The mxlib c++ namespace. | |
Functions | |
| template<typename realT> | |
| realT | mx::sigproc::psdVar1sided (realT df, const realT *PSD, size_t sz, realT half=0.5) |
| Calculate the variance of a 1-D, 1-sided PSD. | |
| template<typename realT> | |
| realT | mx::sigproc::psdVar2sided (realT df, const realT *PSD, size_t sz, realT half=0.5) |
| Calculate the variance of a 1-D, 2-sided PSD. | |
| template<typename realT> | |
| realT | mx::sigproc::psdVar (const std::vector< realT > &f, const std::vector< realT > &PSD, realT half=0.5) |
| Calculate the variance of a 1-D PSD. | |
| template<typename eigenArrT> | |
| eigenArrT::Scalar | mx::sigproc::psdVarDisabled (eigenArrT &freq, eigenArrT &PSD, bool trap=true) |
| Calculate the variance of a PSD. | |
| template<class realT> | |
| realT | mx::sigproc::freq_sampling (size_t dim, realT f_max) |
| Calculates the frequency sampling for a grid given maximum dimension and maximum frequency. | |
| template<typename realT, typename realParamT> | |
| int | mx::sigproc::frequencyGrid (std::vector< realT > &vec, realParamT dt, bool fftOrder=true) |
| Create a 1-D frequency grid. | |
| template<typename eigenArr, typename realParamT> | |
| void | mx::sigproc::frequencyGrid (eigenArr &arr, realParamT drT, eigenArr *k_x, eigenArr *k_y) |
| Create a 2-D frequency grid. | |
| template<typename eigenArr> | |
| void | mx::sigproc::frequencyGrid (eigenArr &arr, typename eigenArr::Scalar dt) |
| Create a frequency grid. | |
| template<typename eigenArr> | |
| void | mx::sigproc::frequencyGrid (eigenArr &arr, typename eigenArr::Scalar dt, eigenArr &k_x, eigenArr &k_y) |
| Create a frequency grid. | |
| template<typename realT> | |
| realT | mx::sigproc::oneoverf_norm (realT fmin, realT fmax, realT alpha) |
| Calculate the normalization for a 1-D \( 1/|f|^\alpha \) PSD. | |
| template<typename realT> | |
| realT | mx::sigproc::oneoverk_norm (realT kmin, realT kmax, realT alpha) |
| Calculate the normalization for a 2-D \( 1/|k|^\alpha \) PSD. | |
| template<typename floatT, typename floatParamT> | |
| int | mx::sigproc::normPSD (std::vector< floatT > &psd, std::vector< floatT > &f, floatParamT normT, floatT fmin=std::numeric_limits< floatT >::min(), floatT fmax=std::numeric_limits< floatT >::max()) |
| Normalize a 1-D PSD to have a given variance. | |
| template<typename floatT, typename floatParamT> | |
| floatT | mx::sigproc::normPSD (Eigen::Array< floatT, Eigen::Dynamic, Eigen::Dynamic > &psd, Eigen::Array< floatT, Eigen::Dynamic, Eigen::Dynamic > &k, floatParamT normT, floatT kmin=std::numeric_limits< floatT >::min(), floatT kmax=std::numeric_limits< floatT >::max()) |
| Normalize a 2-D PSD to have a given variance. | |
| template<typename eigenArrp, typename eigenArrf> | |
| void | mx::sigproc::oneoverf_psd (eigenArrp &psd, eigenArrf &freq, typename eigenArrp::Scalar alpha, typename eigenArrp::Scalar beta=-1) |
| Generates a \( 1/|f|^\alpha \) power spectrum. | |
| template<typename floatT, typename floatfT, typename alphaT, typename T0T = double, typename t0T = double, typename betaT = double> | |
| mx::error_t | mx::sigproc::vonKarmanPSD (std::vector< floatT > &psd, std::vector< floatfT > &f, alphaT alpha, T0T T0=0, t0T t0=0, betaT beta=1) |
| Generate a 1-D von Karman power spectrum. | |
| template<typename floatT> | |
| int | mx::sigproc::kneePSD (std::vector< floatT > &psd, std::vector< floatT > &f, floatT beta, floatT fn, floatT alpha) |
| Generate a 1-D "knee" PSD. | |
| template<typename eigenArrp, typename eigenArrf, typename alphaT, typename L0T, typename l0T, typename betaT> | |
| void | mx::sigproc::vonKarmanPSD (eigenArrp &psd, eigenArrf &freq, alphaT alpha, L0T L0=0, l0T l0=0, betaT beta=-1) |
| Generates a von Karman power spectrum. | |
| template<typename vectorTout, typename vectorTin> | |
| void | mx::sigproc::augment1SidedPSD (vectorTout &psdTwoSided, vectorTin &psdOneSided, bool addZeroFreq=false, typename vectorTin::value_type scale=0.5) |
| Augment a 1-sided PSD to standard 2-sided FFT form. | |
| template<typename T> | |
| void | mx::sigproc::augment1SidedPSDFreq (std::vector< T > &freqTwoSided, std::vector< T > &freqOneSided) |
| Augment a 1-sided frequency scale to standard FFT form. | |
| template<typename realT> | |
| int | mx::sigproc::rebin1SidedPSD (std::vector< realT > &binFreq, std::vector< realT > &binPSD, std::vector< realT > &freq, std::vector< realT > &PSD, realT binSize, bool binAtZero=true) |
| Rebin a PSD, including its frequency scale, to a larger frequency bin size (fewer bins). | |