lentil.zernike(mask, index, normalize=True, rho=None, theta=None)[source]

Compute the circular Zernike polynomial for a given mask.

  • mask (array_like) – Mask defining the extent to compute the Zernike polynomial over. All nonzero entries are included in the result.

  • index (int) – Noll Zernike index as defined in [1]

  • normalize (bool, optional) – If True (default), the output is normalized according to [1]. If False, the output value ranges [-1, 1] over the mask.

  • rho (array_like, optional) – Radial coordinates of the mask array. rho should be 0 at the origin and 1 at the edge of the circle.

  • theta (array_like, optional) – Angular coordinates of the mask array in radians.


Circular Zernike polynomial computed over the given mask.

Return type



Zernike polynomials are defined to be orthogonal on the unit circle. If the supplied mask is non-circular, the Zernike polynomial is computed on an outscribing circle and then cropped by the mask. Note that this operation breaks the orthogonality of the Zernike polynomial. When working with a non-circular mask, care must be taken to understand any side-effects of using Zernike polynomials constructed in this manner. Any undesirable side-effects can be mitigated by using Zernike polynomials that have undergone Gram-Schmidt orthogonalization over the supplied mask.


[1] Noll, RJ. Zernike polynomials and atmospheric turbulence. J Opt Soc Am 66, 207-211 (1976).