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
nint

It is \(n \geqslant 0\). Relative to radial component.

lint

l Can be positive or negative, relative to angle component.

rhondarray

Values for the radial component. \(\varrho = \sqrt{x^2 + y^2}\).

thetandarray

Values for the angular component. For a rectangular grid x and y are evaluated as \(\vartheta = \mathrm{arctan}(y / x)\).

Returns
zernike_circle_polyndarray

Zernike circle polynomial already evaluated, \(U^\ell_n(\varrho, \varphi)\).

Raises
TypeError

If the angle component l is not an integer or when the (radial) order n 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. ]>