mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
Class to manage the calculation of linear predictor coefficients for a closed-loop AO system.
_realT | the real floating point type in which to do all arithmetic. |
Definition at line 41 of file clAOLinearPredictor.hpp.
#include <ao/analysis/clAOLinearPredictor.hpp>
Public Member Functions | |
int | calcCoefficients (std::vector< realT > &PSDt, std::vector< realT > &PSDn, realT PSDreg, int Nc, realT condition=0) |
Calculate the LP coefficients for a turbulence PSD and a noise PSD. | |
template<bool telem> | |
int | _regularizeCoefficients (realT &min_var, realT &min_sc, realT precision, realT max_sc, clGainOpt< realT > &go_lp, std::vector< realT > &PSDt, std::vector< realT > &PSDn, int Nc) |
Worker function for regularizing the PSD for coefficient calculation. | |
template<bool telem = false> | |
int | regularizeCoefficients (realT &gmax_lp, realT &gopt_lp, realT &var_lp, realT &min_sc, clGainOpt< realT > &go_lp, std::vector< realT > &PSDt, std::vector< realT > &PSDn, int Nc) |
Regularize the PSD and calculate the associated LP coefficients. | |
template<bool printout = false> | |
int | optimizeNc (realT &gmax_lp, realT &gopt_lp, int &Nc, realT &var_lp, clGainOpt< realT > &go_lp, std::vector< realT > &PSDt, std::vector< realT > &PSDn, int minNc, int maxNc) |
Regularize the PSD and calculate the associated LP coefficients. | |
Public Attributes | |
std::vector< realT > | m_PSDtn |
Working memory for the regularized PSD. | |
std::vector< realT > | m_psd2s |
Working memory for the 2-sided regularized PSD. | |
std::vector< realT > | m_ac |
Working memory to hold the autocorrelation. | |
realT | m_gmax_lp { 5 } |
The maximum allowable gain for LP. | |
int | m_extrap {1} |
The LP extrapolation length in loop steps. Normally it is 1 step. | |
|
inline |
Worker function for regularizing the PSD for coefficient calculation.
telem | if true then the results are collected in m_regResults. |
On first call (min_var = 0): loop over scale factors from min_sc to max_sc (<=) in steps of precision.
On subsequent calls, when min_var and min_sc are passed back in loop over scale factors from min_sc-precision to max_sc in steps of
min_var | [in.out] the minimum variance found. Set to 0 on initial call | |
min_sc | [in.out] the scale factor at the minimum variance. | |
[in] | precision | the step-size for the scale factor |
[in] | max_sc | the maximum scale factor to test |
[in] | go_lp | the gain optimization object |
[in] | PSDt | the turbulence PSD |
[in] | PSDn | the WFS noise PSD |
[in] | Nc | the number of coefficients |
Definition at line 133 of file clAOLinearPredictor.hpp.
References mx::AO::analysis::clGainOpt< _realT >::a(), mx::AO::analysis::clGainOpt< _realT >::b(), mx::AO::analysis::clAOLinearPredictor< _realT >::calcCoefficients(), mx::AO::analysis::clAOLinearPredictor< _realT >::m_gmax_lp, mx::AO::analysis::clGainOpt< _realT >::maxStableGain(), and mx::AO::analysis::clGainOpt< _realT >::optGainOpenLoop().
|
inline |
Calculate the LP coefficients for a turbulence PSD and a noise PSD.
This combines the two PSDs, augments to two-sided, and calls the linearPredictor.calcCoefficients method.
A regularization constant can be added to the PSD as well.
[in] | PSDt | the turbulence PSD |
[in] | PSDn | the WFS noise PSD |
[in] | PSDreg | the regularizing constant. Set to 0 to not use. |
[in] | Nc | the number of LP coefficients. |
[in] | condition | the condition number for the SVD. If 0 then levinson recursion is used. |
Definition at line 91 of file clAOLinearPredictor.hpp.
References mx::sigproc::augment1SidedPSD(), mx::sigproc::linearPredictor< _realT >::calcCoefficients(), mx::AO::analysis::clAOLinearPredictor< _realT >::m_ac, mx::AO::analysis::clAOLinearPredictor< _realT >::m_extrap, mx::AO::analysis::clAOLinearPredictor< _realT >::m_psd2s, and mx::AO::analysis::clAOLinearPredictor< _realT >::m_PSDtn.
Referenced by mx::AO::analysis::clAOLinearPredictor< _realT >::_regularizeCoefficients(), and mx::AO::analysis::clAOLinearPredictor< _realT >::regularizeCoefficients().
|
inline |
Regularize the PSD and calculate the associated LP coefficients.
The PSD is regularized by adding a constant to it. This constant is found by minimizing the variance of the residual PSD.
printout | if true then the results are printed to stdout as they are calculated. |
[out] | gmax_lp | the maximum gain calculated for the regularized PSD |
[out] | gopt_lp | the optimum gain calculated for the regularized PSD |
[out] | var_lp | the variance at the optimum gain. |
[in] | go_lp | the gain optimization object |
[in] | PSDt | the turbulence PSD |
[in] | PSDn | the WFS noise PSD |
[in] | minNc | the number of coefficients |
Definition at line 313 of file clAOLinearPredictor.hpp.
|
inline |
Regularize the PSD and calculate the associated LP coefficients.
The PSD is regularized by adding a constant to it. This constant is found by minimizing the variance of the residual PSD.
telem | if true then the results are collected in m_regResults |
[out] | gmax_lp | the maximum gain calculated for the regularized PSD |
[out] | gopt_lp | the optimum gain calculated for the regularized PSD |
[out] | var_lp | the variance at the optimum gain. |
[out] | min_sc | the optimum regularization scale factor |
[in] | go_lp | the gain optimization object |
[in] | PSDt | the turbulence PSD |
[in] | PSDn | the WFS noise PSD |
[in] | Nc | the number of coefficients |
Definition at line 227 of file clAOLinearPredictor.hpp.
References mx::AO::analysis::clGainOpt< _realT >::a(), mx::AO::analysis::clGainOpt< _realT >::b(), mx::AO::analysis::clAOLinearPredictor< _realT >::calcCoefficients(), mx::AO::analysis::clGainOpt< _realT >::maxStableGain(), and mx::AO::analysis::clGainOpt< _realT >::optGainOpenLoop().
Referenced by mx::AO::analysis::fourierTemporalPSD< _realT, aosysT >::analyzePSDGrid().
std::vector<realT> mx::AO::analysis::clAOLinearPredictor< _realT >::m_ac |
Working memory to hold the autocorrelation.
Definition at line 59 of file clAOLinearPredictor.hpp.
Referenced by mx::AO::analysis::clAOLinearPredictor< _realT >::calcCoefficients().
int mx::AO::analysis::clAOLinearPredictor< _realT >::m_extrap {1} |
The LP extrapolation length in loop steps. Normally it is 1 step.
Definition at line 77 of file clAOLinearPredictor.hpp.
Referenced by mx::AO::analysis::clAOLinearPredictor< _realT >::calcCoefficients().
realT mx::AO::analysis::clAOLinearPredictor< _realT >::m_gmax_lp { 5 } |
The maximum allowable gain for LP.
Definition at line 71 of file clAOLinearPredictor.hpp.
Referenced by mx::AO::analysis::clAOLinearPredictor< _realT >::_regularizeCoefficients().
std::vector<realT> mx::AO::analysis::clAOLinearPredictor< _realT >::m_psd2s |
Working memory for the 2-sided regularized PSD.
Definition at line 57 of file clAOLinearPredictor.hpp.
Referenced by mx::AO::analysis::clAOLinearPredictor< _realT >::calcCoefficients().
std::vector<realT> mx::AO::analysis::clAOLinearPredictor< _realT >::m_PSDtn |
Working memory for the regularized PSD.
Definition at line 55 of file clAOLinearPredictor.hpp.
Referenced by mx::AO::analysis::clAOLinearPredictor< _realT >::calcCoefficients().