InitialGuessIterativeNonlinearLSTSQPSFwBackground

In addition to the methods and attributes from PointSpreadFunction and IterativeNonlinearLSTSQwBackground, InitialGuessIterativeNonlinearLSTSQPSFwBackground implements the following.

class giant.point_spread_functions.psf_meta.InitialGuessIterativeNonlinearLSTSQPSFwBackground(bg_b_coef=None, bg_c_coef=None, bg_d_coef=None, **kwargs)[source]

Bases: IterativeNonlinearLSTSQwBackground

This class provides a fit class method which generates the initial guess from a subclass and then converges to a better solution using iterative Nonlinear LSTSQ including a background gradient.

This class is designed to work where you have a non-iterative but biased class for estimating the defined PSF (as is done with Gaussian PSFs by using a logarithmic transformation). If that is the case, and the unbiased estimator class uses the same attributes and the biased estimator class, then you can use this as is to add the ability to get the biased estimate and then correct it along with the background gradient. Otherwise you will need to do things yourself and shouldn’t bother with this class.

To use this class, override the fit() method, and then call super().fit_lstsq(x, y, z)

This also adds 2 instance attributes _residuals and _covariance which store the covariance and residuals of the fit if requested.

Parameters:
  • bg_b_coef (float) – The x slope of the background gradient

  • bg_c_coef (float) – They y slope of the background gradient

  • bg_d_coef (float) – The constant offset of the background gradient

_covariance: Sequence | ndarray | None

The covariance of the fit as a nxn array (for n state elements) or None, depending on if save_residuals is True.

_residuals: Sequence | ndarray | None

The residuals of the fit as a length m array (for m observations) or None, depending on if save_residuals is True.

Summary of Added/Modified Methods

fit_lstsq

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

compute_jacobian_all

This method computes the Jacobian of the PSF with respect to a change in the state.

evaluate

This method evaluates the PSF at the given x and y.