mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
The Zernike Basis

int mx::sigproc::noll_nm (int &n, int &m, int j)
 Get the Zernike coefficients n,m corrresponding the Noll index j.
int mx::sigproc::noll_j (unsigned n, int m)
 Get the Noll index j corresponding to Zernike coefficients n,m.
int mx::sigproc::nZernRadOrd (unsigned n)
 Get the number of Zernikes up to and including a radial order.
template<typename realT>
int mx::sigproc::zernikeRCoeffs (std::vector< realT > &c, int n, int m)
 Calculate the coefficients of a Zernike radial polynomial.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
template<typename realT>
std::complex< realT > mx::sigproc::zernikeQ (realT k, realT phi, int n, int m)
 Calculate the square-normed Fourier transform of a Zernike polynomial at position (k,phi).
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).
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).
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.
template<typename realT>
realT mx::sigproc::zernikePPiston (const realT &kD)
 Calculate the spatial power spectrum of Piston.
template<typename realT>
realT mx::sigproc::zernikePTipTilt (const realT &kD)
 Calculate the spatial power spectrum of Tip & Tilt.
template<typename realT>
realT mx::sigproc::zernikePDefocus (const realT &kD)
 Calculate the spatial power spectrum of Defocus.
template<typename realT>
realT mx::sigproc::zernikePAstig (const realT &kD)
 Calculate the spatial power spectrum of Astigmatism.
template<typename realT>
realT mx::sigproc::zernikePComa (const realT &kD)
 Calculate the spatial power spectrum of Coma.
template<typename realT>
realT mx::sigproc::zernikePTrefoil (const realT &kD)
 Calculate the spatial power spectrum of Trefoil.
template<typename realT>
realT mx::sigproc::zernikeModeDOCKolmogorov (unsigned noll_j)
 Get the degrees of correction coefficient for Zernike polynomials in Kolmogorov turbulence.
template<typename realT>
realT mx::sigproc::zernikeModeDOCKolmogorov (unsigned noll_j, realT D, realT r_0)
 Get the degrees of correction for Zernike polynomials in Kolmogorov turbulence.
template<typename realT>
realT mx::sigproc::zernikeModeDOCDiffKolmogorov (unsigned noll_j)
 Get the difference in degrees of correction coefficient for Zernike polynomials in Kolmogorov turbulence.
template<typename realT>
realT mx::sigproc::zernikeModeDOCDiffKolmogorov (unsigned noll_j, realT D, realT r_0)
 Get the variance for a single Zernike polynomial in Kolmogorov turbulence.

Function Documentation

◆ noll_j()

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) [24] See also: http://en.wikipedia.org/wiki/Zernike_polynomials

Return values
>=0 on success
-1on error (n-m odd)
Parameters
[in]nn the radial index of the Zernike polynomial
[in]mm the azimuthal index of the Zernnike polynomial.

Referenced by zernikeModeDOCDiffKolmogorov(), zernikeModeDOCDiffKolmogorov(), zernikeModeDOCKolmogorov(), and zernikeModeDOCKolmogorov().

◆ noll_nm()

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) [24] See also: http://en.wikipedia.org/wiki/Zernike_polynomials

If j is odd, this returns m <= 0.

Return values
0on success
-1on error (j < 1)
Parameters
[out]nn the radial index of the Zernike polynomial
[out]mm the azimuthal index of the Zernnike polynomial. m < 0 if j odd.
[in]jj the Noll index, j > 0.

Definition at line 35 of file zernike.cpp.

References mx::invalidarg, mx::internal::mxlib_error_report(), and mx::math::func::sign().

Referenced by mx::AO::analysis::zernikeTemporalPSD< _realT, aosysT >::singleLayerPSD(), TEST_CASE(), zernike(), zernike(), zernikeQNorm(), and zernikeQNorm().

◆ nZernRadOrd()

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) [24] See also: http://en.wikipedia.org/wiki/Zernike_polynomials

Return values
thenumber of
-1on error (n-m odd)
Parameters
n[n] the radial order

◆ zernike() [1/7]

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.

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

Template Parameters
arrayTis an Eigen-like array of real floating type
calcRealTis a real floating type used for internal calculations, should be at least double
Parameters
[out]arrthe allocated array with an Eigen-like interface. The rows() and cols() members are used to size the polynomial.
[in]jthe Noll index of the polynomial
[in]rad[opt] the desired radius. If rad <= 0, then the maximum radius based on dimensions of m is used.

Definition at line 482 of file zernike.hpp.

References zernike().

◆ zernike() [2/7]

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.

Sets any pixel which is at rad <= r <= rad+0.5 pixels to rho = 1, to be consistent with mx::circularPupil

Template Parameters
realTis a real floating type
calcRealTis a real floating type used for internal calculations, should be at least double
Parameters
[out]arris the allocated array with an Eigen-like interface. The rows() and cols() members are used to size the polynomial.
[in]jis the Noll index of the polynomial
[in]xcenis the x coordinate of the desired center of the polynomial, in pixels
[in]ycenis the y coordinate of the desired center of the polynomial, in pixels
[in]radis the desired radius. If rad <= 0, then the maximum radius based on dimensions of m is used.

Definition at line 431 of file zernike.hpp.

References noll_nm(), and zernike().

◆ zernike() [3/7]

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.

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

Template Parameters
realTis a real floating type
calcRealTis a real floating type used for internal calculations, should be at least double
Parameters
[out]arrallocated array with an Eigen-like interface. The rows() and cols() members are used to size the polynomial.
[in]nthe radial index of the polynomial
[in]mthe azimuthal index of the polynomial
[in]rad[opt] the desired radius. If rad <= 0, then the maximum radius based on dimensions of m is used.

Definition at line 459 of file zernike.hpp.

References zernike().

◆ zernike() [4/7]

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.

Sets any pixel which is at rad <= r < rad+0.5 pixels to rho = 1, to be consistent with mx::circularPupil

Template Parameters
realTis a real floating type
calcRealTis a real floating type used for internal calculations, should be at least double
Parameters
[out]arrallocated array with an Eigen-like interface. The rows() and cols() members are used to size the polynomial.
[in]nthe radial index of the polynomial
[in]mthe azimuthal index of the polynomial
[in]xcenthe x coordinate of the desired center of the polynomial, in pixels
[in]ycenthe y coordinate of the desired center of the polynomial, in pixels
[in]radthe desired radius. If rad <= 0, then the maximum radius based on dimensions of m is used.

Definition at line 365 of file zernike.hpp.

References zernike(), and zernikeRCoeffs().

◆ zernike() [5/7]

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.

Return values
-9999indicates a possible error
Rthe value of the Zernike radial polynomial otherwise
Template Parameters
realTis a real floating type
calcRealTis a real floating type used for internal calculations, should be at least double
Parameters
[in]rhothe radial coordinate, \( 0 \le \rho \le 1 \).
[in]phithe azimuthal angle (in radians)
[in]jthe Noll index of the Zernike polynomial.

Definition at line 334 of file zernike.hpp.

References noll_nm(), and zernike().

◆ zernike() [6/7]

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.

Return values
-9999indicates a possible error
Rthe value of the Zernike radial polynomial otherwise
Template Parameters
realTis a real floating type
calcRealTis a real floating type used for internal calculations, should be at least double
Parameters
[in]rhothe radial coordinate, \( 0 \le \rho \le 1 \).
[in]phithe azimuthal angle (in radians)
[in]nthe radial index of the Zernike polynomial.
[in]mthe azimuthal index of the Zernike polynomial.

Definition at line 300 of file zernike.hpp.

References zernike(), and zernikeRCoeffs().

◆ zernike() [7/7]

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.

Return values
-9999indicates a possible error
Rthe value of the Zernike radial polynomial otherwise
Template Parameters
realTis a real floating type
calcRealTis a real floating type used for internal calculations, should be at least double
Parameters
[in]rhothe radial coordinate, \( 0 \le \rho \le 1 \).
[in]phithe azimuthal angle (in radians)
[in]nthe radial index of the Zernike polynomial.
[in]mthe azimuthal index of the Zernike polynomial.
[in]ccontains the radial polynomial coeeficients, and must be of length \( 0.5(n-m)+1\).

Definition at line 247 of file zernike.hpp.

References mx::math::root_two(), and zernikeR().

Referenced by zernike(), zernike(), zernike(), zernike(), zernike(), zernike(), and zernikeBasis().

◆ zernikeBasis()

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.

The cube is pre-allocated to set the image size and the number of modes.

Returns
0 on success
-1 on error
Template Parameters
cubeTis an Eigencube-like array with real floating point type
calcRealTis a real floating type used for internal calculations, should be at least double
Parameters
cube[in/out] the pre-allocated cube which will be filled with the Zernike basis
[in]rad[opt] the radius of the aperture. If -1 then the full image size is used.
[in]minj[opt] the minimum j value to include. The default is j=2, which skips piston (j=1).

Definition at line 506 of file zernike.hpp.

References zernike().

Referenced by mx::AO::makeModfBasis(), and mx::AO::makeZernikeBasis().

◆ zernikeModeDOCDiffKolmogorov() [1/2]

template<typename realT>
realT mx::sigproc::zernikeModeDOCDiffKolmogorov ( unsigned noll_j)

Get the difference in degrees of correction coefficient for Zernike polynomials in Kolmogorov turbulence.

Returns the difference in coefficients from Table IV of Noll (1976) [24] for the given index from the previous mode. Given this, the variance in radians-squared at wavelength \(\lambda\) for a diameter \(D\) aperture in the \(j\)-th mode can be calculated from

\[realT c = zernikeModeDOCDiffKolmogorov( j ); var_j_lambda = c * pow(D/r_0_lambda, math::five_thirds<realT>) \]

Returns
0 if noll_j is 0 or 1, indicating an error
the coefficient difference
Parameters
[in]noll_jthe mode index, must be greater than 1

Definition at line 888 of file zernike.hpp.

References mx::math::half_root_three(), and noll_j().

Referenced by zernikeModeDOCDiffKolmogorov().

◆ zernikeModeDOCDiffKolmogorov() [2/2]

template<typename realT>
realT mx::sigproc::zernikeModeDOCDiffKolmogorov ( unsigned noll_j,
realT D,
realT r_0 )

Get the variance for a single Zernike polynomial in Kolmogorov turbulence.

Returns the variance from Table IV of Noll (1976) [24] for the given mode index. For the $j$-th mode on a diameter $D$ aperture and Fried parameter $r_0$ this is equivalent to calculating

\[realT c = zernikeModeDOCDiffKolmogorov( j ); var_j_lambda = c * pow(D/r_0_lambda, math::five_thirds<realT>) \]

Returns
0 if noll_j is 0 or 1, indicating an error
the variance for the
Parameters
noll_jmode in radians squared.
Parameters
[in]noll_jthe mode index, must be greater than 0
[in]Dthe aperture diameter, in same units as r_0
r_0<[in] the Fried parameter, in same units as D

Definition at line 982 of file zernike.hpp.

References mx::math::five_thirds(), noll_j(), and zernikeModeDOCDiffKolmogorov().

◆ zernikeModeDOCKolmogorov() [1/2]

template<typename realT>
realT mx::sigproc::zernikeModeDOCKolmogorov ( unsigned noll_j)

Get the degrees of correction coefficient for Zernike polynomials in Kolmogorov turbulence.

Returns the coefficient from Table IV of Noll (1976) [24] for the given index. Given this, the total variance in radians at wavelength \(\lambda\) for a diameter \(D\) aperture after correcting \(j\) modes can be calculated from

\[realT c = zernikeModeDOCKolmogorov( j ); var_lambda = c * pow(D/r_0_lambda, math::five_thirds<realT>) \]

Returns
0 if noll_j is 0, indicating an error
the coefficient
Parameters
[in]noll_jthe mode index, must be greater than 0

Definition at line 769 of file zernike.hpp.

References mx::math::half_root_three(), and noll_j().

Referenced by zernikeModeDOCKolmogorov().

◆ zernikeModeDOCKolmogorov() [2/2]

template<typename realT>
realT mx::sigproc::zernikeModeDOCKolmogorov ( unsigned noll_j,
realT D,
realT r_0 )

Get the degrees of correction for Zernike polynomials in Kolmogorov turbulence.

Returns the degree of correction from Table IV of Noll (1976) [24] for the given index. This is the total variance in radians for Fried parameter $r_0$ for a diameter $D$. Equivalent to:

\[realT c = zernikeModeDOCKolmogorov( j ); var_lambda = c * pow(D/r_0_lambda, math::five_thirds<realT>) \]

Returns
0 if noll_j is 0, indicating an error
the coefficient
Parameters
[in]noll_jthe mode index, must be greater than 0
[in]Dthe aperture diameter, in same units as r_0
r_0<[in] the Fried parameter, in same units as D

Definition at line 862 of file zernike.hpp.

References mx::math::five_thirds(), noll_j(), and zernikeModeDOCKolmogorov().

◆ zernikePAstig()

template<typename realT>
realT mx::sigproc::zernikePAstig ( const realT & kD)

Calculate the spatial power spectrum of Astigmatism.

Parameters
[in]kDSpatial frequency in diameter units, i.e. cycles per aperture.

Definition at line 738 of file zernike.hpp.

References mx::math::func::jincN(), and mx::math::pi().

◆ zernikePComa()

template<typename realT>
realT mx::sigproc::zernikePComa ( const realT & kD)

Calculate the spatial power spectrum of Coma.

Parameters
[in]kDSpatial frequency in diameter units, i.e. cycles per aperture.

Definition at line 745 of file zernike.hpp.

References mx::math::func::jincN(), and mx::math::pi().

◆ zernikePDefocus()

template<typename realT>
realT mx::sigproc::zernikePDefocus ( const realT & kD)

Calculate the spatial power spectrum of Defocus.

Parameters
[in]kDSpatial frequency in diameter units, i.e. cycles per aperture.

Definition at line 731 of file zernike.hpp.

References mx::math::func::jincN(), and mx::math::pi().

◆ zernikePPiston()

template<typename realT>
realT mx::sigproc::zernikePPiston ( const realT & kD)

Calculate the spatial power spectrum of Piston.

Parameters
[in]kDSpatial frequency in diameter units, i.e. cycles per aperture.

Definition at line 717 of file zernike.hpp.

References mx::math::func::jinc(), and mx::math::pi().

◆ zernikePTipTilt()

template<typename realT>
realT mx::sigproc::zernikePTipTilt ( const realT & kD)

Calculate the spatial power spectrum of Tip & Tilt.

Parameters
[in]kDSpatial frequency in diameter units, i.e. cycles per aperture.

Definition at line 724 of file zernike.hpp.

References mx::math::func::jincN(), and mx::math::pi().

◆ zernikePTrefoil()

template<typename realT>
realT mx::sigproc::zernikePTrefoil ( const realT & kD)

Calculate the spatial power spectrum of Trefoil.

Parameters
[in]kDSpatial frequency in diameter units, i.e. cycles per aperture.

Definition at line 752 of file zernike.hpp.

References mx::math::func::jincN(), and mx::math::pi().

◆ zernikeQ()

template<typename realT>
std::complex< realT > mx::sigproc::zernikeQ ( 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) [24].

Todo
need a more robust jinc_n function for n > 1
Returns
the value of |Q(k,phi)|^2
Template Parameters
realTis the floating point type used for arithmetic
Parameters
[in]kthe radial coordinate of normalized spatial frequency. This is in the [24] convention of cycles-per-radius.
[in]phithe azimuthal coordinate of normalized spatial frequency
[in]nthe Zernike polynomial n
[in]mthe Zernike polynomial m

Definition at line 546 of file zernike.hpp.

References mx::math::func::bessel_j(), mx::math::pi(), and mx::math::two_pi().

◆ zernikeQNorm() [1/3]

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.

The array is filled in with \(\lvert Q(k,\phi)\rvert^2\) according to Equation (8) of Noll (1976).

Returns
0 on success
-1 on error
Template Parameters
arrayTis the Eigen-like array type. Arithmetic will be done in arrayT::Scalar.
Parameters
[out]arrthe allocated array. The rows() and cols() members are used to size the transform.
[in]kthe normalized spatial frequency magnitude at each pixel, in the Noll (1976) convention of cycles-per-radius.
[in]phithe spatial frequency angle at each pixel
[in]jthe polynomial index in the Noll convention [24]

Definition at line 681 of file zernike.hpp.

References mx::invalidarg, mx::internal::mxlib_error_report(), noll_nm(), and zernikeQNorm().

◆ zernikeQNorm() [2/3]

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).

Implements Equation (8) of Noll (1976) [24].

Returns
the value of |Q(k,phi)|^2
Template Parameters
realTis the floating point type used for arithmetic
Parameters
[in]kthe radial coordinate of normalized spatial frequency. This is in the [24] convention of cycles-per-radius.
[in]phithe azimuthal coordinate of normalized spatial frequency
[in]jthe Zernike polynomial index j (Noll convention)

Definition at line 658 of file zernike.hpp.

References noll_nm(), and zernikeQNorm().

◆ zernikeQNorm() [3/3]

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).

Implements Equation (8) of Noll (1976) [24].

Todo
need a more robust jinc_n function for n > 1
Returns
the value of |Q(k,phi)|^2
Template Parameters
realTis the floating point type used for arithmetic
Parameters
[in]kthe radial coordinate of normalized spatial frequency. This is in the [24] convention of cycles-per-radius.
[in]phithe azimuthal coordinate of normalized spatial frequency
[in]nthe Zernike polynomial n
[in]mthe Zernike polynomial m

Definition at line 598 of file zernike.hpp.

References mx::math::func::bessel_j(), mx::math::pi(), and mx::math::two_pi().

Referenced by mx::AO::analysis::F_zernike(), TEST_CASE(), zernikeQNorm(), and zernikeQNorm().

◆ zernikeR() [1/2]

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.

Return values
-9999indicates a possible error
Rthe value of the Zernike radial polynomial otherwise
Template Parameters
realTis a real floating type
calcRealTis a real floating type used for internal calculations, should be at least double
Parameters
[in]rhothe radial coordinate, \( 0 \le \rho \le 1 \).
[in]nthe radial index of the Zernike polynomial.
[in]mthe azimuthal index of the Zernike polynomial.

Definition at line 207 of file zernike.hpp.

References zernikeR(), and zernikeRCoeffs().

◆ zernikeR() [2/2]

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.

Return values
-9999indicates a possible error
Rthe value of the Zernike radial polynomial otherwise
Template Parameters
realTis a real floating type
calcRealTis a real floating type used for internal calcs, should be at least double.
Parameters
[in]rhothe radial coordinate, \( 0 \le \rho \le 1 \).
[in]nthe radial index of the Zernike polynomial.
[in]mthe azimuthal index of the Zernike polynomial.
[in]ccontains the radial polynomial coeeficients, and must be of length \( 0.5(n-m)+1\).

Definition at line 156 of file zernike.hpp.

References mx::invalidarg, and mx::internal::mxlib_error_report().

Referenced by zernike(), and zernikeR().

◆ zernikeRCoeffs()

template<typename realT>
int mx::sigproc::zernikeRCoeffs ( std::vector< realT > & c,
int n,
int m )

Calculate the coefficients of a Zernike radial polynomial.

Return values
0on success
-1on error
Template Parameters
realTis a real floating type
Parameters
[out]callocated to length \( 0.5(n-m)+1\) and filled with the coefficients.
[in]nthe radial index of the Zernike polynomial.
[in]mthe azimuthal index of the Zernike polynomial.

Definition at line 100 of file zernike.hpp.

References mx::math::func::factorial(), mx::invalidarg, and mx::internal::mxlib_error_report().

Referenced by zernike(), zernike(), and zernikeR().