mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
int | mx::sigproc::noll_nm (int &n, int &m, int j) |
Get the Zernike coefficients n,m corrresponding the Noll index j. More... | |
int | mx::sigproc::noll_j (unsigned n, int m) |
Get the Noll index j corresponding to Zernike coefficients n,m. More... | |
int | mx::sigproc::nZernRadOrd (unsigned n) |
Get the number of Zernikes up to and including a radial order. More... | |
template<typename realT > | |
int | mx::sigproc::zernikeRCoeffs (std::vector< realT > &c, int n, int m) |
Calculate the coefficients of a Zernike radial polynomial. More... | |
template<typename realT , typename calcRealT > | |
realT | mx::sigproc::zernikeR (realT rho, int n, int m, std::vector< calcRealT > &c) |
Calculate the value of a Zernike radial polynomial at a given separation. More... | |
template<typename realT , typename calcRealT > | |
realT | mx::sigproc::zernikeR (realT rho, int n, int m) |
Calculate the value of a Zernike radial polynomial at a given separation. More... | |
template<typename realT , typename calcRealT > | |
realT | mx::sigproc::zernike (realT rho, realT phi, int n, int m, std::vector< calcRealT > &c) |
Calculate the value of a Zernike radial polynomial at a given radius and angle. More... | |
template<typename realT , typename calcRealT > | |
realT | mx::sigproc::zernike (realT rho, realT phi, int n, int m) |
Calculate the value of a Zernike radial polynomial at a given radius and angle. More... | |
template<typename realT , typename calcRealT > | |
realT | mx::sigproc::zernike (realT rho, realT phi, int j) |
Calculate the value of a Zernike radial polynomial at a given radius and angle. More... | |
template<typename arrayT , typename calcRealT , int overscan = 2> | |
int | mx::sigproc::zernike (arrayT &arr, int n, int m, typename arrayT::Scalar xcen, typename arrayT::Scalar ycen, typename arrayT::Scalar rad=-1) |
Fill in an Eigen-like array with a Zernike polynomial. More... | |
template<typename arrayT , typename calcRealT > | |
int | mx::sigproc::zernike (arrayT &arr, int j, typename arrayT::Scalar xcen, typename arrayT::Scalar ycen, typename arrayT::Scalar rad=-1) |
Fill in an Eigen-like array with a Zernike polynomial. More... | |
template<typename arrayT , typename calcRealT > | |
int | mx::sigproc::zernike (arrayT &arr, int n, int m, typename arrayT::Scalar rad=-1) |
Fill in an Eigen-like array with a Zernike polynomial. More... | |
template<typename arrayT , typename calcRealT > | |
int | mx::sigproc::zernike (arrayT &arr, int j, typename arrayT::Scalar rad=-1) |
Fill in an Eigen-like array with a Zernike polynomial. More... | |
template<typename cubeT , typename calcRealT > | |
int | mx::sigproc::zernikeBasis (cubeT &cube, typename cubeT::Scalar rad=-1, int minj=2) |
Fill in an Eigencube-like array with Zernike polynomials in Noll order. More... | |
template<typename realT > | |
realT | mx::sigproc::zernikeQNorm (realT k, realT phi, int n, int m) |
Calculate the square-normed Fourier transform of a Zernike polynomial at position (k,phi) More... | |
template<typename realT > | |
realT | mx::sigproc::zernikeQNorm (realT k, realT phi, int j) |
Calculate the square-normed Fourier transform of a Zernike polynomial at position (k,phi) More... | |
template<typename arrayT > | |
int | mx::sigproc::zernikeQNorm (arrayT &arr, arrayT &k, arrayT &phi, int j) |
Fill in an Eigen-like array with the square-normed Fourier transform of a Zernike polynomial. More... | |
template<typename realT > | |
realT | mx::sigproc::zernikePPiston (const realT &kD) |
Calculate the spatial power spectrum of Piston. More... | |
template<typename realT > | |
realT | mx::sigproc::zernikePTipTilt (const realT &kD) |
Calculate the spatial power spectrum of Tip & Tilt. More... | |
template<typename realT > | |
realT | mx::sigproc::zernikePDefocus (const realT &kD) |
Calculate the spatial power spectrum of Defocus. More... | |
template<typename realT > | |
realT | mx::sigproc::zernikePAstig (const realT &kD) |
Calculate the spatial power spectrum of Astigmatism. More... | |
template<typename realT > | |
realT | mx::sigproc::zernikePComa (const realT &kD) |
Calculate the spatial power spectrum of Coma. More... | |
template<typename realT > | |
realT | mx::sigproc::zernikePTrefoil (const realT &kD) |
Calculate the spatial power spectrum of Trefoil. More... | |
int mx::sigproc::noll_j | ( | unsigned | n, |
int | m | ||
) |
Get the Noll index j corresponding to Zernike coefficients n,m.
Calculates the value j for(n,m) following Noll (1976) [17] See also: http://en.wikipedia.org/wiki/Zernike_polynomials
>= | 0 on success |
-1 | on error (n-m odd) |
[in] | n | n the radial index of the Zernike polynomial |
[in] | m | m the azimuthal index of the Zernnike polynomial. |
int mx::sigproc::noll_nm | ( | int & | n, |
int & | m, | ||
int | j | ||
) |
Get the Zernike coefficients n,m corrresponding the Noll index j.
Calculates the values of (n,m) for an index j following Noll (1976) [17] See also: http://en.wikipedia.org/wiki/Zernike_polynomials
If j is odd, this returns m <= 0.
0 | on success |
-1 | on error (j < 1) |
[out] | n | n the radial index of the Zernike polynomial |
[out] | m | m the azimuthal index of the Zernnike polynomial. m < 0 if j odd. |
[in] | j | j the Noll index, j > 0. |
Definition at line 38 of file zernike.cpp.
References mx::math::func::sign().
Referenced by SCENARIO(), mx::AO::analysis::zernikeTemporalPSD< _realT, aosysT >::singleLayerPSD(), mx::sigproc::zernike(), and mx::sigproc::zernikeQNorm().
int mx::sigproc::nZernRadOrd | ( | unsigned | n | ) |
Get the number of Zernikes up to and including a radial order.
Calculates the total number of Zernike polynomials through radial order n
. See Noll (1976) [17] See also: http://en.wikipedia.org/wiki/Zernike_polynomials
the | number of |
-1 | on error (n-m odd) |
n | [n] the radial order |
int mx::sigproc::zernike | ( | arrayT & | arr, |
int | j, | ||
typename arrayT::Scalar | rad = -1 |
||
) |
Fill in an Eigen-like array with a Zernike polynomial.
The geometric center of the array, 0.5*(arr.rows()-1), 0.5*(arr.cols()-1), is used as the center. Sets any pixel which is at rad <= r < rad+0.5 pixels to rho = 1, to be consistent with mx::circularPupil
[out] | arr | is the allocated array with an Eigen-like interface. The rows() and cols() members are used to size the polynomial. |
[in] | j | is the Noll index of the polynomial |
[in] | rad | [optional] is the desired radius. If rad <= 0, then the maximum radius based on dimensions of m is used. |
arrayT | is an Eigen-like array of real floating type |
calcRealT | is a real floating type used for internal calculations, should be at least double |
Definition at line 511 of file zernike.hpp.
int mx::sigproc::zernike | ( | arrayT & | arr, |
int | j, | ||
typename arrayT::Scalar | xcen, | ||
typename arrayT::Scalar | ycen, | ||
typename arrayT::Scalar | rad = -1 |
||
) |
Fill in an Eigen-like array with a Zernike polynomial.
Sets any pixel which is at rad <= r <= rad+0.5 pixels to rho = 1, to be consistent with mx::circularPupil
[out] | arr | is the allocated array with an Eigen-like interface. The rows() and cols() members are used to size the polynomial. |
[in] | j | is the Noll index of the polynomial |
[in] | xcen | is the x coordinate of the desired center of the polynomial, in pixels |
[in] | ycen | is the y coordinate of the desired center of the polynomial, in pixels |
[in] | rad | [optional] is the desired radius. If rad <= 0, then the maximum radius based on dimensions of m is used. |
realT | is a real floating type |
calcRealT | is a real floating type used for internal calculations, should be at least double |
Definition at line 461 of file zernike.hpp.
int mx::sigproc::zernike | ( | arrayT & | arr, |
int | n, | ||
int | m, | ||
typename arrayT::Scalar | rad = -1 |
||
) |
Fill in an Eigen-like array with a Zernike polynomial.
The geometric center of the array, 0.5*(arr.rows()-1), 0.5*(arr.cols()-1), is used as the center. Sets any pixel which is at rad <= r < rad+0.5 pixels to rho = 1, to be consistent with mx::circularPupil
[out] | arr | is the allocated array with an Eigen-like interface. The rows() and cols() members are used to size the polynomial. |
[in] | j | is the Noll index of the polynomial |
[in] | rad | [optional] is the desired radius. If rad <= 0, then the maximum radius based on dimensions of m is used. |
realT | is a real floating type |
calcRealT | is a real floating type used for internal calculations, should be at least double |
Definition at line 488 of file zernike.hpp.
int mx::sigproc::zernike | ( | arrayT & | arr, |
int | n, | ||
int | m, | ||
typename arrayT::Scalar | xcen, | ||
typename arrayT::Scalar | ycen, | ||
typename arrayT::Scalar | rad = -1 |
||
) |
Fill in an Eigen-like array with a Zernike polynomial.
Sets any pixel which is at rad <= r < rad+0.5 pixels to rho = 1, to be consistent with mx::circularPupil
[out] | arr | is the allocated array with an Eigen-like interface. The rows() and cols() members are used to size the polynomial. |
[in] | n | is the radial index of the polynomial |
[in] | m | is the azimuthal index of the polynomial |
[in] | xcen | is the x coordinate of the desired center of the polynomial, in pixels |
[in] | ycen | is the y coordinate of the desired center of the polynomial, in pixels |
[in] | rad | [optional] is the desired radius. If rad <= 0, then the maximum radius based on dimensions of m is used. |
realT | is a real floating type |
calcRealT | is a real floating type used for internal calculations, should be at least double |
Definition at line 397 of file zernike.hpp.
realT mx::sigproc::zernike | ( | realT | rho, |
realT | phi, | ||
int | j | ||
) |
Calculate the value of a Zernike radial polynomial at a given radius and angle.
-9999 | indicates a possible error |
R | the value of the Zernike radial polynomial otherwise |
realT | is a real floating type |
calcRealT | is a real floating type used for internal calculations, should be at least double |
[in] | rho | the radial coordinate, \( 0 \le \rho \le 1 \). |
[in] | phi | the azimuthal angle (in radians) |
[in] | j | the Noll index of the Zernike polynomial. |
Definition at line 356 of file zernike.hpp.
References mx::sigproc::noll_nm().
realT mx::sigproc::zernike | ( | realT | rho, |
realT | phi, | ||
int | n, | ||
int | m | ||
) |
Calculate the value of a Zernike radial polynomial at a given radius and angle.
-9999 | indicates a possible error |
R | the value of the Zernike radial polynomial otherwise |
realT | is a real floating type |
calcRealT | is a real floating type used for internal calculations, should be at least double |
[in] | rho | the radial coordinate, \( 0 \le \rho \le 1 \). |
[in] | phi | the azimuthal angle (in radians) |
[in] | n | the radial index of the Zernike polynomial. |
[in] | m | the azimuthal index of the Zernike polynomial. |
Definition at line 319 of file zernike.hpp.
References mx::astro::constants::c().
realT mx::sigproc::zernike | ( | realT | rho, |
realT | phi, | ||
int | n, | ||
int | m, | ||
std::vector< calcRealT > & | c | ||
) |
Calculate the value of a Zernike radial polynomial at a given radius and angle.
[in] | rho | is the radial coordinate, \( 0 \le \rho \le 1 \). |
[in] | phi | is the azimuthal angle (in radians) |
[in] | n | is the radial index of the Zernike polynomial. |
[in] | m | is the azimuthal index of the Zernike polynomial. |
[in] | c | is contains the radial polynomial coeeficients, and must be of length \( 0.5(n-m)+1\). |
-9999 | indicates a possible error |
R | the value of the Zernike radial polynomial otherwise |
realT | is a real floating type |
calcRealT | is a real floating type used for internal calculations, should be at least double |
Definition at line 264 of file zernike.hpp.
References mx::astro::constants::c().
int mx::sigproc::zernikeBasis | ( | cubeT & | cube, |
typename cubeT::Scalar | rad = -1 , |
||
int | minj = 2 |
||
) |
Fill in an Eigencube-like array with Zernike polynomials in Noll order.
The cube is pre-allocated to set the image size and the number of modes.
cubeT | is an Eigencube-like array with real floating point type |
calcRealT | is a real floating type used for internal calculations, should be at least double |
cube | [in.out] the pre-allocated cube which will be filled with the Zernike basis | |
[in] | rad | [optional] the radius of the aperture. If -1 then the full image size is used. |
[in] | minj | [optional] the minimum j value to include. The default is j=2, which skips piston (j=1). |
Definition at line 531 of file zernike.hpp.
Referenced by mx::AO::makeZernikeBasis().
realT mx::sigproc::zernikePAstig | ( | const realT & | kD | ) |
Calculate the spatial power spectrum of Astigmatism.
[in] | kD | Spatial frequency in diameter units, i.e. cycles per aperture. |
Definition at line 704 of file zernike.hpp.
References mx::math::func::jincN().
realT mx::sigproc::zernikePComa | ( | const realT & | kD | ) |
Calculate the spatial power spectrum of Coma.
[in] | kD | Spatial frequency in diameter units, i.e. cycles per aperture. |
Definition at line 711 of file zernike.hpp.
References mx::math::func::jincN().
realT mx::sigproc::zernikePDefocus | ( | const realT & | kD | ) |
Calculate the spatial power spectrum of Defocus.
[in] | kD | Spatial frequency in diameter units, i.e. cycles per aperture. |
Definition at line 697 of file zernike.hpp.
References mx::math::func::jincN().
realT mx::sigproc::zernikePPiston | ( | const realT & | kD | ) |
Calculate the spatial power spectrum of Piston.
[in] | kD | Spatial frequency in diameter units, i.e. cycles per aperture. |
Definition at line 683 of file zernike.hpp.
References mx::math::func::jinc().
realT mx::sigproc::zernikePTipTilt | ( | const realT & | kD | ) |
Calculate the spatial power spectrum of Tip & Tilt.
[in] | kD | Spatial frequency in diameter units, i.e. cycles per aperture. |
Definition at line 690 of file zernike.hpp.
References mx::math::func::jincN().
realT mx::sigproc::zernikePTrefoil | ( | const realT & | kD | ) |
Calculate the spatial power spectrum of Trefoil.
[in] | kD | Spatial frequency in diameter units, i.e. cycles per aperture. |
Definition at line 718 of file zernike.hpp.
References mx::math::func::jincN().
int mx::sigproc::zernikeQNorm | ( | arrayT & | arr, |
arrayT & | k, | ||
arrayT & | phi, | ||
int | j | ||
) |
Fill in an Eigen-like array with the square-normed Fourier transform of a Zernike polynomial.
The array is filled in with the values of |Q(k,phi)|^2 according to Equation (8) of Noll (1976) [17].
arrayT | is the Eigen-like array type. Arithmetic will be done in arrayT::Scalar. |
[out] | arr | the allocated array. The rows() and cols() members are used to size the transform. |
[in] | k | the normalized spatial frequency magnitude at each pixel. This is in the [17] convention of cycles-per-radius. |
[in] | phi | the spatial frequency angle at each pixel |
[in] | j | the polynomial index in the Noll convention [17] |
Definition at line 650 of file zernike.hpp.
References mx::astro::constants::k(), and mx::sigproc::noll_nm().
Referenced by mx::sigproc::zernikeQNorm().
realT mx::sigproc::zernikeQNorm | ( | realT | k, |
realT | phi, | ||
int | j | ||
) |
Calculate the square-normed Fourier transform of a Zernike polynomial at position (k,phi)
Implements Equation (8) of Noll (1976) [17].
realT | is the floating point type used for arithmetic |
[in] | k | the radial coordinate of normalized spatial frequency. This is in the [17] convention of cycles-per-radius. |
[in] | phi | the azimuthal coordinate of normalized spatial frequency |
[in] | j | the Zernike polynomial index j (Noll convention) |
Definition at line 627 of file zernike.hpp.
References mx::astro::constants::k(), mx::sigproc::noll_nm(), and mx::sigproc::zernikeQNorm().
realT mx::sigproc::zernikeQNorm | ( | realT | k, |
realT | phi, | ||
int | n, | ||
int | m | ||
) |
Calculate the square-normed Fourier transform of a Zernike polynomial at position (k,phi)
Implements Equation (8) of Noll (1976) [17].
realT | is the floating point type used for arithmetic |
[in] | k | the radial coordinate of normalized spatial frequency. This is in the [17] convention of cycles-per-radius. |
[in] | phi | the azimuthal coordinate of normalized spatial frequency |
[in] | n | the Zernike polynomial n |
[in] | m | the Zernike polynomial m |
Definition at line 569 of file zernike.hpp.
References mx::math::func::bessel_j(), and mx::astro::constants::k().
Referenced by mx::AO::analysis::F_zernike(), and SCENARIO().
realT mx::sigproc::zernikeR | ( | realT | rho, |
int | n, | ||
int | m | ||
) |
Calculate the value of a Zernike radial polynomial at a given separation.
-9999 | indicates a possible error |
R | the value of the Zernike radial polynomial otherwise |
realT | is a real floating type |
calcRealT | is a real floating type used for internal calculations, should be at least double |
[in] | rho | the radial coordinate, \( 0 \le \rho \le 1 \). |
[in] | n | the radial index of the Zernike polynomial. |
[in] | m | the azimuthal index of the Zernike polynomial. |
Definition at line 214 of file zernike.hpp.
References mx::astro::constants::c(), and mx::sigproc::zernikeRCoeffs().
realT mx::sigproc::zernikeR | ( | realT | rho, |
int | n, | ||
int | m, | ||
std::vector< calcRealT > & | c | ||
) |
Calculate the value of a Zernike radial polynomial at a given separation.
-9999 | indicates a possible error |
R | the value of the Zernike radial polynomial otherwise |
realT | is a real floating type |
calcRealT | is a real floating type used for internal calcs, should be at least double. |
[in] | rho | the radial coordinate, \( 0 \le \rho \le 1 \). |
[in] | n | the radial index of the Zernike polynomial. |
[in] | m | the azimuthal index of the Zernike polynomial. |
[in] | c | contains the radial polynomial coeeficients, and must be of length \( 0.5(n-m)+1\). |
Definition at line 160 of file zernike.hpp.
References mx::astro::constants::c(), and mx::astro::constants::k().
int mx::sigproc::zernikeRCoeffs | ( | std::vector< realT > & | c, |
int | n, | ||
int | m | ||
) |
Calculate the coefficients of a Zernike radial polynomial.
0 | on success |
-1 | on error |
realT | is a real floating type |
[out] | c | allocated to length \( 0.5(n-m)+1\) and filled with the coefficients. |
[in] | n | the radial index of the Zernike polynomial. |
[in] | m | the azimuthal index of the Zernike polynomial. |
Definition at line 103 of file zernike.hpp.
References mx::astro::constants::c(), and mx::astro::constants::k().
Referenced by mx::sigproc::zernikeR().