mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
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 80 of file aoPSDs.hpp.

#include <ao/analysis/aoPSDs.hpp>

Public Member Functions

 vonKarmanSpectrum ()
 Default Constructor. More...
 
 vonKarmanSpectrum (bool subP, bool subT, realT D)
 Constructor specifying the parameters. More...
 
bool subPiston ()
 Get the value of m_subPiston. More...
 
void subPiston (bool sp)
 Set the value of m_subPiston. More...
 
bool subTipTilt ()
 Get the value of m_subTipTilt. More...
 
void subTipTilt (bool st)
 Set the value of the m_subTipTilt flag. More...
 
bool scintillation ()
 Get the value of m_scintillation. More...
 
void scintillation (bool sc)
 Set the value of m_scintillation. More...
 
int component ()
 Get the value of m_component. More...
 
int component (int cc)
 Set the value of m_component. More...
 
realT D ()
 Get the value of the diameter m_D. More...
 
void D (realT nd)
 Set the aperture diameter. More...
 
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. More...
 
template<class psdParamsT >
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. More...
 
template<typename iosT >
iosT & dumpPSD (iosT &ios)
 Get the fitting error for an actuator spacing d. More...
 
void setupConfig (app::appConfigurator &config)
 Setup the configurator to configure this class. More...
 
void loadConfig (app::appConfigurator &config)
 Load the configuration of this class from a configurator. More...
 

Protected Attributes

bool m_subPiston {true}
 flag controlling whether piston is subtracted from the PSD. Default is true. More...
 
bool m_subTipTilt {false}
 flag controlling whether tip and tilt are subtracted from the PSD. Default is false. More...
 
bool m_scintillation {false}
 flag controlling whether or not scintillation is included More...
 
int m_component {PSDComponent::phase}
 If m_scintillation is true, this controls whether phase (0), amplitude (1), or dispersive contrast (2) is returned. More...
 
realT m_D {1.0}
 Diameter used for piston and tip/tilt subtraction, in m. Default is 1 m. More...
 

Constructor & Destructor Documentation

◆ vonKarmanSpectrum() [1/2]

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

Default Constructor.

Definition at line 219 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 224 of file aoPSDs.hpp.

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 272 of file aoPSDs.hpp.

◆ 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 278 of file aoPSDs.hpp.

◆ 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.

◆ 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.

◆ 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 415 of file aoPSDs.hpp.

◆ loadConfig()

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

Load the configuration of this class from a configurator.

Test:
Loading aoAtmosphere config settings [test doc]
Parameters
[in]configthe app::configurator object

Definition at line 440 of file aoPSDs.hpp.

◆ 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 356 of file aoPSDs.hpp.

References mx::astro::constants::k().

◆ 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(), and mx::astro::constants::k().

◆ 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 260 of file aoPSDs.hpp.

◆ 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 266 of file aoPSDs.hpp.

◆ setupConfig()

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

Setup the configurator to configure this class.

Test:
Loading aoAtmosphere config settings [test doc]
Parameters
[in]configthe app::configurator object

Definition at line 428 of file aoPSDs.hpp.

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

◆ 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 235 of file aoPSDs.hpp.

◆ 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 242 of file aoPSDs.hpp.

◆ 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 248 of file aoPSDs.hpp.

◆ 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 254 of file aoPSDs.hpp.

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 88 of file aoPSDs.hpp.

◆ 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 90 of file aoPSDs.hpp.

◆ 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 87 of file aoPSDs.hpp.

◆ 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 84 of file aoPSDs.hpp.

◆ m_subTipTilt

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

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

Definition at line 85 of file aoPSDs.hpp.


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