IterativeNonlinearLSTSQwBackground¶
In addition to the methods and attributes from PointSpreadFunction
and IterativeNonlinearLSTSQPSF
,
IterativeNonlinearLSTSQwBackground
implements the following
- class giant.point_spread_functions.psf_meta.IterativeNonlinearLSTSQwBackground(bg_b_coef=None, bg_c_coef=None, bg_d_coef=None, **kwargs)[source]¶
Bases:
IterativeNonlinearLSTSQPSF
This class provides support for estimating the superposition of the PSF and a linear background gradient.
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.
Beyond the typical implementation in
IterativeNonLinearLSTSQ
, this class provides a concrete implementation of methodscompute_jacobian_bg()
,evaluate_bg()
, andapply_update_bg()
which handle the linear background gradient of the form\[f_{bg}(x, y) = f(x,y)+Bx+Cy+D\]where \(f_{bg}(x,y)\) is the PSF with the background, \(f(x,y)\) is the PSF without the background, \(B\) is the slope of the gradient in the x direction, \(C\) is the slope of the gradient in the y direction and \(D\) is the constant background level.
The way this class should be used it to subclass it, then in the regular
compute_jacobian()
method callcompute_jacobian_bg()
and include with the rest of your Jacobian matrix (typically at the end), then inevaluate()
callevaluate_bg()
and add the results to the PSF, and finally inupdate_states()
callupdate_states_bg()
inputting the portion of the state vector that contains the background update according to where you added it to your existing Jacobian.The background terms are stored in instance attributes
bg_b_coef
,bg_c_coef
, andbg_d_coef
.- 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
- bg_b_coef: float¶
The x slope of the background gradient
- bg_c_coef: float¶
The y slope of the background gradient
- bg_d_coef: float¶
The constant offset of the background gradient
Summary of Added/Modified Methods
This computes the Jacobian matrix for the background terms. |
|
This applies the background update to the background state |
|
This computes the background component at locations |
|
This method tries to fit the background using linear least squares without worrying about any PSF included. |