33#include "../../math/constants.hpp"
58std::string compName(
int cc );
60int compNum(
const std::string &name );
82template <
typename realT>
98 const char *m_id =
"von Karman";
175 template <
class psdParamsT>
189 template <
class psdParamsT>
207 template <
typename iosT>
217template <
typename realT>
222template <
typename realT>
233template <
typename realT>
239template <
typename realT>
245template <
typename realT>
251template <
typename realT>
257template <
typename realT>
263template <
typename realT>
269template <
typename realT>
275template <
typename realT>
290template <
typename realT>
296template <
typename realT>
302template <
typename realT>
303template <
class psdParamsT>
313 if( par.L_0( layer_i ) > 0 )
315 k02 = ( 1 ) / ( par.L_0( layer_i ) * par.L_0( layer_i ) );
320 if( k02 == 0 && k == 0 )
325 realT Ppiston, Ptiptilt;
332 "Diameter D not set for Piston and/or TT subtraction." );
357 return ( par.beta( layer_i ) * pow( k * k + k02, -1 * par.alpha( layer_i ) / 2 ) + par.beta_0( layer_i ) ) *
358 ( 1.0 - Ppiston - Ptiptilt ) * sec_zeta;
361template <
typename realT>
362template <
class psdParamsT>
372 realT psd =
operator()( par, layer_i, k, secZeta );
374 if( par.nonKolmogorov() ==
false )
376 psd *= pow( par.lam_0() / lambda, 2 );
386 psd *= ( par.X( k, lambda, secZeta ) );
390 psd *= ( par.Y( k, lambda, secZeta ) );
394 psd *= ( par.X_Z( k, lambda, lambda_wfs, secZeta ) );
427template <
typename realT>
428template <
typename iosT>
431 ios <<
"# PSD Parameters:" <<
'\n';
432 ios <<
"# ID = " << m_id <<
'\n';
433 ios <<
"# D = " <<
m_D <<
'\n';
434 ios <<
"# subPiston = " << std::boolalpha <<
m_subPiston <<
'\n';
435 ios <<
"# subTipTilt = " << std::boolalpha <<
m_subTipTilt <<
'\n';
436 ios <<
"# Scintillation = " << std::boolalpha <<
m_scintillation <<
'\n';
437 ios <<
"# Component = " << PSDComponent::compName(
m_component ) <<
'\n';
441template <
typename realT>
444 using namespace mx::app;
454 "Aperture diameter. Used for piston and tip/tilt subtraction." );
455 config.
add(
"psd.subPiston",
"",
"psd.subPiston", argType::Required,
"psd",
"subPiston",
false,
"real",
"" );
456 config.
add(
"psd.subTipTilt",
"",
"psd.subTipTilt", argType::Required,
"psd",
"subTipTilt",
false,
"real",
"" );
457 config.
add(
"psd.scintillation",
466 config.
add(
"psd.component",
"",
"psd.component", argType::Required,
"psd",
"component",
false,
"real",
"" );
469template <
typename realT>
474 config(
m_D,
"psd.D" );
479 std::string cn = PSDComponent::compName(
m_component );
480 config( cn,
"psd.component" );
481 component( PSDComponent::compNum( cn ) );
Provides a class to specify atmosphere parameters.
Calculate and provide constants related to adaptive optics.
@ dispAmplitude
The amplitude component of dispersive anisoplanatism.
@ dispPhase
The phase component of dispersive anisoplanatism.
@ amplitude
The amplitude.
@ notimpl
A component or technique is not implemented.
@ paramnotset
A parameter was not set.
@ invalidarg
An argument was invalid.
error_t mxlib_error_report(const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current())
Print a report to stderr given an mxlib error_t code and explanation and return the code.
T2 jincN(const T1 &v, const T2 &x)
The JincN function.
T jinc(const T &x)
The Jinc function.
constexpr T pi()
Get the value of pi.
Declares and defines the Jinc and Jinc2 functions.
Declarations of some libarary wide utilities.
MXLIB_DEFAULT_VERBOSITY d
The default verbosity.
Manage calculations using the von Karman spatial power spectrum.
bool subTipTilt()
Get the value of m_subTipTilt.
realT D()
Get the value of the diameter m_D.
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.
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.
bool subPiston()
Get the value of m_subPiston.
realT m_D
Diameter used for piston and tip/tilt subtraction, in m. Default is 1 m.
vonKarmanSpectrum()
Default Constructor.
bool scintillation()
Get the value of m_scintillation.
void loadConfig(app::appConfigurator &config)
Load the configuration of this class from a configurator.
int component()
Get the value of m_component.
bool m_subTipTilt
flag controlling whether tip and tilt are subtracted from the PSD. Default is false.
bool m_scintillation
flag controlling whether or not scintillation is included
bool m_subPiston
flag controlling whether piston is subtracted from the PSD. Default is true.
Class to manage a set of configurable values, and read their values from config/ini files and the com...
void add(const configTarget &tgt)
Add a configTarget.