IterativeGaussian.fit_lstsq

giant.point_spread_functions.gaussians:

classmethod IterativeGaussian.fit_lstsq(x, y, z)

This fits a PSF to a surface using iterative non-linear least squares estimation.

The estimation in this function is performed iteratively. First, a non-iterative fit is performed using the super class’s fit method. This initial fit is then refined using iterative non-linear least squares to remove biases that might have been introduced in the non-iterative fit..

If the fit is unsuccessful due to a rank deficient matrix then update_states() will be called which will likely result in the state parameters being set to NaN.

Parameters:
  • x (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]) – The x values underlying the surface the PSF is to be fit to

  • y (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]) – The y values underlying the surface the PSF is to be fit to

  • z (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]) – The z or “height” values of the surface the PSF is to be fit to

Returns:

The initialized PSF with values according to the fit

Return type:

Self