8 #ifndef __zernikeBasis_hpp__
9 #define __zernikeBasis_hpp__
11 #include "../sigproc/zernike.hpp"
12 #include "../improc/fitsFile.hpp"
29 template<
typename realT>
31 const std::string & pupilName,
37 rawModes.resize(dim, dim, N);
40 std::string pupilFName = mx::AO::path::pupil::pupilFile(pupilName);
41 Eigen::Array<realT, -1, -1> pupil;
43 mx::improc::fitsFile<realT> ff;
44 ff.read(pupil, pupilFName);
46 realT psum = pupil.sum();
49 for(
int i=0; i< rawModes.planes(); ++i)
51 rawModes.
image(i) *= pupil;
53 norm = rawModes.
image(i).square().sum()/psum;
55 rawModes.
image(i)/= sqrt(norm);
73 std::string fName = mx::AO::path::basis::modes(basisName,
true);
75 ff.write(fName, rawModes);
Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic > > image(Index n)
Returns a 2D Eigen::Eigen::Map pointed at the specified image.
int zernikeBasis(cubeT &cube, typename cubeT::Scalar rad=-1, int minj=2)
Fill in an Eigencube-like array with Zernike polynomials in Noll order.
void makeZernikeBasis(const std::string &basisName, const std::string &pupilName, int dim, int N)
Make the Zernike basis.