API Reference#

The package pyzernike is composed of the following functions, classes, and modules. To learn how to use the package effectively, refer to the documentation Usage.

Generalities and notations about Zernike Polynomials#

For a polynomial of order/degree \(n\) and azimuthal frequency \(m\), the Zernike polynomial \(Z_{n}^{m}(\rho, \theta)\) is defined on the unit disk as:

\[Z_{n}^{m}(\rho, \theta) = R_{n}^{m}(\rho) \cos(m \theta) \quad \text{if} \quad m \geq 0\]
\[Z_{n}^{m}(\rho, \theta) = R_{n}^{-m}(\rho) \sin(-m \theta) \quad \text{if} \quad m < 0\]

Where \(R_{n}^{m}(\rho)\) is the radial polynomial defined as:

\[R_{n}^{m}(\rho) = \sum_{k=0}^{(n-m)/2} \frac{(-1)^k (n-k)!}{k! ((n+m)/2 - k)! ((n-m)/2 - k)!} \rho^{n-2k}\]

The derivative of order (derivative (a)) of the Zernike polynomial with respect to rho and order (derivative (b)) with respect to theta is defined as follows :

\[\frac{\partial^{a}\partial^{b}Z_{n}^{m}(\rho, \theta)}{\partial \rho^{a} \partial \theta^{b}} = \frac{\partial^{a}R_{n}^{m}(\rho)}{\partial \rho^{a}} \frac{\partial^{b}\cos(m \theta)}{\partial \theta^{b}} \quad \text{if} \quad m > 0\]

Note

Thus any polynomial evaluated at \((\rho, \theta)\) can be defined by 4 parameters :

  • n : order/degree of the polynomial noted n in the documentation

  • m : azimuthal frequency of the polynomial noted m in the documentation

  • a : order of the derivative with respect to \(\rho\) noted rho_derivative in the arguments.

  • b : order of the derivative with respect to \(\theta\) noted theta_derivative in the arguments.

Computation of the Polynomials#

  • radial_polynomial computes radial polynomials for several sets of [n, m, a] at once.

  • zernike_polynomial computes Zernike polynomials for several sets of [n, m, a, b] at once.

  • zernike_polynomial_up_to_order computes all Zernike polynomials up to a specified order for common sets of [a, b].

  • xy_zernike_polynomial computes the Zernike polynomial in Cartesian coordinates (x, y) in an extended elliptic annulus domain G.

Symbolic Expressions#

  • radial_symbolic obtains the symbolic sympy radial polynomials for several sets of [n, m, a] at once.

  • zernike_symbolic obtains the symbolic sympy Zernike polynomials for several sets of [n, m, a, b] at once.

Display#

  • radial_display displays the radial polynomials for several sets of [n, m, a] at once in a interactive plot.

  • zernike_display displays the Zernike polynomials for several sets of [n, m, a, b] at once in a interactive plot.

Additional Functions#

  • zernike_index_to_order converts Zernike OSA/ANSI indices to their corresponding orders (n, m).

  • zernike_order_to_index converts Zernike orders (n, m) to their corresponding OSA/ANSI indices.

  • cartesian_to_elliptic_annulus converts Cartesian coordinates (x, y) to elliptic annulus coordinates (rho, theta) in an extended elliptic annulus domain G.

  • xy_zernike_polynomial_up_to_order computes all the Zernike polynomials up to a specified order in Cartesian coordinates (x, y) in an extended elliptic annulus domain G.

Core Development#

For developers interested in the core functionalities of the package, the core module provides essential functions that underpin the computations and symbolic representations of Zernike polynomials.