U¶
- pyoof.zernike.U(n, l, rho, theta)[source]¶
Zernike circle polynomials generator (\(U^\ell_n(\varrho, \varphi)\) from Born & Wolf definition). The \(\ell\), \(n\) are integers, \(n \geqslant 0\) and \(n - |\ell|\) even. Expansion of a complete set of orthonormal polynomials in a unitary circle, specially useful when computing for the wavefront (aberration) distribution, \(W(x, y)\). The total number of polynomials is given by \((n + 1)(n + 2) / 2.\)
- Parameters
- n
int
It is \(n \geqslant 0\). Relative to radial component.
- l
int
l Can be positive or negative, relative to angle component.
- rho
ndarray
Values for the radial component. \(\varrho = \sqrt{x^2 + y^2}\).
- theta
ndarray
Values for the angular component. For a rectangular grid x and y are evaluated as \(\vartheta = \mathrm{arctan}(y / x)\).
- n
- Returns
- zernike_circle_poly
ndarray
Zernike circle polynomial already evaluated, \(U^\ell_n(\varrho, \varphi)\).
- zernike_circle_poly
- Raises
TypeError
If the angle component
l
is not an integer or when the (radial) ordern
is not a positive integer.
Notes
The generating formula for the Zernike circle polymials make use of the radial polynomials, then,
\[U^\ell_n(\varrho, \vartheta) = R^m_n(\varrho) \cdot \cos m\vartheta \qquad \ell \geq 0,\]\[U^\ell_n(\varrho, \vartheta) = R^m_n(\varrho) \cdot \sin m\vartheta \qquad \ell < 0.\]Examples
Same as the radial polynomials, just start with the package and then apply the order, \(n\), and angular dependence, \(\ell\), on the function.
>>> import numpy as np >>> from astropy import units as u >>> from pyoof import zernike, cart2pol >>> x = np.linspace(-10, 10, 5) * u.m >>> r, t = cart2pol(x, x) # polar coordinates >>> zernike.U(n=4, l=-2, rho=r / r.max(), theta=t) <Quantity [ 1. , -0.5, 0. , -0.5, 1. ]>