mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
aoConstants.hpp
Go to the documentation of this file.
1 /** \file aoConstants.hpp
2  * \author Jared R. Males (jaredmales@gmail.com)
3  * \brief Calculate and provide constants related to adaptive optics.
4  * \ingroup mxAO_files
5  *
6  */
7 
8 #ifndef mx_AO_analysis_aoConstants_hpp
9 #define mx_AO_analysis_aoConstants_hpp
10 
11 #include <cmath>
12 
13 
14 #include "../../math/constants.hpp"
15 #include "../../math/func/gamma.hpp"
16 
17 
18 
19 namespace mx
20 {
21 namespace AO
22 {
23 namespace constants
24 {
25 
26 
27 ///Calculate the AO constants
28 template<typename floatT>
29 void calcConstants(floatT & a_sf, floatT & a_psd)
30 {
31  floatT pi = math::pi<floatT>();
32 
33  floatT gam1 = math::func::tgamma<floatT>( static_cast<floatT>(6)/ static_cast<floatT>(5) );
34 
35  floatT gam2 = math::func::tgamma<floatT>( static_cast<floatT>(11)/ static_cast<floatT>(6) );
36 
37  a_sf = pow( static_cast<floatT>(24)/static_cast<floatT>(5) * gam1, static_cast<floatT>(5) / static_cast<floatT>(6) );
38 
39  a_psd = a_sf*gam1*gam1*sin( static_cast<floatT>(5) * pi / static_cast<floatT>(6) )/ pow(pi, static_cast<floatT>(11)/static_cast<floatT>(3) );
40 
41  a_sf = a_sf*static_cast<floatT>(2);
42 
43 }
44 
45 ///The scaling constant for the Kolmorogov optical phase structure function
46 /** The optical phase structure function for Kolmogorov turbulence is
47  * \f[
48  * \mathcal{D}_\phi(r) = a_{SF} \left(\frac{r}{r_0}\right)^{5/3}
49  * \f]
50  *
51  * This constant, given to 50 digits, was caculated using calcConstants with boost::multiprecision::cpp_dec_float_100 (100 digits of precision)
52  *
53  * \returns 6.883877.... cast to type floatT
54  *
55  * \tparam floatT is the type to cast the value to.
56  * \ingroup aoConstants
57  *
58  */
59 template<typename floatT>
60 constexpr floatT a_SF()
61 {
62  return static_cast<floatT>(6.8838771822938116152935575630969803178936813057678);
63 }
64 
65 ///The scaling constant for the Kolmorogov optical phase power spectral density
66 /** The optical phase PSD for Kolmogorov turbulence is
67  * \f[
68  * \mathcal{P}_\phi(k) = a_{PSD} \left(\frac{1}{r_0^{5/3} k^{11/3}}\right)
69  * \f]
70  *
71  * This constant, given to 50 digits, was caculated using calcConstants with boost::multiprecision::cpp_dec_float_100 (100 digits of precision)
72  *
73  * \returns 0.02181... cast to type floatT
74  *
75  * \tparam floatT is the type to cast the value to
76  *
77  * \ingroup aoConstants
78  */
79 template<typename floatT>
80 constexpr floatT a_PSD()
81 {
82  return static_cast<floatT>(0.0218139977034218241674821945866523430205216037234);
83 }
84 
85 
86 
87 } //namespace constants
88 } //namespace AO
89 } //namespace mx
90 
91 #endif //mx_AO_analysis_aoConstants_hpp
void calcConstants(floatT &a_sf, floatT &a_psd)
Calculate the AO constants.
Definition: aoConstants.hpp:29
constexpr floatT a_PSD()
The scaling constant for the Kolmorogov optical phase power spectral density.
Definition: aoConstants.hpp:80
constexpr floatT a_SF()
The scaling constant for the Kolmorogov optical phase structure function.
Definition: aoConstants.hpp:60
constexpr T pi()
Get the value of pi.
Definition: constants.hpp:52
The mxlib c++ namespace.
Definition: mxError.hpp:107