pyoptools.wavefront.zernike package

Module contents

pyoptools.wavefront.zernike.polar_array(Rmax=1.0, DS=0.1, pr=1.0)

Function that generates 2 square matrices one with the rho coordinate, and the other with the theta coordinate, to be able to calculate functions using polar coordinates.

It is similar to the mgrid function.

Arguments

Rmax Limit the pupil area -Rmax<=X<=Rmax -Rmax<=Y<=Rmax
DS Step between pixels
pr Pupil radius. Used to normalize the pupil.

Todo

This function should be moved to a auxiliary functions module

pyoptools.wavefront.zernike.rnm(n, m, rho)

Return an array with the zernike Rnm polynomial calculated at rho points.

ARGUMENTS:

n n order of the Zernike polynomial
m m order of the Zernike polynomial
rho Matrix containing the radial coordinates.

Note

For rho>1 the returned value is 0

Note

Values for rho<0 are silently returned as rho=0

pyoptools.wavefront.zernike.zernike(n, m, rho, theta)

Returns the an array with the Zernike polynomial evaluated in the rho and theta.

ARGUMENTS:

n n order of the Zernike polynomial
m m order of the Zernike polynomial
rho Matrix containing the radial coordinates.
theta Matrix containing the angular coordinates.

Note

For rho>1 the returned value is 0

Note

Values for rho<0 are silently returned as rho=0

pyoptools.wavefront.zernike.zernike2taylor(n, m)

Returns the 2D taylor polynomial, that represents the given zernike polynomial

ARGUMENTS

n,m n and m orders of the Zernike polynomials
RETURN VALUE
poly2d instance containing the polynomial
pyoptools.wavefront.zernike.i2nm(i)

Return the n and m orders of the i’th zernike polynomial

i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
n-order 0 1 1 2 2 2 3 3 3 3 4 4 4 4 4
m-order 0 -1 1 -2 0 2 -3 -1 1 3 -4 -2 0 2 4
class pyoptools.wavefront.zernike.ZernikeXY(cohef=[0])

Bases: object

Class used to evaluate the zernike polinomial with coheficients given by cohef, in Cartesian coordinates.

This class uses an internal Taylor representation of the polynomial for all the calculations. The internal taylor representation, is generator from the cohef argument given in the constructor. If cohef is changed, the internal taylor representation is built again.

ARGUMENTS

cohef – List containing the Zernike polynomial coheficients.

The coheficients given in cohef are enumerated as follows

index 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
n-order 0 1 1 2 2 2 3 3 3 3 4 4 4 4 4
m-order 0 -1 1 -2 0 2 -3 -1 1 3 -4 -2 0 2 4
cohef

Coefficient list of the zernike polynomial

eval()

Not implemented yet

evalm(x, y, mask=True)

Evaluate the zernike polynomial

Method used to evaluate the zernike polynomial at the coordinates given by the 2D arrays x,y

ARGUMENTS

x 2D array containing the X coordinates where the Zernike polynomial is to be evaluated.
y 2D array containing the Y coordinates where the Zernike polynomial is to be evaluated.
mask Flag indicating if the evaluated values are to be masked. If mask is True, the polynomial will only be evaluated at the pupil sqrt(x**2+y**2)<1. , and a masked array is returned.
gpu_eval(x, y)