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 SLM for grid makes this easy. The function get_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.

  • None If a SLM is passed for grid, then uses get_source_zernike_scaling() to determine the scaling most appropriate for the SLM. Otherwise, defaults to "cropped". See also fit_source_amplitude() and especially the extent_threshold keyword which determines the scaling used by get_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 the x_grid and y_grid directly, 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)