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()
andupdate_state()
(in addition to the required abstract methods from the typicalPointSpreadFunction
ABC) according to the PSF you are implementing. You may also want to override the default class attributesmax_iter
,atol
, andrtol
, 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 thefit()
method after initializing the class with the initial guess of the PSF parameters. Theconverge()
method will then perform iterative non-linear least squares until convergence or the maximum number of iterations have been performed according the themax_iter
,atol
, andrtol
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
This method computes the Jacobian of the PSF with respect to a change in the state. |
|
Updates the current values based on the provided update vector. |
|
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)\) |