psfsim.basis
Basis functions for decomposition of the figure errors.
Attributes
Classes
Base class for basis functions for figures. |
|
Zernike basis set. |
|
Legendre basis set. |
|
Legendre basis set with maximum order. |
|
Class to build a table of basis sets from a dictionary. |
Module Contents
- class _FigureBasis[source]
Base class for basis functions for figures.
- Parameters:
None
- basis()[source]
Function to take an array:
valid(x,y), wherexandyare numpy arrays, and return an array with one extra axis (at the end) giving the basis mode index. Should be replaced when you inherit.
- valid()[source]
Function to take an array:
valid(x,y), wherexandyare numpy arrays, and return a Boolean numpy array of whether it is valid. Should be replaced when you inherit.
- basis(x, y)[source]
Dummy basis function (all 1’s).
- Parameters:
x (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
y (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
- Returns:
Basis function array at these points; shape is
np.shape(x) + (N,), whereNis the number of basis functions.- Return type:
np.ndarray of float
- valid(x, y)[source]
Dummy valid function (all True).
- Parameters:
x (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
y (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
- Returns:
True if valid, False if not; shape is the same as x.
- Return type:
np.ndarray of bool
- class ZernikeBasis(radius, nmax, skip=0)[source]
Bases:
_FigureBasisZernike basis set.
- Parameters:
radius (float) – The maximum radius.
nmax (int) – The maximum Zernike order.
skip (int, optional) – If specified, skip orders below this value (e.g., skip=1 to not use piston).
- basis(x, y)[source]
Zernike basis functions.
These are normalized in a circle of radius
self.radius.- Parameters:
x (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
y (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
- Returns:
Basis function array at these points; shape is
np.shape(x) + (N,), whereNis the number of basis functions.- Return type:
np.ndarray of float
- valid(x, y)[source]
Valid function.
This is True for points in a circle of radius
self.radius.- Parameters:
x (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
y (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
- Returns:
True if valid, False if not; shape is the same as x.
- Return type:
np.ndarray of bool
- class LegendreBasis(bbox, nmax_x, nmax_y, skip=0)[source]
Bases:
_FigureBasisLegendre basis set.
- Parameters:
bbox (array-like of float) – The bounding box, in the form [xmin, xmax, ymin, ymax].
nmax_x (int) – The maximum Legendre order on each axis.
nmax_y (int) – The maximum Legendre order on each axis.
skip (int, optional) – Skip modes below this order.
- basis(x, y)[source]
The Legendre basis functions.
These are organized by order in x (outer loop) and y (inner loop), and are normalized to rms=1.
- Parameters:
x (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
y (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
- Returns:
Basis function array at these points; shape is
np.shape(x) + (N,), whereNis the number of basis functions.- Return type:
np.ndarray of float
- valid(x, y)[source]
Valid function.
This is True for points in a circle of radius
self.radius.- Parameters:
x (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
y (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
- Returns:
True if valid, False if not; shape is the same as x.
- Return type:
np.ndarray of bool
- class LegendreBasisMaxOrder(bbox, nmax, skip=0)[source]
Bases:
_FigureBasisLegendre basis set with maximum order.
- Parameters:
bbox (array-like of float) – The bounding box, in the form [xmin, xmax, ymin, ymax].
nmax (int) – The maximum Legendre order (total).
skip (int, optional) – Skip modes below this order.
- basis(x, y)[source]
The Legendre basis functions.
These are organized by order in x (outer loop) and y (inner loop), and are normalized to rms=1.
- Parameters:
x (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
y (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
- Returns:
Basis function array at these points; shape is
np.shape(x) + (N,), whereNis the number of basis functions.- Return type:
np.ndarray of float
- valid(x, y)[source]
Valid function.
This is True for points in a circle of radius
self.radius.- Parameters:
x (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
y (np.ndarray of float) – The x and y coordinates of the points to evaluate. These should be the same shape.
- Returns:
True if valid, False if not; shape is the same as x.
- Return type:
np.ndarray of bool
- class RomanBasisSet(pars)[source]
Class to build a table of basis sets from a dictionary.
- Parameters:
pars (dict) – The parameter dictionary. See below for parameters.
- basis[source]
The basis functions (augmented with a
startkey for which index they start with).- Type:
- N
Number of basis modes for the whole system.
- Type:
int
Notes
The following parameters (nested if indicated) are allowed in pars:
M1: primary mirror -ORDER: Zernike order