11#include "../../math/constants.hpp"
12#include "../../mxlib.hpp"
13#include "../../improc/eigenImage.hpp"
14#include "../../ioutils/fits/fitsFile.hpp"
34template <
typename realT,
typename iosT = std::ostream>
68 static_cast<void>( m );
69 static_cast<void>( n );
70 static_cast<void>( D );
71 static_cast<void>( d );
72 static_cast<void>( r0 );
74 return static_cast<realT
>( 1 );
89 return beta_p( m, n, D, d, r0 );
97 ios <<
"# WFS Parameters:\n";
98 ios <<
"# ID = " << _id <<
'\n';
113template <
typename realT,
typename iosT = std::ostream>
118 this->_id =
"Unmodulated Pyramid";
134 static_cast<void>( m );
135 static_cast<void>( n );
136 static_cast<void>( D );
137 static_cast<void>( d );
138 static_cast<void>( r0 );
155 return beta_p( m, n, D, d, r0 );
168template <
typename realT,
typename iosT = std::ostream>
173 this->_id =
"Asymptotic Modulated Pyramid";
189 static_cast<void>( m );
190 static_cast<void>( n );
191 static_cast<void>( D );
192 static_cast<void>( d );
193 static_cast<void>( r0 );
210 return beta_p( m, m, D, d, r0 );
223template <
typename realT,
typename iosT = std::ostream>
228 this->_id =
"Shack Hartmann";
243 realT k = sqrt( m * m + n * n ) / D;
245 return 1.48 / ( k * d ) * sqrt( 1 + pow( d / r0, 2 ) );
260 return beta_p( m, n, D, d, r0 );
273template <
typename realT,
typename iosT = std::ostream>
278 std::string m_beta_p_file;
279 std::string m_beta_r_file;
280 bool m_sensitivity{
false };
287 this->_id =
"Calculated WFS";
303 if( m_beta_p.rows() == 0 )
307 if( m_beta_p.rows() == 0 )
310 ff.
read( m_beta_p, m_beta_p_file );
314 m_beta_p = 1.0 / m_beta_p;
320 int midx = 0.5 * ( m_beta_p.rows() - 1.0 ) + m;
321 int nidx = 0.5 * ( m_beta_p.cols() - 1.0 ) + n;
323 if( midx > m_beta_p.rows() - 1 || midx < 0 )
327 std::cerr <<
"calculatedWFS::beta_p: m index out of range. Got m = " << m
328 <<
" / beta_p.rows = " << m_beta_p.rows() <<
"\n";
331 return std::numeric_limits<realT>::max();
334 if( nidx > m_beta_p.cols() - 1 || nidx < 0 )
338 std::cerr <<
"calculatedWFS::beta_p: n index out of range. Got n = " << n
339 <<
" / beta_p.cols = " << m_beta_p.cols() <<
"\n";
342 return std::numeric_limits<realT>::max();
345 return m_beta_p( midx, nidx );
360 if( m_beta_r.rows() == 0 )
363 ff.
read( m_beta_r, m_beta_r_file );
366 m_beta_r = 1.0 / m_beta_r;
369 int midx = 0.5 * ( m_beta_r.rows() - 1.0 ) + m;
370 int nidx = 0.5 * ( m_beta_r.cols() - 1.0 ) + n;
372 if( midx > m_beta_r.rows() - 1 || midx < 0 )
377 if( nidx > m_beta_r.cols() - 1 || nidx < 0 )
382 return m_beta_r( midx, nidx );
392 ios <<
"# beta_p = " << m_beta_p_file <<
'\n';
393 ios <<
"# beta_r = " << m_beta_r_file <<
'\n';
394 ios <<
"# sensitivity = " << std::boolalpha << m_sensitivity <<
"\n";
Augments an exception with the source file and line.
Class to manage interactions with a FITS file.
error_t read(dataT *data)
Read the contents of the FITS file into an array.
Eigen::Array< scalarT, -1, -1 > eigenImage
Definition of the eigenImage type, which is an alias for Eigen::Array.
@ sizeerr
A size was invalid or calculated incorrectly.
constexpr floatT six_fifths()
Return 6/5 in the specified precision.
MXLIB_DEFAULT_VERBOSITY d
The default verbosity.
The calculated WFS uses sensitivities provided by FITS files.
virtual realT beta_p(int m, int n, realT D, realT d, realT r0)
Get the photon noise sensitivity at a spatial frequency.
virtual iosT & dumpWFS(iosT &ios)
Dump the details of the WFS to an io stream.
virtual realT beta_r(int m, int n, realT D, realT d, realT r0)
Get the read noise sensitivity at a spatial frequency.
The asymptotic modulated pyramid wavefront sensor sensitivity function.
virtual realT beta_p(int m, int n, realT D, realT d, realT r0)
Get the photon sensitivity at a spatial frequency.
virtual realT beta_r(int m, int n, realT D, realT d, realT r0)
Get the read noise sensitivity at a spatial frequency.
The unmodulated pyramid wavefront sensor sensitivity function.
virtual realT beta_p(int m, int n, realT D, realT d, realT r0)
Get the photon noise sensitivity at a spatial frequency.
virtual realT beta_r(int m, int n, realT D, realT d, realT r0)
Get the read noise sensitivity at a spatial frequency.
The shack hartmann wavefront sensor sensitivity function.
virtual realT beta_p(int m, int n, realT D, realT d, realT r0)
Get the photon noise sensitivity at a spatial frequency.
virtual realT beta_r(int m, int n, realT D, realT d, realT r0)
Get the read noise sensitivity at a spatial frequency.
The ideal wavefront sensor sensitivity function.
virtual realT beta_r(int m, int n, realT D, realT d, realT r0)
Get the read noise sensitivity at a spatial frequency.
virtual realT beta_p(int m, int n, realT D, realT d, realT r0)
Get the photon noise sensitivity at a spatial frequency.
virtual ~wfs()
Destructor.
virtual iosT & dumpWFS(iosT &ios)
Dump the details of the WFS to an io stream.