mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT > Class Template Reference

template<typename _turbAtmosphereT, class _verboseT = mx::verbose::d>
class mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >

A class to manage low-frequency sub-harmonic phase screen generation in atmospheric turbulence.

Implements the method of Johansson and Gavel (1994)[16]. This is needed to generate adequate tip/tilt variance with large outer scales.

Definition at line 56 of file turbSubHarmonic.hpp.

#include <ao/sim/turbSubHarmonic.hpp>

Inheritance diagram for mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >:

Public Member Functions

Construction
Configuration
void turbAtmo (turbAtmosphereT *atm)
 Set the pointer to the turbulent atmosphere.
turbAtmosphereT * turbAtmo ()
 Get the pointer to the AO atmosphere.
void level (uint32_t ml)
 Set the subharmonic level to apply.
uint32_t level ()
 Get the subharmonic level.
void outerSubHarmonics (bool osh)
 Set whether or not the outer subharmonics are included.
bool outerSubHarmonics ()
 Get whether or not the outer subharmonics are included.
void preCalc (bool pc)
 Set whether or not to pre-calculate the modes.
bool preCalc ()
 Get whether or not the modes are pre-calculated.
Screen Generation
void initGrid (uint32_t layerNo)
 Allocate needed memory and initialize the subharmonic transform.
void screen (improc::eigenImage< realT > &scrn)
 Generate a realization of the subharmonic phase screen and add it to the input screen.
void deinit ()
 Deallocate memory.
Public Member Functions inherited from mx::base::changeable< turbSubHarmonic< _turbAtmosphereT > >
void changed ()
 Increment the counter.
changeT change ()
 Get the value of the counter.

Protected Attributes

Configuration Parameters
turbAtmosphereT * m_turbAtmo { nullptr }
 Pointer to the parent atmosphere object.
unsigned m_level { 1 }
 The subharmonic level to apply.
bool m_outerSubHarmonics { true }
 Whether or not to include the outer subharmonics.
bool m_preCalc { false }
 whether or not the modes are pre-calculated.
Internal State
uint32_t m_scrnSz
 The wavefront screen size from the layer being simulated.
std::vector< realT > m_cosNoise
 Gaussian cosine coefficients prepared for each screen generation.
std::vector< realT > m_sinNoise
 Gaussian sine coefficients prepared for each screen generation.
std::vector< realT > m_m
 m-coordinate fractional spatial frequency indices of the subharmonics
std::vector< realT > m_n
 n-coordinate fractional spatial frequency indices of the subharmonics
std::vector< realT > m_sqrtPSD
 Square root of the PSD-cell variance for each unique conjugate pair.
improc::eigenCube< realT > m_modes
 Pre-calculated cosine modes followed by their sine counterparts.

Additional Inherited Members

Public Types inherited from mx::base::changeable< turbSubHarmonic< _turbAtmosphereT > >
typedef uint64_t changeT
 The integer type of the counter.

Member Function Documentation

◆ deinit()

template<typename turbAtmosphereT, class verboseT>
void mx::AO::sim::turbSubHarmonic< turbAtmosphereT, verboseT >::deinit ( )

◆ initGrid()

template<typename turbAtmosphereT, class verboseT>
void mx::AO::sim::turbSubHarmonic< turbAtmosphereT, verboseT >::initGrid ( uint32_t layerNo)

◆ level() [1/2]

template<typename turbAtmosphereT, class verboseT>
uint32_t mx::AO::sim::turbSubHarmonic< turbAtmosphereT, verboseT >::level ( )

Get the subharmonic level.

Returns
the current subharmonic level

Definition at line 201 of file turbSubHarmonic.hpp.

References m_level.

◆ level() [2/2]

template<typename turbAtmosphereT, class verboseT>
void mx::AO::sim::turbSubHarmonic< turbAtmosphereT, verboseT >::level ( uint32_t ml)

Set the subharmonic level to apply.

Parameters
[in]mlthe new level

Definition at line 191 of file turbSubHarmonic.hpp.

References mx::base::changeable< turbSubHarmonic< _turbAtmosphereT > >::changed(), and m_level.

Referenced by unitTest::ao_sim_turbSubHarmonic_test::TEST_CASE().

◆ outerSubHarmonics() [1/2]

template<typename turbAtmosphereT, class verboseT>
bool mx::AO::sim::turbSubHarmonic< turbAtmosphereT, verboseT >::outerSubHarmonics ( )

Get whether or not the outer subharmonics are included.

Returns
the current value of the m_outerSubHarmonics flag

Definition at line 217 of file turbSubHarmonic.hpp.

References m_outerSubHarmonics.

◆ outerSubHarmonics() [2/2]

template<typename turbAtmosphereT, class verboseT>
void mx::AO::sim::turbSubHarmonic< turbAtmosphereT, verboseT >::outerSubHarmonics ( bool osh)

Set whether or not the outer subharmonics are included.

Parameters
[in]oshthe new value of the m_outerSubHarmonics flag

Definition at line 207 of file turbSubHarmonic.hpp.

References mx::base::changeable< turbSubHarmonic< _turbAtmosphereT > >::changed(), and m_outerSubHarmonics.

Referenced by unitTest::ao_sim_turbSubHarmonic_test::TEST_CASE().

◆ preCalc() [1/2]

template<typename turbAtmosphereT, class verboseT>
bool mx::AO::sim::turbSubHarmonic< turbAtmosphereT, verboseT >::preCalc ( )

Get whether or not the modes are pre-calculated.

Returns
the current value of the preCalc flag

Definition at line 233 of file turbSubHarmonic.hpp.

References m_preCalc.

◆ preCalc() [2/2]

template<typename turbAtmosphereT, class verboseT>
void mx::AO::sim::turbSubHarmonic< turbAtmosphereT, verboseT >::preCalc ( bool pc)

Set whether or not to pre-calculate the modes.

Parameters
[in]pcthe new value of the m_preCalc flag

Definition at line 223 of file turbSubHarmonic.hpp.

References mx::base::changeable< turbSubHarmonic< _turbAtmosphereT > >::changed(), and m_preCalc.

Referenced by unitTest::ao_sim_turbSubHarmonic_test::TEST_CASE().

◆ screen()

template<typename turbAtmosphereT, class verboseT>
void mx::AO::sim::turbSubHarmonic< turbAtmosphereT, verboseT >::screen ( improc::eigenImage< realT > & scrn)

Generate a realization of the subharmonic phase screen and add it to the input screen.

Parameters
[in]scrnthe input phase screen to which to add the low-frequency screen. Must be m_scrnSz X m_scrnsz

Definition at line 402 of file turbSubHarmonic.hpp.

References mx::exception, mx::invalidconfig, m_cosNoise, m_level, m_m, m_modes, m_n, m_preCalc, m_scrnSz, m_sinNoise, m_sqrtPSD, m_turbAtmo, mx::paramnotset, mx::sizeerr, and mx::math::two_pi().

Referenced by unitTest::ao_sim_turbSubHarmonic_test::TEST_CASE().

◆ turbAtmo() [1/2]

template<typename turbAtmosphereT, class verboseT>
turbAtmosphereT * mx::AO::sim::turbSubHarmonic< turbAtmosphereT, verboseT >::turbAtmo ( )

Get the pointer to the AO atmosphere.

Returns
the the current pointer to the AO atmosphere

Definition at line 185 of file turbSubHarmonic.hpp.

References m_turbAtmo.

◆ turbAtmo() [2/2]

template<typename turbAtmosphereT, class verboseT>
void mx::AO::sim::turbSubHarmonic< turbAtmosphereT, verboseT >::turbAtmo ( turbAtmosphereT * atm)

Set the pointer to the turbulent atmosphere.

Parameters
[in]atmthe new pointer to an AO atmosphere

Definition at line 175 of file turbSubHarmonic.hpp.

References mx::base::changeable< turbSubHarmonic< _turbAtmosphereT > >::changed(), and m_turbAtmo.

Referenced by unitTest::ao_sim_turbSubHarmonic_test::TEST_CASE().

Member Data Documentation

◆ m_cosNoise

template<typename _turbAtmosphereT, class _verboseT = mx::verbose::d>
std::vector<realT> mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >::m_cosNoise
protected

Gaussian cosine coefficients prepared for each screen generation.

Definition at line 87 of file turbSubHarmonic.hpp.

Referenced by deinit(), initGrid(), and screen().

◆ m_level

template<typename _turbAtmosphereT, class _verboseT = mx::verbose::d>
unsigned mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >::m_level { 1 }
protected

The subharmonic level to apply.

Definition at line 72 of file turbSubHarmonic.hpp.

Referenced by initGrid(), level(), level(), and screen().

◆ m_m

template<typename _turbAtmosphereT, class _verboseT = mx::verbose::d>
std::vector<realT> mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >::m_m
protected

m-coordinate fractional spatial frequency indices of the subharmonics

Definition at line 92 of file turbSubHarmonic.hpp.

Referenced by deinit(), initGrid(), and screen().

◆ m_modes

template<typename _turbAtmosphereT, class _verboseT = mx::verbose::d>
improc::eigenCube<realT> mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >::m_modes
protected

Pre-calculated cosine modes followed by their sine counterparts.

Definition at line 99 of file turbSubHarmonic.hpp.

Referenced by deinit(), initGrid(), and screen().

◆ m_n

template<typename _turbAtmosphereT, class _verboseT = mx::verbose::d>
std::vector<realT> mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >::m_n
protected

n-coordinate fractional spatial frequency indices of the subharmonics

Definition at line 93 of file turbSubHarmonic.hpp.

Referenced by deinit(), initGrid(), and screen().

◆ m_outerSubHarmonics

template<typename _turbAtmosphereT, class _verboseT = mx::verbose::d>
bool mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >::m_outerSubHarmonics { true }
protected

Whether or not to include the outer subharmonics.

Definition at line 74 of file turbSubHarmonic.hpp.

Referenced by initGrid(), outerSubHarmonics(), and outerSubHarmonics().

◆ m_preCalc

template<typename _turbAtmosphereT, class _verboseT = mx::verbose::d>
bool mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >::m_preCalc { false }
protected

whether or not the modes are pre-calculated.

Definition at line 76 of file turbSubHarmonic.hpp.

Referenced by initGrid(), preCalc(), preCalc(), and screen().

◆ m_scrnSz

template<typename _turbAtmosphereT, class _verboseT = mx::verbose::d>
uint32_t mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >::m_scrnSz
protected

The wavefront screen size from the layer being simulated.

Definition at line 84 of file turbSubHarmonic.hpp.

Referenced by initGrid(), and screen().

◆ m_sinNoise

template<typename _turbAtmosphereT, class _verboseT = mx::verbose::d>
std::vector<realT> mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >::m_sinNoise
protected

Gaussian sine coefficients prepared for each screen generation.

Definition at line 90 of file turbSubHarmonic.hpp.

Referenced by deinit(), initGrid(), and screen().

◆ m_sqrtPSD

template<typename _turbAtmosphereT, class _verboseT = mx::verbose::d>
std::vector<realT> mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >::m_sqrtPSD
protected

Square root of the PSD-cell variance for each unique conjugate pair.

Definition at line 96 of file turbSubHarmonic.hpp.

Referenced by deinit(), initGrid(), and screen().

◆ m_turbAtmo

template<typename _turbAtmosphereT, class _verboseT = mx::verbose::d>
turbAtmosphereT* mx::AO::sim::turbSubHarmonic< _turbAtmosphereT, _verboseT >::m_turbAtmo { nullptr }
protected

Pointer to the parent atmosphere object.

Definition at line 70 of file turbSubHarmonic.hpp.

Referenced by initGrid(), screen(), turbAtmo(), and turbAtmo().


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