lsst.pipe.tasks ge5253750de+2524c5b224
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
lsst.pipe.tasks.maskStreaks.LineProfile Class Reference

Public Member Functions

 __init__ (self, data, weights, line=None)
 
 setLineMask (self, line)
 
 makeProfile (self, line, fitFlux=True)
 
 fit (self, dChi2Tol=0.1, maxIter=100)
 

Public Attributes

 data
 
 weights
 
 mask
 
 lineMask
 
 lineMaskSize
 

Protected Member Functions

 _makeMaskedProfile (self, line, fitFlux=True)
 
 _lineChi2 (self, line, grad=True)
 

Protected Attributes

 _ymax
 
 _xmax
 
 _dtype
 
 _rhoMax
 
 _xmesh
 
 _ymesh
 
 _initLine
 
 _maskData
 
 _maskWeights
 
 _mxmesh
 
 _mymesh
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

lsst.pipe.tasks.maskStreaks.LineProfile.__init__ (   self,
  data,
  weights,
  line = None 
)

Definition at line 213 of file maskStreaks.py.

Member Function Documentation

◆ _lineChi2()

lsst.pipe.tasks.maskStreaks.LineProfile._lineChi2 (   self,
  line,
  grad = True 
)
protected
Construct the chi2 between the data and the model.

Parameters
----------
line : `Line`
    `Line` parameters for which to build model and calculate chi2.
grad : `bool`, optional
    Whether or not to return the gradient and hessian.

Returns
-------
reducedChi : `float`
    Reduced chi2 of the model.
reducedDChi : `np.ndarray`
    Derivative of the chi2 with respect to rho, theta, invSigma.
reducedHessianChi : `np.ndarray`
    Hessian of the chi2 with respect to rho, theta, invSigma.

Definition at line 328 of file maskStreaks.py.

◆ _makeMaskedProfile()

lsst.pipe.tasks.maskStreaks.LineProfile._makeMaskedProfile (   self,
  line,
  fitFlux = True 
)
protected
Construct the line model in the masked region and calculate its
derivatives.

Parameters
----------
line : `Line`
    Parameters of line profile for which to make profile in the masked
    region.
fitFlux : `bool`
    Fit the amplitude of the line profile to the data.

Returns
-------
model : `np.ndarray`
    Model in the masked region.
dModel : `np.ndarray`
    Derivative of the model in the masked region.

Definition at line 250 of file maskStreaks.py.

◆ fit()

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.

◆ makeProfile()

lsst.pipe.tasks.maskStreaks.LineProfile.makeProfile (   self,
  line,
  fitFlux = True 
)
Construct the line profile model.

Parameters
----------
line : `Line`
    Parameters of the line profile to model.
fitFlux : `bool`, optional
    Fit the amplitude of the line profile to the data.

Returns
-------
finalModel : `np.ndarray`
    Model for line profile.

Definition at line 308 of file maskStreaks.py.

◆ setLineMask()

lsst.pipe.tasks.maskStreaks.LineProfile.setLineMask (   self,
  line 
)
Set mask around the image region near the line.

Parameters
----------
line : `Line`
    Parameters of line in the image.

Definition at line 227 of file maskStreaks.py.

Member Data Documentation

◆ _dtype

lsst.pipe.tasks.maskStreaks.LineProfile._dtype
protected

Definition at line 217 of file maskStreaks.py.

◆ _initLine

lsst.pipe.tasks.maskStreaks.LineProfile._initLine
protected

Definition at line 224 of file maskStreaks.py.

◆ _maskData

lsst.pipe.tasks.maskStreaks.LineProfile._maskData
protected

Definition at line 245 of file maskStreaks.py.

◆ _maskWeights

lsst.pipe.tasks.maskStreaks.LineProfile._maskWeights
protected

Definition at line 246 of file maskStreaks.py.

◆ _mxmesh

lsst.pipe.tasks.maskStreaks.LineProfile._mxmesh
protected

Definition at line 247 of file maskStreaks.py.

◆ _mymesh

lsst.pipe.tasks.maskStreaks.LineProfile._mymesh
protected

Definition at line 248 of file maskStreaks.py.

◆ _rhoMax

lsst.pipe.tasks.maskStreaks.LineProfile._rhoMax
protected

Definition at line 220 of file maskStreaks.py.

◆ _xmax

lsst.pipe.tasks.maskStreaks.LineProfile._xmax
protected

Definition at line 216 of file maskStreaks.py.

◆ _xmesh

lsst.pipe.tasks.maskStreaks.LineProfile._xmesh
protected

Definition at line 221 of file maskStreaks.py.

◆ _ymax

lsst.pipe.tasks.maskStreaks.LineProfile._ymax
protected

Definition at line 216 of file maskStreaks.py.

◆ _ymesh

lsst.pipe.tasks.maskStreaks.LineProfile._ymesh
protected

Definition at line 221 of file maskStreaks.py.

◆ data

lsst.pipe.tasks.maskStreaks.LineProfile.data

Definition at line 214 of file maskStreaks.py.

◆ lineMask

lsst.pipe.tasks.maskStreaks.LineProfile.lineMask

Definition at line 240 of file maskStreaks.py.

◆ lineMaskSize

lsst.pipe.tasks.maskStreaks.LineProfile.lineMaskSize

Definition at line 244 of file maskStreaks.py.

◆ mask

lsst.pipe.tasks.maskStreaks.LineProfile.mask

Definition at line 222 of file maskStreaks.py.

◆ weights

lsst.pipe.tasks.maskStreaks.LineProfile.weights

Definition at line 215 of file maskStreaks.py.


The documentation for this class was generated from the following file: