8#ifndef __zernikeBasis_hpp__
9#define __zernikeBasis_hpp__
30template <
typename realT>
31void makeZernikeBasis(
const std::string &basisName,
const std::string &pupilName,
int dim,
int N )
35 rawModes.resize( dim, dim, N );
39 Eigen::Array<realT, -1, -1> pupil;
42 ff.
read( pupil, pupilFName );
44 realT psum = pupil.sum();
47 for(
int i = 0; i < rawModes.planes(); ++i )
49 rawModes.
image( i ) *= pupil;
51 norm = rawModes.
image( i ).square().sum() / psum;
53 rawModes.
image( i ) /= sqrt( norm );
63 std::string fName = mx::AO::path::basis::modes( basisName,
true );
65 ff.
write( fName, rawModes );
Standardized paths for the mx::AO system.
std::string pupilFile(const std::string &pupilName, bool create=false)
The path for the pupil FITS file.
Class to manage interactions with a FITS file.
error_t read(dataT *data)
Read the contents of the FITS file into an array.
error_t write(const dataT *im, int d1, int d2, int d3, fitsHeader< verboseT > *head)
Write the contents of a raw array to the FITS file.
An image cube with an Eigen-like API.
Eigen::Map< Eigen::Array< dataT, Eigen::Dynamic, Eigen::Dynamic > > image(Index n)
Returns a 2D Eigen::Eigen::Map pointed at the specified image.
An image cube with an Eigen API.
Declares and defines a class to work with a FITS file.
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.
Working with the Zernike polynomials.