gradzpm_cart | R Documentation |
Calculate Zernike polynomial values and Cartesian gradients in ISO/ANSI sequence for a set of Cartesian coordinates.
gradzpm_cart(x, y, maxorder = 12L, unit_variance = FALSE, return_zpm = TRUE)
x |
a vector of x coordinates for points on a unit disk. |
y |
a vector of y coordinates. |
maxorder |
the maximum radial polynomial order (defaults to 12). |
unit_variance |
logical: return with orthonormal scaling? (default |
return_zpm |
logical: return Zernike polynomial matrix? (default |
Uses the recurrence relations in the above publication to calculate Zernike polynomial values and their directional derivatives in Cartesian coordinates. These are known to be both efficient and numerically stable.
Columns are in ISO/ANSI sequence: for each radial order n >= 0 the azimuthal orders m are sequenced m = -n, -(n-2), ..., (n-2), n, with sine components for negative m and cosine for positive m. Note this is the opposite ordering from the extended Fringe set and the ordering of aberrations is quite different. For example the two components of trefoil are in the 7th and 10th column while coma is in columns 8 and 9 (or 7 and 8 with 0-indexing). Note also that except for tilt and coma-like aberrations (m=1) non-axisymmetric aberrations will be separated.
All three matrices will have the same dimensions on return. Columns 0 and 1 of dzdx
will be all 0,
while columns 0 and 2 of dzdy
are 0.
a named list with the matrices zm
(optional but returned by default), dzdx
, dzdy
.
Anderson, T.B. (2018) Optics Express 26, #5, 18878 https://doi.org/10.1364/OE.26.018878 (open access)
zpm()
uses the same recurrence relations for polar coordinates and extended
Fringe set ordering, which is the more common indexing scheme for optical design/testing
software.
zpm_cart()
calculates and returns the Zernike polynomial values only.
rho <- seq(0.2, 1., length=5)
theta <- seq(0, 1.6*pi, length=5)
rt <- expand.grid(theta, rho)
x <- c(0, rt[,2]*cos(rt[,1]))
y <- c(0, rt[,2]*sin(rt[,1]))
gzpm <- gradzpm_cart(x, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.