IterativeNonlinearLSTSQPSF

In addition to the methods and attributes from PointSpreadFunction, IterativeNonlinearLSTSQPSF implements the following

class giant.point_spread_functions.psf_meta.IterativeNonlinearLSTSQPSF[source]

Bases: PointSpreadFunction

This ABC defines common attributes, properties, and methods for Iterative Non-linear least squares estimation of a Point Spread function.

This class is typically not used by the user except when implementing a new PSF class that uses iterative nonlinear least squares to fit the PSF to data.

To use this class when implementing a new PSF, simply subclass it and then override the abstract methods compute_jacobian() and update_state() (in addition to the required abstract methods from the typical PointSpreadFunction ABC) according to the PSF you are implementing. You may also want to override the default class attributes max_iter, atol, and rtol, which control when to break out of the iterations.

Once you have overridden the abstract methods (and possibly the class attributes), you simply need to call the converge() method from somewhere within the fit() method after initializing the class with the initial guess of the PSF parameters. The converge() method will then perform iterative non-linear least squares until convergence or the maximum number of iterations have been performed according the the max_iter, atol, and rtol class attributes. The converged solution will be stored as the updated class parameters

max_iter: int = 20

An integer defining the maximum number of iterations to attempt in the iterative least squares solution.

atol: float = 1e-10

The absolute tolerance cut-off for the iterative least squares. (The iteration will cease when the new estimate is within this tolerance for every element from the previous estimate)

rtol: float = 1e-10

The relative tolerance cut-off for the iterative least squares. (The iteration will cease when the maximum percent change in the state vector from one iteration to the next is less than this value)

Summary of Added/Modified Methods

compute_jacobian

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

update_state

Updates the current values based on the provided update vector.

converge

Performs iterative non-linear least squares on a PSF model until convergence has been reached for a function of the form \(z=f(x, y)\)