Construct and/or fit a model for a linear streak.
This assumes a simple model for a streak, in which the streak
follows a straight line in pixels space, with a Moffat-shaped profile. The
model is fit to data using a Newton-Raphson style minimization algorithm.
The initial guess for the line parameters is assumed to be fairly accurate,
so only a narrow band of pixels around the initial line estimate is used in
fitting the model, which provides a significant speed-up over using all the
data. The class can also be used just to construct a model for the data with
a line following the given coordinates.
Parameters
----------
data : `np.ndarray`
2d array of data.
weights : `np.ndarray`
2d array of weights.
line : `Line`, optional
Guess for position of line. Data far from line guess is masked out.
Defaults to None, in which case only data with `weights` = 0 is masked
out.
Definition at line 189 of file maskStreaks.py.
def lsst.pipe.tasks.maskStreaks.LineProfile.fit |
( |
|
self, |
|
|
|
dChi2Tol = 0.1 , |
|
|
|
maxIter = 100 |
|
) |
| |
Perform Newton-Raphson minimization to find line parameters.
This method takes advantage of having known derivative and Hessian of
the multivariate function to quickly and efficiently find the minimum.
This is more efficient than the scipy implementation of the Newton-
Raphson method, which doesn't take advantage of the Hessian matrix. The
method here also performs a line search in the direction of the steepest
derivative at each iteration, which reduces the number of iterations
needed.
Parameters
----------
dChi2Tol : `float`, optional
Change in Chi2 tolerated for fit convergence.
maxIter : `int`, optional
Maximum number of fit iterations allowed. The fit should converge in
~10 iterations, depending on the value of dChi2Tol, but this
maximum provides a backup.
Returns
-------
outline : `np.ndarray`
Coordinates and inverse width of fit line.
chi2 : `float`
Reduced Chi2 of model fit to data.
fitFailure : `bool`
Boolean where `False` corresponds to a successful fit.
Definition at line 362 of file maskStreaks.py.