API Reference#
All the functions are available at the top level of the package (import pyzernike then
pyzernike.zernike_polynomial(...)). To learn how to use them, see Usage; for the definitions and the
methods, see Mathematical description.
Common arguments#
The functions share the same names of arguments and the same conventions:
Argument |
Meaning |
|---|---|
|
Polar coordinates on the unit disk (\(0 \leq \rho \leq 1\), \(\theta\) in radians). |
|
Cartesian coordinates, for the functions prefixed by |
|
Radial order \(n\) and azimuthal frequency \(m\) of a polynomial \(Z_{n}^{m}\) (\(|m| \leq n\), \(n - m\) even). See Definition and conventions. |
|
Maximum radial order \(N\): all the \(P = \frac{(N+1)(N+2)}{2}\) polynomials with \(n \leq N\) are used, in the OSA/ANSI ordering. |
|
Orders \(a\) and \(b\) of the derivatives with respect to \(\rho\) and \(\theta\). |
|
Orders \(d_x\) and \(d_y\) of the derivatives with respect to \(x\) and \(y\). |
|
Parameters of the elliptic annulus: semi-axes, center, rotation angle (radians) and ratio \(h \in [0, 1)\) of the inner to the outer semi-axes. The default is the unit disk. See Extension to an elliptic annulus. |
|
Coefficients \(c_j\) of a sum \(\sum_j c_j Z_j\), in the OSA/ANSI ordering, for all the polynomials up to an order (1, 3, 6, 10, 15, … values). See Coefficients of a sum of polynomials. |
|
If True, the polynomials (or the coefficients) are those normalized by the factors of Noll. |
|
If True, the polynomials are computed with the recurrence relation (recommended for high orders). |
|
Value set outside the domain ( |
|
Output as a list of arrays (True) or as a single array (False). |
Single integers and sequences of integers can be mixed for n, m and the derivative orders: the integers
are repeated to the length of the sequences.
Polynomials on the unit disk#
Zernike polynomials \(Z_{n}^{m}(\rho, \theta)\) and their derivatives, for given \((n, m)\). |
|
All the Zernike polynomials up to an order and their derivatives. |
|
Radial polynomials \(R_{n}^{m}(\rho)\) and their derivatives. |
Polynomials on an elliptic annulus#
Zernike polynomials in Cartesian coordinates on an elliptic annulus, and their derivatives of any order with respect to \(x\) and \(y\). |
|
All the Zernike polynomials up to an order on an elliptic annulus, and their derivatives. |
|
Derivatives of the polynomials with respect to the parameters \((x_0, y_0, R_x, R_y, \alpha, h)\) of the annulus. |
|
Equivalent polar coordinates \((\rho_{eq}, \theta_{eq})\) of Cartesian points, and their derivatives. |
Indexing and normalization#
Orders \((n, m)\) of indices in the OSA/ANSI, Noll or Fringe convention. |
|
Indices of orders \((n, m)\) in the OSA/ANSI, Noll or Fringe convention. |
|
Number of polynomials up to an order. |
|
Normalization factors of Noll. |
Coefficients#
Sum of polynomials \(\sum_j c_j Z_j\) and its derivatives on the unit disk. |
|
Sum of polynomials and its derivatives on an elliptic annulus. |
|
Conversion of coefficients between the indexing conventions and the normalizations. |
|
Coefficients in a rotated pupil. |
|
Coefficients in a scaled, decentered and rotated pupil. |
|
Root mean square of a sum of polynomials. |
|
Peak-to-valley of a sum of polynomials. |
|
Strehl ratio of a wavefront (extended Maréchal approximation). |
Fitting#
Least squares fit of sampled data on the unit disk. |
|
Least squares fit of sampled data on an elliptic annulus. |
|
Residual and Jacobian functions to estimate the parameters of the annulus with any least squares solver. |
Symbolic expressions#
These functions require sympy (pip install sympy, see Installation).
Exact |
|
Exact |
Display#
These functions require matplotlib (pip install matplotlib, see Installation).
Figure of given Zernike polynomials on the unit disk. |
|
Figure of given radial polynomials. |
|
Interactive window to explore the polynomials on the unit disk (command |
|
Figure of given Zernike polynomials on an elliptic annulus. |
|
Interactive window to explore the polynomials on an elliptic annulus (command |