slmsuite.holography.toolbox.phase.polynomial#
- polynomial(grid, weights, terms=None, pathing=None, out=None)[source]#
Returns a summation of monomials. Specifically,
\[\phi(x, y) = \sum_{n,m \in T} w_{nm}x^ny^m\]where \(w_{nm}\) are floating-point weights.
- Parameters:
grid ((array_like, array_like) OR
SLM) – Meshgrids of normalized \(\frac{x}{\lambda}\) coordinates corresponding to SLM pixels, in(x_grid, y_grid)form. These are precalculated and stored in anySLM, so such a class can be passed instead of the grids directly.weights (array_like of float) – Array of shape
(D,)corresponding to the coefficient of each term. Can also be shape(D, N)if a stack ofNpolynomials is desired.terms (array_like of int OR None) – Array of shape
(D, 2)corresponding to the \(x\) and \(y\) exponents for theDterms. Otherwise, array of shape(D,)corresponding to the Cantor indices of monomials. IfNone, assumes the terms are Cantor indices of the range ofweights.pathing (array_like of int OR None) – Array of shape
(D,)corresponding to an order that the terms should be calculated. IfNone, chooses the path that reduces the number of multiplications when evaluating monomials.out (numpy.ndarray OR cupy.ndarray) – A location where the result is stored. Use this to avoid allocating new memory.
- Returns:
out – Result of the sum.
- Return type:
numpy.ndarray OR cupy.ndarray