pyzernike.core.core_cartesian_to_elliptic_annulus#
- pyzernike.core.core_cartesian_to_elliptic_annulus(x: ndarray, y: ndarray, Rx: floating, Ry: floating, x0: floating, y0: floating, alpha: floating, h: floating, x_derivative: ndarray, y_derivative: ndarray, float_type: type[floating]) Tuple[List[ndarray], List[ndarray]][source]#
Transform Cartesian coordinates \((x, y)\) to elliptic annulus domain polar coordinates \((\rho_{eq}, \theta_{eq})\).
Warning
This method is a core function of
pyzernikethat is not designed to be use by the users directly. No test is done on the input parameters. Please use the high level functions.See also
pyzernike.cartesian_to_elliptic_annulus()to convert Cartesian coordinates to elliptic annulus domain polar coordinates.pyzernike.xy_zernike_polynomial()to compute Zernike polynomials on the elliptic annulus domain.The page Mathematical description in the documentation for the mathematical extension of the Zernike polynomials on the elliptic domain.
Lets consider the extended elliptic annulus domain defined by the following parameters:
The parameters to define the extended domain of the Zernike polynomial.#
The parameters are:
\(R_x\) and \(R_y\) are the lengths of the semi-axis of the ellipse.
\(x_0\) and \(y_0\) are the coordinates of the center of the ellipse.
\(\alpha\) is the rotation angle of the ellipse in radians.
\(h=\frac{a}{R_x}=\frac{b}{R_y}\) defining the inner boundary of the ellipse.
The methods allow to compute the polar coordinates \((\rho_{eq}, \theta_{eq})\) and their derivatives with respect to the Cartesian coordinates \((x, y)\).
xandyare expected to be numpy arrays of the same shape and same dtype.x_derivativeandy_derivativemust be sequences of non-negative integers of the same length.
The output is a tuple of two lists with lengths equal to the length of
x_derivativeandy_derivative:The first list contains the equivalent polar radius \(\rho_{eq}\) and its derivatives with respect to the given orders.
The second list contains the equivalent polar angle \(\theta_{eq}\) and its derivatives with respect to the given orders.
- Parameters:
x (numpy.ndarray) – The x coordinates in Cartesian system with shape (…,). Must be array and floating point dtype corresponding to float_type.
y (numpy.ndarray) – The y coordinates in Cartesian system with shape (…,). Must be array and floating point dtype corresponding to float_type.
Rx (numpy.floating) – The length of the semi-axis of the ellipse along x axis. Must be strictly positive and floating point type corresponding to float_type.
Ry (numpy.floating) – The length of the semi-axis of the ellipse along y axis. Must be strictly positive and floating point type corresponding to float_type.
x0 (numpy.floating) – The x coordinate of the center of the ellipse. Can be any real number as floating point type corresponding to float_type.
y0 (numpy.floating) – The y coordinate of the center of the ellipse. Can be any real number as floating point type corresponding to float_type.
alpha (numpy.floating) – The rotation angle of the ellipse in radians. Can be any real number as floating point type corresponding to float_type.
h (numpy.floating) – The ratio of the inner semi-axis to the outer semi-axis. Must be in the range [0, 1) as floating point type corresponding to float_type.
x_derivative (numpy.ndarray) – The derivative order with respect to x to compute. Must be a sequence of non-negative integers with type compatible to float_type.
y_derivative (numpy.ndarray) – The derivative order with respect to y to compute. Must be a sequence of non-negative integers of the same length as x_derivative with type compatible to float_type.
- Returns:
The polar coordinates (\(\rho_{eq}, \theta_{eq}\)) and their derivatives with respect to the Cartesian coordinates \((x, y)\) as two lists of numpy arrays of floating point type corresponding to float_type.
output[0][i]is the derivative with respect to x of orderx_derivative[i]and with respect to y of ordery_derivative[i]of \(\rho_{eq}\).output[1][i]is the derivative with respect to x of orderx_derivative[i]and with respect to y of ordery_derivative[i]of \(\theta_{eq}\).- Return type:
Tuple[List[numpy.ndarray], List[numpy.ndarray]]
Notes
The derivatives for orders higher than 2 are computed using symbolic differentiation with sympy library (high computational cost). For orders 0, 1 and 2, the derivatives are computed using the analytical expressions derived from the chain rule.