zernike
- poppy.zernike.zernike(n, m, npix=100, rho=None, theta=None, outside=nan, noll_normalize=True, **kwargs)[source]
Return the Zernike polynomial Z[m,n] for a given pupil.
For this function the desired Zernike is specified by 2 indices m and n. See zernike1 for an equivalent function in which the polynomials are ordered by a single index.
You may specify the pupil in one of two ways:
- zernike(n, m, npix)
where npix specifies a pupil diameter in pixels. The returned pupil will be a circular aperture with this diameter, embedded in a square array of size npix*npix.
- zernike(n, m, rho=r, theta=theta)
Which explicitly provides the desired pupil coordinates as arrays r and theta. These need not be regular or contiguous.
The expressions for the Zernike terms follow the normalization convention of Noll et al. JOSA 1976 unless the
noll_normalize
argument is False.- Parameters:
- n, mint
Zernike function degree
- npixint
Desired diameter for circular pupil. Only used if
rho
andtheta
are not provided.- rho, thetaarray_like
Image plane coordinates.
rho
should be 0 at the origin and 1.0 at the edge of the circular pupil.theta
should be the angle in radians.- outsidefloat
Value for pixels outside the circular aperture (rho > 1). Default is
np.nan
, but you may also find it useful for this to be 0.0 sometimes.- noll_normalizebool
As defined in Noll et al. JOSA 1976, the Zernike definition is modified such that the integral of Z[n, m] * Z[n, m] over the unit disk is pi exactly. To omit the normalization constant, set this to False. Default is True.
- Returns:
- zern2D numpy array
Z(m,n) evaluated at each (rho, theta)