slmsuite.holography.toolbox.phase.zernike_aperture#
- zernike_aperture(grid, aperture=None)[source]#
Helper function to find the appropriate scaling for between the normalized units in the grid and the Zernike aperture (the unit disk).
Tip
Passing an
SLMforgridmakes this easy. The functionget_source_zernike_scaling()determines the optimal scaling of the aperture.Important
Zernike polynomials are canonically defined on a circular aperture. However, we may want to use these polynomials on other apertures (e.g. a rectangular SLM). Cropping this aperture breaks the orthogonality and normalization of the set, but this is fine for many applications. While it is possible to orthonormalize the cropped set, we do not do so in
slmsuite, as this is not critical for target applications such as aberration correction.Caution
Anisotropic Zernike scaling can lead to unexpected behavior. For instance, the \(Z_4 = Z_2^0 = 1 - 2x^2 - 2y^2\) Zernike term is commonly used for focusing, but with anisotropic scaling, this becomes an elliptical lens on the SLM which may not behave as expected.
- Parameters:
aperture ({"circular", "elliptical", "cropped"} OR (float, float) OR float OR None) –
How to scale the polynomials relative to the grid shape. This is relative to the \(r = 1\) edge of a standard Zernike pupil.
NoneIf aSLMis passed forgrid, then usesget_source_zernike_scaling()to determine the scaling most appropriate for the SLM. Otherwise, defaults to"cropped". See alsofit_source_amplitude()and especially the extent_threshold keyword which determines the scaling used byget_source_zernike_scaling()"circular"The circle is scaled isotropically until the pupil edge touches one set of opposite grid edges. This is the default aperture."elliptical"The circle is scaled anisotropically until each pupil edge touches a grid edge. Generally produces an ellipse."cropped"The circle is scaled isotropically until the rectangle of the grid is circumscribed by the circle.float OR (float, float)Custom scaling. These values are multiplied to thex_gridandy_griddirectly, respectively. The edge of the Zernike pupil corresponds to where(s_x * x_grid)**2 + (s_y * y_grid)**2 = 1. If a scalar is given, assumes isotropic scaling.
- Return type:
(float, float)