Line data Source code
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 : #include "../../math/constants.hpp"
14 : #include "../../math/func/gamma.hpp"
15 :
16 : namespace mx
17 : {
18 : namespace AO
19 : {
20 : namespace constants
21 : {
22 :
23 : /// Calculate the AO constants
24 : template <typename floatT>
25 : void calcConstants( floatT &a_sf, floatT &a_psd )
26 : {
27 : floatT pi = math::pi<floatT>();
28 :
29 : floatT gam1 = math::func::tgamma<floatT>( static_cast<floatT>( 6 ) / static_cast<floatT>( 5 ) );
30 :
31 : floatT gam2 = math::func::tgamma<floatT>( static_cast<floatT>( 11 ) / static_cast<floatT>( 6 ) );
32 :
33 : a_sf = pow( static_cast<floatT>( 24 ) / static_cast<floatT>( 5 ) * gam1,
34 : static_cast<floatT>( 5 ) / static_cast<floatT>( 6 ) );
35 :
36 : a_psd = a_sf * gam1 * gam1 * sin( static_cast<floatT>( 5 ) * pi / static_cast<floatT>( 6 ) ) /
37 : pow( pi, static_cast<floatT>( 11 ) / static_cast<floatT>( 3 ) );
38 :
39 : a_sf = a_sf * static_cast<floatT>( 2 );
40 : }
41 :
42 : /// The scaling constant for the Kolmorogov optical phase structure function
43 : /** The optical phase structure function for Kolmogorov turbulence is
44 : * \f[
45 : * \mathcal{D}_\phi(r) = a_{SF} \left(\frac{r}{r_0}\right)^{5/3}
46 : * \f]
47 : *
48 : * This constant, given to 50 digits, was caculated using calcConstants with boost::multiprecision::cpp_dec_float_100
49 : * (100 digits of precision)
50 : *
51 : * \returns 6.883877.... cast to type floatT
52 : *
53 : * \tparam floatT is the type to cast the value to.
54 : * \ingroup aoConstants
55 : *
56 : */
57 : template <typename floatT>
58 : constexpr floatT a_SF()
59 : {
60 : return static_cast<floatT>( 6.8838771822938116152935575630969803178936813057678 );
61 : }
62 :
63 : /// The scaling constant for the Kolmorogov optical phase power spectral density
64 : /** The optical phase PSD for Kolmogorov turbulence is
65 : * \f[
66 : * \mathcal{P}_\phi(k) = a_{PSD} \left(\frac{1}{r_0^{5/3} k^{11/3}}\right)
67 : * \f]
68 : *
69 : * This constant, given to 50 digits, was caculated using calcConstants with boost::multiprecision::cpp_dec_float_100
70 : * (100 digits of precision)
71 : *
72 : * \returns 0.02181... cast to type floatT
73 : *
74 : * \tparam floatT is the type to cast the value to
75 : *
76 : * \ingroup aoConstants
77 : */
78 : template <typename floatT>
79 96450 : constexpr floatT a_PSD()
80 : {
81 96450 : return static_cast<floatT>( 0.0218139977034218241674821945866523430205216037234 );
82 : }
83 :
84 : } // namespace constants
85 : } // namespace AO
86 : } // namespace mx
87 :
88 : #endif // mx_AO_analysis_aoConstants_hpp
|