decompose_opd_segments

poppy.zernike.decompose_opd_segments(opd, aperture=None, nterms=15, basis=None, iterations=2, verbose=False, ignore_border=None, **kwargs)[source]

Expand OPD into a basis defined by segments, typically with piston, tip, & tilt of each.

Similar algorithm as decompose_opd_nonorthonormal, but adjusted slightly for spatially disjoint basis vectors, and also for different expected normalization of the piston and tip/tilt basis terms.

The segment_piston_basis and segment_ptt_basis functions are intended for use with this, but it should be generally applicable to higher order hexikes or zernikes defined per segment as well.

Rather than supplying directly e.g. the segment_ptt_basis function with its default parameters, you will likely want to provide a custom basis wrapper function that sets the number of segments, segment size, etc. as appropriate for your chosen segmented aperture.

Parameters:
opd2D numpy.ndarray

The wavefront OPD map to expand in terms of the requested basis. Must be square.

aperture2D numpy.ndarray, optional

Aperture mask for which pixels are included within the aperture. NOTE - this is handed through to the basis function (see basis parameter) which is responsible for implementing this masking, if appropriate. 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 use. (Default: 15)

basiscallable, optional

Callable (e.g. a function) that generates a sequence of basis arrays given arguments nterms, npix, and outside. This should be an instance of Segment_Piston_Basis() or Segment_PTT_Basis(), or an equivalent.

ignore_borderint

Number of border pixels to ignore around each segment’s edge. This can be useful to avoid edge or interpolation artifacts in some circumstances.