pyzernike.display_interactive#
- pyzernike.xy_display_interactive(*, Rx: Real | None = 1.0, Ry: Real | None = 1.0, x0: Real | None = 0.0, y0: Real | None = 0.0, alpha: Real | None = 0.0, h: Real | None = 0.0, precompute: bool = True, resolution: int = 200) None[source]#
Explore the Zernike polynomials on an elliptic annulus and their derivatives with respect to \(x\) and \(y\) in an interactive
matplotlibfigure.
The parameters of the elliptic annulus domain.#
The left panel of the figure contains:
text boxes to set the radial order \(n\), the azimuthal frequency \(m\) and the orders of the derivatives with respect to \(x\) and \(y\),
text boxes to set the parameters \((R_x, R_y, x_0, y_0, \alpha, h)\) of the elliptic annulus (\(\alpha\) in radians),
a text box to set the resolution of the grid,
a “Generate” button,
a message line reporting the invalid inputs.
The plot is computed and updated only when the “Generate” button is clicked, so that the values can be typed without triggering a computation at each change. The polynomials are drawn as colormaps on a Cartesian grid covering the elliptic annulus, transparent outside the annulus, with the boundaries of the annulus. The color scale spans \([\min(-1, Z), \max(1, Z)]\). If \(|m| > n\) or \(n - m\) is odd, the displayed polynomial is zero and a warning is shown.
The same figure is opened from the command line with
pyzernike --xy.See also
pyzernike.xy_zernike_display()to display a given list of polynomials on the elliptic annulus.pyzernike.xy_zernike_polynomial()for the definition of the polynomials and of their derivatives.pyzernike.display_interactive()to explore the Zernike polynomials on the unit disk.The page Extension to an elliptic annulus for the extension of the Zernike polynomials to the elliptic annulus.
- Parameters:
Rx (Optional[Real], optional) – The initial semi-axis \(R_x\) of the ellipse along its x axis. Must be finite and strictly positive. Default is 1.0.
Ry (Optional[Real], optional) – The initial semi-axis \(R_y\) of the ellipse along its y axis. Must be finite and strictly positive. Default is 1.0.
x0 (Optional[Real], optional) – The initial x coordinate \(x_0\) of the center of the ellipse. Must be finite. Default is 0.0.
y0 (Optional[Real], optional) – The initial y coordinate \(y_0\) of the center of the ellipse. Must be finite. Default is 0.0.
alpha (Optional[Real], optional) – The initial rotation angle \(\alpha\) of the ellipse in radians. Must be finite. Default is 0.0.
h (Optional[Real], optional) – The initial ratio \(h\) of the inner to the outer semi-axes, in \([0, 1)\). Default is 0.0 (full ellipse).
precompute (bool, optional) – If True, the powers of \(\rho_{eq}\) and \(1/r\) and the cosine and sine terms are cached during the computation of each polynomial. Default is True.
resolution (int, optional) – The initial number of points along each axis of the display grid. Default is 200.
ellipse (None is accepted for all the parameters of the)
value. (and means the default)
- Return type:
None
- Raises:
TypeError – If a parameter of the ellipse is not a real number, if
precomputeis not a boolean, or ifresolutionis not an integer.ValueError – If a parameter of the ellipse is not finite, if
RxorRyis not strictly positive, ifhis not in \([0, 1)\), or ifresolutionis lower than 2.
Examples
Open the interactive figure:
from pyzernike import xy_display_interactive xy_display_interactive()
Start with a rotated elliptic annulus:
xy_display_interactive(Rx=2.0, Ry=1.0, alpha=0.5, h=0.3)