mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
mx::AO::analysis::vonKarmanSpectrum< realT > Struct Template Reference

template<typename realT>
struct mx::AO::analysis::vonKarmanSpectrum< realT >

Manage calculations using the von Karman spatial power spectrum.

This very general PSD has the form

\[ \mathcal{P}(k) = \frac{\beta}{ ( k^2 + k_0^2) ^{\alpha/2}} \]

Where \( k \) is spatial frequency, \( \beta \) is a normalization constant, and outer scale \( L_0 \) is included via \( k_0 = 1/L_0 \). For \( L_0 \rightarrow \infty \) this becomes a simple power law with index \( \alpha \).

For atmospheric turbulence \( \alpha = 11/3 \) and the normalization is

\[\beta = \frac{\mathcal{A}_p}{r_0^{5/3}} \]

where \( A_p = 0.0218...\) (see mx::AO::constants::a_PSD ).

Definition at line 83 of file aoPSDs.hpp.

#include <ao/analysis/aoPSDs.hpp>

Public Member Functions

 vonKarmanSpectrum ()
 Default Constructor.
 vonKarmanSpectrum (bool subP, bool subT, realT D)
 Constructor specifying the parameters.
bool subPiston ()
 Get the value of m_subPiston.
void subPiston (bool sp)
 Set the value of m_subPiston.
bool subTipTilt ()
 Get the value of m_subTipTilt.
void subTipTilt (bool st)
 Set the value of the m_subTipTilt flag.
bool scintillation ()
 Get the value of m_scintillation.
void scintillation (bool sc)
 Set the value of m_scintillation.
int component ()
 Get the value of m_component.
int component (int cc)
 Set the value of m_component.
realT D ()
 Get the value of the diameter m_D.
void D (realT nd)
 Set the aperture diameter.
template<class psdParamsT>
realT operator() (psdParamsT &par, size_t layer_i, realT k, realT sec_zeta)
 Get the value of the PSD at spatial frequency k and a zenith distance.
template<class psdParamsT>
realT operator() (psdParamsT &par, size_t layer_i, realT k, realT lambda, realT lambda_wfs, realT secZeta)
template<typename iosT>
iosT & dumpPSD (iosT &ios)
 Get the fitting error for an actuator spacing d.
void setupConfig (app::appConfigurator &config)
 Setup the configurator to configure this class.
void loadConfig (app::appConfigurator &config)
 Load the configuration of this class from a configurator.

Protected Attributes

bool m_subPiston { true }
 flag controlling whether piston is subtracted from the PSD. Default is true.
bool m_subTipTilt
 flag controlling whether tip and tilt are subtracted from the PSD. Default is false.
bool m_scintillation { false }
 flag controlling whether or not scintillation is included
int m_component { PSDComponent::phase }
realT m_D { 1.0 }
 Diameter used for piston and tip/tilt subtraction, in m. Default is 1 m.

Constructor & Destructor Documentation

◆ vonKarmanSpectrum() [1/2]

template<typename realT>
mx::AO::analysis::vonKarmanSpectrum< realT >::vonKarmanSpectrum ( )

Default Constructor.

Definition at line 218 of file aoPSDs.hpp.

◆ vonKarmanSpectrum() [2/2]

template<typename realT>
mx::AO::analysis::vonKarmanSpectrum< realT >::vonKarmanSpectrum ( bool subP,
bool subT,
realT D )

Constructor specifying the parameters.

Parameters
[in]subPis the value of m_subPiston.
[in]subTis the value of m_subTipTilt.
[in]Dis the value of m_D.

Definition at line 223 of file aoPSDs.hpp.

References D(), m_D, m_subPiston, and m_subTipTilt.

Member Function Documentation

◆ component() [1/2]

template<typename realT>
int mx::AO::analysis::vonKarmanSpectrum< realT >::component ( )

Get the value of m_component.

Returns
m_component

Definition at line 270 of file aoPSDs.hpp.

References m_component.

Referenced by loadConfig(), and TEST_CASE().

◆ component() [2/2]

template<typename realT>
int mx::AO::analysis::vonKarmanSpectrum< realT >::component ( int cc)

Set the value of m_component.

Parameters
[in]ccthe new value of m_component

Definition at line 276 of file aoPSDs.hpp.

References mx::invalidarg, m_component, and mx::internal::mxlib_error_report().

◆ D() [1/2]

template<typename realT>
realT mx::AO::analysis::vonKarmanSpectrum< realT >::D ( )

Get the value of the diameter m_D.

Returns
the current value of m_D, the diameter in m.

Definition at line 291 of file aoPSDs.hpp.

References m_D.

Referenced by vonKarmanSpectrum(), and TEST_CASE().

◆ D() [2/2]

template<typename realT>
void mx::AO::analysis::vonKarmanSpectrum< realT >::D ( realT nd)

Set the aperture diameter.

Parameters
[in]ndthe new diameter in m

Definition at line 297 of file aoPSDs.hpp.

References m_D.

◆ dumpPSD()

template<typename realT>
template<typename iosT>
iosT & mx::AO::analysis::vonKarmanSpectrum< realT >::dumpPSD ( iosT & ios)

Get the fitting error for an actuator spacing d.

Todo
generatlize for different alpha and beta
Parameters
atmgives the atmosphere parameters r_0 and L_0
dis the actuator spacing in m

Definition at line 429 of file aoPSDs.hpp.

References m_component, m_D, m_scintillation, m_subPiston, and m_subTipTilt.

◆ loadConfig()

template<typename realT>
void mx::AO::analysis::vonKarmanSpectrum< realT >::loadConfig ( app::appConfigurator & config)

Load the configuration of this class from a configurator.

Parameters
[in]configthe app::configurator object

Definition at line 470 of file aoPSDs.hpp.

References component(), m_component, m_D, m_scintillation, m_subPiston, and m_subTipTilt.

Referenced by TEST_CASE().

◆ operator()() [1/2]

template<typename realT>
template<class psdParamsT>
realT mx::AO::analysis::vonKarmanSpectrum< realT >::operator() ( psdParamsT & par,
size_t layer_i,
realT k,
realT lambda,
realT lambda_wfs,
realT secZeta )

Get the value of the PSD at spatial frequency k and wavelength lambda, and a zenith distance, with a WFS at a different wavelength

Returns
the von Karman PSD at the specified spatial frequency for the specified wavelength.
-1 if an error occurs.
Parameters
[in]pargives the PSD parameters.
[in]kis the spatial frequency in m^-1.
[in]lambdais the observation wavelength in m
[in]lambda_wfsis the wavefront measurement wavelength in m
[in]secZetais the secant of the zenith distance

Definition at line 363 of file aoPSDs.hpp.

References mx::invalidarg, m_component, m_scintillation, mx::internal::mxlib_error_report(), mx::notimpl, and operator()().

◆ operator()() [2/2]

template<typename realT>
template<class psdParamsT>
realT mx::AO::analysis::vonKarmanSpectrum< realT >::operator() ( psdParamsT & par,
size_t layer_i,
realT k,
realT sec_zeta )

Get the value of the PSD at spatial frequency k and a zenith distance.

Returns
the von Karman PSD at the specified spatial frequency.
-1 if an error occurs.
Todo
this needs to handle layers with different L_0
Parameters
[in]pargives the PSD parameters.
[in]kis the spatial frequency in m^-1.
[in]sec_zetais the secant of the zenith distance.

Definition at line 304 of file aoPSDs.hpp.

References mx::math::func::jinc(), mx::math::func::jincN(), m_D, m_subPiston, m_subTipTilt, mx::internal::mxlib_error_report(), mx::paramnotset, and mx::math::pi().

Referenced by operator()().

◆ scintillation() [1/2]

template<typename realT>
bool mx::AO::analysis::vonKarmanSpectrum< realT >::scintillation ( )

Get the value of m_scintillation.

Returns
m_scintillation

Definition at line 258 of file aoPSDs.hpp.

References m_scintillation.

Referenced by TEST_CASE().

◆ scintillation() [2/2]

template<typename realT>
void mx::AO::analysis::vonKarmanSpectrum< realT >::scintillation ( bool sc)

Set the value of m_scintillation.

Parameters
[in]scthe new value of m_scintillation

Definition at line 264 of file aoPSDs.hpp.

References m_scintillation.

◆ setupConfig()

template<typename realT>
void mx::AO::analysis::vonKarmanSpectrum< realT >::setupConfig ( app::appConfigurator & config)

Setup the configurator to configure this class.

Parameters
[in]configthe app::configurator object

Definition at line 442 of file aoPSDs.hpp.

References mx::app::appConfigurator::add().

Referenced by TEST_CASE().

◆ subPiston() [1/2]

template<typename realT>
bool mx::AO::analysis::vonKarmanSpectrum< realT >::subPiston ( )

Get the value of m_subPiston.

Returns
m_subPiston

Definition at line 234 of file aoPSDs.hpp.

References m_subPiston.

Referenced by TEST_CASE().

◆ subPiston() [2/2]

template<typename realT>
void mx::AO::analysis::vonKarmanSpectrum< realT >::subPiston ( bool sp)

Set the value of m_subPiston.

Parameters
[in]spis the new value of m_subPiston

Definition at line 240 of file aoPSDs.hpp.

References m_subPiston.

◆ subTipTilt() [1/2]

template<typename realT>
bool mx::AO::analysis::vonKarmanSpectrum< realT >::subTipTilt ( )

Get the value of m_subTipTilt.

Returns
the value of m_subTipTilt.

Definition at line 246 of file aoPSDs.hpp.

References m_subTipTilt.

Referenced by TEST_CASE().

◆ subTipTilt() [2/2]

template<typename realT>
void mx::AO::analysis::vonKarmanSpectrum< realT >::subTipTilt ( bool st)

Set the value of the m_subTipTilt flag.

Parameters
[in]stthe new value of m_subTipTilt.

Definition at line 252 of file aoPSDs.hpp.

References m_subTipTilt.

Member Data Documentation

◆ m_component

template<typename realT>
int mx::AO::analysis::vonKarmanSpectrum< realT >::m_component { PSDComponent::phase }
protected

If m_scintillation is true, this controls whether phase (0), amplitude (1), or dispersive contrast (2) is returned.

Definition at line 93 of file aoPSDs.hpp.

Referenced by component(), component(), dumpPSD(), loadConfig(), and operator()().

◆ m_D

template<typename realT>
realT mx::AO::analysis::vonKarmanSpectrum< realT >::m_D { 1.0 }
protected

Diameter used for piston and tip/tilt subtraction, in m. Default is 1 m.

Definition at line 96 of file aoPSDs.hpp.

Referenced by vonKarmanSpectrum(), D(), D(), dumpPSD(), loadConfig(), and operator()().

◆ m_scintillation

template<typename realT>
bool mx::AO::analysis::vonKarmanSpectrum< realT >::m_scintillation { false }
protected

flag controlling whether or not scintillation is included

Definition at line 92 of file aoPSDs.hpp.

Referenced by dumpPSD(), loadConfig(), operator()(), scintillation(), and scintillation().

◆ m_subPiston

template<typename realT>
bool mx::AO::analysis::vonKarmanSpectrum< realT >::m_subPiston { true }
protected

flag controlling whether piston is subtracted from the PSD. Default is true.

Definition at line 88 of file aoPSDs.hpp.

Referenced by vonKarmanSpectrum(), dumpPSD(), loadConfig(), operator()(), subPiston(), and subPiston().

◆ m_subTipTilt

template<typename realT>
bool mx::AO::analysis::vonKarmanSpectrum< realT >::m_subTipTilt
protected
Initial value:
{
false }

flag controlling whether tip and tilt are subtracted from the PSD. Default is false.

Definition at line 89 of file aoPSDs.hpp.

Referenced by vonKarmanSpectrum(), dumpPSD(), loadConfig(), operator()(), subTipTilt(), and subTipTilt().


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