mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
mx::AO::analysis::clAOLinearPredictor< _realT > Struct Template Reference

template<typename _realT>
struct mx::AO::analysis::clAOLinearPredictor< _realT >

Class to manage the calculation of linear predictor coefficients for a closed-loop AO system.

Template Parameters
_realTthe real floating point type in which to do all arithmetic.

Definition at line 36 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. More...
 
template<bool printout = false>
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. More...
 
template<bool printout = false>
int regularizeCoefficients (realT &gmax_lp, realT &gopt_lp, realT &var_lp, clGainOpt< realT > &go_lp, std::vector< realT > &PSDt, std::vector< realT > &PSDn, int Nc)
 Regularize the PSD and calculate the associated LP coefficients. More...
 
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. More...
 

Public Attributes

realT m_gmax_lp {5}
 The maximum allowable gain for LP. More...
 

Member Function Documentation

◆ _regularizeCoefficients()

template<typename _realT >
template<bool printout = false>
int mx::AO::analysis::clAOLinearPredictor< _realT >::_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 
)
inline

Worker function for regularizing the PSD for coefficient calculation.

Template Parameters
printoutif true then the results are printed to stdout as they are calculated.

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

Parameters
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]precisionthe step-size for the scale factor
[in]max_scthe maximum scale factor to test
[in]go_lpthe gain optimization object
[in]PSDtthe turbulence PSD
[in]PSDnthe WFS noise PSD
[in]Ncthe number of coefficients

Definition at line 111 of file clAOLinearPredictor.hpp.

References mx::AO::analysis::clAOLinearPredictor< _realT >::calcCoefficients(), and mx::AO::analysis::clAOLinearPredictor< _realT >::m_gmax_lp.

◆ calcCoefficients()

template<typename _realT >
int mx::AO::analysis::clAOLinearPredictor< _realT >::calcCoefficients ( std::vector< realT > &  PSDt,
std::vector< realT > &  PSDn,
realT  PSDreg,
int  Nc,
realT  condition = 0 
)
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.

Parameters
[in]PSDtthe turbulence PSD
[in]PSDnthe WFS noise PSD
[in]PSDregthe regularizing constant. Set to 0 to not use.
[in]Ncthe number of LP coefficients.

Definition at line 75 of file clAOLinearPredictor.hpp.

References mx::sigproc::augment1SidedPSD(), and mx::sigproc::linearPredictor< _realT >::calcCoefficients().

Referenced by mx::AO::analysis::clAOLinearPredictor< _realT >::_regularizeCoefficients(), and mx::AO::analysis::clAOLinearPredictor< _realT >::regularizeCoefficients().

◆ optimizeNc()

template<typename _realT >
template<bool printout = false>
int mx::AO::analysis::clAOLinearPredictor< _realT >::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 
)
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.

Template Parameters
printoutif true then the results are printed to stdout as they are calculated.
Parameters
[out]gmax_lpthe maximum gain calculated for the regularized PSD
[out]gopt_lpthe optimum gain calculated for the regularized PSD
[out]var_lpthe variance at the optimum gain.
[in]go_lpthe gain optimization object
[in]PSDtthe turbulence PSD
[in]PSDnthe WFS noise PSD
[in]minNcthe number of coefficients

Definition at line 253 of file clAOLinearPredictor.hpp.

◆ regularizeCoefficients()

template<typename _realT >
template<bool printout = false>
int mx::AO::analysis::clAOLinearPredictor< _realT >::regularizeCoefficients ( realT &  gmax_lp,
realT &  gopt_lp,
realT &  var_lp,
clGainOpt< realT > &  go_lp,
std::vector< realT > &  PSDt,
std::vector< realT > &  PSDn,
int  Nc 
)
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.

Template Parameters
printoutif true then the results are printed to stdout as they are calculated.
Parameters
[out]gmax_lpthe maximum gain calculated for the regularized PSD
[out]gopt_lpthe optimum gain calculated for the regularized PSD
[out]var_lpthe variance at the optimum gain.
[in]go_lpthe gain optimization object
[in]PSDtthe turbulence PSD
[in]PSDnthe WFS noise PSD
[in]Ncthe number of coefficients

Definition at line 188 of file clAOLinearPredictor.hpp.

References mx::AO::analysis::clAOLinearPredictor< _realT >::calcCoefficients().

Member Data Documentation

◆ m_gmax_lp

template<typename _realT >
realT mx::AO::analysis::clAOLinearPredictor< _realT >::m_gmax_lp {5}

The maximum allowable gain for LP.

Definition at line 56 of file clAOLinearPredictor.hpp.

Referenced by mx::AO::analysis::clAOLinearPredictor< _realT >::_regularizeCoefficients().


The documentation for this struct was generated from the following file: