decompose_opd_nonorthonormal_basis
- poppy.zernike.decompose_opd_nonorthonormal_basis(opd, aperture=None, nterms=15, basis=<functools._lru_cache_wrapper object>, iterations=5, verbose=False, **kwargs)[source]
Modified version of decompose_opd, for cases where the basis function is not orthonormal, for instance using the regular Zernike functions on obscured apertures.
This version subtracts off each term as it is fit, to avoid over-fitting the same WFE multiple times. It also iterates the fitting multiple times by re-fitting the residuals, in order to allow for capturing any WFE which is missed by the first pass at fitting.
Based on various empirical experimentation for what is necessary to get reasonable behavior in this non-ideal case. Factors to consider:
Masking to use just pixels good in both the zernike unit circle and the asymmetric numerical aperture
Subtracting off the fit terms as you go, so as to not fit the same WFE multiple times
Iterating multiples by re-fitting the residual, to include as much WFE as possible.
- Parameters:
- opd2d ndarray
the OPD you want to fit
- aperture2D numpy array, optional
Aperture mask for which pixels are included within the aperture. All positive nonzero values are considered within the aperture; any pixels with zero, negative, or NaN values will be considered outside the aperture, and set equal to the ‘outside’ parameter value. If this parameter is not set, the aperture will be inferred from the finite (i.e. non-NaN) pixels in the OPD array.
- ntermsint
number of terms to fit
- basisfunction
which basis function to use. Defaults to Zernike
- iterationsint
Number of iterations for convergence. Default is 5