11 #include "../../math/constants.hpp"
12 #include "../../mxError.hpp"
13 #include "../../mxException.hpp"
14 #include "../../improc/eigenImage.hpp"
15 #include "../../ioutils/fits/fitsFile.hpp"
37 template<
typename realT,
typename iosT = std::ostream>
75 static_cast<void>(r0);
77 return static_cast<realT
>(1);
100 ios <<
"# WFS Parameters:\n";
101 ios <<
"# ID = " << _id <<
'\n';
116 template<
typename realT,
typename iosT = std::ostream>
121 this->_id =
"Unmodulated Pyramid";
137 static_cast<void>(m);
138 static_cast<void>(n);
139 static_cast<void>(D);
140 static_cast<void>(d);
141 static_cast<void>(r0);
143 return math::root_two<realT>();
158 return beta_p(m,n,D,d,r0);
173 template<
typename realT,
typename iosT = std::ostream>
178 this->_id =
"Asymptotic Modulated Pyramid";
194 static_cast<void>(m);
195 static_cast<void>(n);
196 static_cast<void>(D);
197 static_cast<void>(d);
198 static_cast<void>(r0);
200 return static_cast<realT
>(2) * math::root_two<realT>();
215 return beta_p(m,m,D,d,r0);
229 template<
typename realT,
typename iosT = std::ostream>
234 this->_id =
"Shack Hartmann";
249 realT
k = sqrt(m*m + n*n)/D;
251 return 1.48/(
k*d)*sqrt(1 + pow(d/r0,2));
267 return beta_p(m,n,D,d,r0);
281 template<
typename realT,
typename iosT = std::ostream>
284 std::string m_beta_p_file;
285 std::string m_beta_r_file;
286 bool m_sensitivity {
false};
293 this->_id =
"Calculated WFS";
308 if(m_beta_p.rows() == 0)
311 ff.
read(m_beta_p, m_beta_p_file);
313 if(m_sensitivity) m_beta_p = 1.0/m_beta_p;
316 int midx = 0.5*(m_beta_p.rows()-1.0) + m;
317 int nidx = 0.5*(m_beta_p.cols()-1.0) + n;
319 if(midx > m_beta_p.rows()-1 || midx < 0)
321 mxThrowException(
err::sizeerr,
"calculatedWFS::beta_p",
"m index out of range");
324 if(nidx > m_beta_p.cols()-1 || nidx < 0)
326 mxThrowException(
err::sizeerr,
"calculatedWFS::beta_p",
"n index out of range");
329 return m_beta_p(midx,nidx);
345 if(m_beta_r.rows() == 0)
348 ff.
read(m_beta_r, m_beta_r_file);
350 if(m_sensitivity) m_beta_r = 1.0/m_beta_r;
353 int midx = 0.5*(m_beta_r.rows()-1.0) + m;
354 int nidx = 0.5*(m_beta_r.cols()-1.0) + n;
356 if(midx > m_beta_r.rows()-1 || midx < 0)
358 mxThrowException(
err::sizeerr,
"calculatedWFS::beta_r",
"m index out of range");
361 if(nidx > m_beta_r.cols()-1 || nidx < 0)
363 mxThrowException(
err::sizeerr,
"calculatedWFS::beta_r",
"n index out of range");
366 return m_beta_r(midx,nidx);
377 ios <<
"# beta_p = " << m_beta_p_file <<
'\n';
378 ios <<
"# beta_r = " << m_beta_r_file <<
'\n';
379 ios <<
"# sensitivity = " << std::boolalpha << m_sensitivity <<
"\n";
mxException for a size error
Class to manage interactions with a FITS file.
int read(dataT *data)
Read the contents of the FITS file into an array.
constexpr units::realT k()
Boltzmann Constant.
Eigen::Array< scalarT, -1, -1 > eigenImage
Definition of the eigenImage type, which is an alias for Eigen::Array.
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.