lsst.cp.pipe  20.0.0-22-gc512666+9eba1c4719
Public Member Functions | Static Public Attributes | List of all members
lsst.cp.pipe.linearity.LinearitySolveTask Class Reference
Inheritance diagram for lsst.cp.pipe.linearity.LinearitySolveTask:

Public Member Functions

def runQuantum (self, butlerQC, inputRefs, outputRefs)
 
def run (self, inputPtc, camera, inputDims)
 
def irlsFit (self, initialParams, dataX, dataY, function, weightsY=None)
 
def debugFit (self, stepname, xVector, yVector, yModel, mask, ampName)
 

Static Public Attributes

 ConfigClass = LinearitySolveConfig
 

Detailed Description

Fit the linearity from the PTC dataset.

Definition at line 111 of file linearity.py.

Member Function Documentation

◆ debugFit()

def lsst.cp.pipe.linearity.LinearitySolveTask.debugFit (   self,
  stepname,
  xVector,
  yVector,
  yModel,
  mask,
  ampName 
)
Debug method for linearity fitting.

Parameters
----------
stepname : `str`
    A label to use to check if we care to debug at a given
    line of code.
xVector : `numpy.array`
    The values to use as the independent variable in the
    linearity fit.
yVector : `numpy.array`
    The values to use as the dependent variable in the
    linearity fit.
yModel : `numpy.array`
    The values to use as the linearized result.
mask : `numpy.array` [ `bool` ], optional
    A mask to indicate which entries of ``xVector`` and
    ``yVector`` to keep.
ampName : `str`
    Amplifier name to lookup linearity correction values.

Definition at line 376 of file linearity.py.

◆ irlsFit()

def lsst.cp.pipe.linearity.LinearitySolveTask.irlsFit (   self,
  initialParams,
  dataX,
  dataY,
  function,
  weightsY = None 
)
Iteratively reweighted least squares fit.

This uses the `lsst.cp.pipe.utils.fitLeastSq`, but applies
weights based on the Cauchy distribution to the fitter.  See
e.g. Holland and Welsch, 1977, doi:10.1080/03610927708827533

Parameters
----------
initialParams : `list` [`float`]
    Starting parameters.
dataX : `numpy.array` [`float`]
    Abscissa data.
dataY : `numpy.array` [`float`]
    Ordinate data.
function : callable
    Function to fit.
weightsY : `numpy.array` [`float`]
    Weights to apply to the data.

Returns
-------
polyFit : `list` [`float`]
    Final best fit parameters.
polyFitErr : `list` [`float`]
    Final errors on fit parameters.
chiSq : `float`
    Reduced chi squared.
weightsY : `list` [`float`]
    Final weights used for each point.

Definition at line 332 of file linearity.py.

◆ run()

def lsst.cp.pipe.linearity.LinearitySolveTask.run (   self,
  inputPtc,
  camera,
  inputDims 
)
Fit non-linearity to PTC data, returning the correct Linearizer
object.

Parameters
----------
inputPtc : `lsst.cp.pipe.PtcDataset`
    Pre-measured PTC dataset.
camera : `lsst.afw.cameraGeom.Camera`
    Camera geometry.
inputDims : `lsst.daf.butler.DataCoordinate` or `dict`
    DataIds to use to populate the output calibration.

Returns
-------
results : `lsst.pipe.base.Struct`
    The results struct containing:

    ``outputLinearizer`` : `lsst.ip.isr.Linearizer`
Final linearizer calibration.
    ``outputProvenance`` : `lsst.ip.isr.IsrProvenance`
Provenance data for the new calibration.

Notes
-----
This task currently fits only polynomial-defined corrections,
where the correction coefficients are defined such that:
    corrImage = uncorrImage + sum_i c_i uncorrImage^(2 + i)
These `c_i` are defined in terms of the direct polynomial fit:
    meanVector ~ P(x=timeVector) = sum_j k_j x^j
such that c_(j-2) = -k_j/(k_1^j) in units of DN^(1-j) (c.f.,
Eq. 37 of 2003.05978). The `config.polynomialOrder` or
`config.splineKnots` define the maximum order of x^j to fit.
As k_0 and k_1 are degenerate with bias level and gain, they
are not included in the non-linearity correction.

Definition at line 137 of file linearity.py.

◆ runQuantum()

def lsst.cp.pipe.linearity.LinearitySolveTask.runQuantum (   self,
  butlerQC,
  inputRefs,
  outputRefs 
)
Ensure that the input and output dimensions are passed along.

Parameters
----------
butlerQC : `lsst.daf.butler.butlerQuantumContext.ButlerQuantumContext`
    Butler to operate on.
inputRefs : `lsst.pipe.base.connections.InputQuantizedConnection`
    Input data refs to load.
ouptutRefs : `lsst.pipe.base.connections.OutputQuantizedConnection`
    Output data refs to persist.

Definition at line 117 of file linearity.py.

Member Data Documentation

◆ ConfigClass

lsst.cp.pipe.linearity.LinearitySolveTask.ConfigClass = LinearitySolveConfig
static

Definition at line 114 of file linearity.py.


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