psfsim.aberration_models
Aberration models.
Attributes
Functions
|
Build a table of the derivatives of the wavefront error with respect to each surface mode. |
|
Computes the transfer matrix from surface distortion modes to Zernikes. |
|
Computes the SVD of the transfer matrix from surface distortion modes to Zernikes. |
|
Computes basis coefficients from a Zernike file. |
|
Save aberration gradients as a FITS file. |
Module Contents
- aberration_gradients(use_filter='W', nn=128, subtract_offset=False, mask=False)[source]
Build a table of the derivatives of the wavefront error with respect to each surface mode.
- Parameters:
use_filter (str, optional) – Which filter to use.
nn (int, optional) – What size pupil array to use.
subtract_offset (bool, optional) – Whether to subtract the Z1 mode (which has no effect on the PSF).
mask (bool, optional) – Whether to null out masked regions.
- Returns:
A table of sensitivities of OPD to each surface error mode. The shape is (number of field points, nn, nn, number of basis modes).
Reminder that this can be huge!
- Return type:
np.ndarray
- aberration_transfer_matrix(use_filter='W', nn=128, n_zernike=22, outdiagnostic=None)[source]
Computes the transfer matrix from surface distortion modes to Zernikes.
- Parameters:
use_filter (str, optional) – Which filter to use.
nn (int, optional) – What size pupil array to use.
n_zernike (int, optional) – How many Zernikes to use?
outdiagnostic (str, optional) – Output FITS file for diagnostics (for debugging only).
- Returns:
transfer (np.ndarray) – The transfer matrix, shape (number of field points, n_zernike, number of basis modes).
s_decomp (np.ndarray) – The decomposition of the ray-traced design wavefront, shape (number of field points, n_zernike). The return value is in Poppy OPD sign convention (negative of the path length difference).
- aberration_transfer_matrix_svd(use_filter='W', nn=128, n_zernike=22)[source]
Computes the SVD of the transfer matrix from surface distortion modes to Zernikes.
- Parameters:
use_filter (str, optional) – Which filter to use.
nn (int, optional) – What size pupil array to use.
n_zernike (int, optional) – How many Zernikes to use?
outdiagnostic (str, optional) – Output FITS file for diagnostics (for debugging only).
- Returns:
U, S, Vh – The SVD of the transfer matrix:
U has dimension (number of field points * n_zernike, nbasis)
S has length nbasis
Vh has dimension (nbasis, nbasis)
The transfer matrix is
U @ diag(S) @ Vh.- Return type:
np.ndarray
- extract_basis_coefs(infile, use_filter, nn=128, smin=0.01, pars_input=None, flip_y=True, nmin=None, nmax=None, c=3, verbose=True, return_coefs=False)[source]
Computes basis coefficients from a Zernike file.
- Parameters:
infile (str) – The input Zernike file to read. This should be a
.csvfile.use_filter (str) – The filter to use (1-character string).
nn (int, optional) – Grid size to use for the Zernikes.
smin (float, optional) – The minimum singular value to invert.
pars_input (np.ndarray, optional) – If provided, take this set of instrument parameters as an initial condition; default is all 0’s.
flip_y (bool, optional) – Whether to flip the Y-axis of the input Zernikes (useful for WFI-local vs FPA coordinates).
nmin (int, optional) – Minimum and maximum coefficient indices to fit (otherwise starts from pars_input).
nmax (int, optional) – Minimum and maximum coefficient indices to fit (otherwise starts from pars_input).
c (int, optional) – Number of Zernike modes to exclude from the fit. This is usually either 3 (default, skip piston and tip+tilt) or 1 (skip piston but include tip+tilt).
verbose (bool, optional) – Whether to talk a lot to the output.
return_coefs (bool, optional) – If set to True, returns the matrix of coefficients for the difference between the astrometric model computed by PSFSim and the table provided by the Project.
- Returns:
If return_coefs is False (default), this is a 1D array of the inferred basis coefficients.
If return_coefs is True, this is a 2D array of shape (3, 3) for the residual of the FPA positions:
[tabulated - predicted] = coefs[:2, :] @ [predicted] + coefs[-1, :]
where the 2nd axis has order x, y, focus.
- Return type:
np.ndarray