lsst.cp.pipe  19.0.0-10-ga90c110+1
Public Member Functions | Static Public Attributes | List of all members
lsst.cp.pipe.ptc.MeasurePhotonTransferCurveTask Class Reference
Inheritance diagram for lsst.cp.pipe.ptc.MeasurePhotonTransferCurveTask:

Public Member Functions

def __init__ (self, args, kwargs)
 
def runDataRef (self, dataRef, visitPairs)
 
def measureMeanVarPair (self, exposure1, exposure2, region=None)
 
def funcPolynomial (self, pars, x)
 
def funcAstier (self, pars, x)
 
def calculateLinearityResidualAndLinearizers (self, exposureTimeVector, meanSignalVector)
 
def fitPtcAndNonLinearity (self, dataset, ptcFitType, tableArray=None)
 
def plot (self, dataRef, dataset, ptcFitType)
 

Static Public Attributes

 RunnerClass = PairedVisitListTaskRunner
 
 ConfigClass = MeasurePhotonTransferCurveTaskConfig
 

Detailed Description

A class to calculate, fit, and plot a PTC from a set of flat pairs.

The Photon Transfer Curve (var(signal) vs mean(signal)) is a standard tool
used in astronomical detectors characterization (e.g., Janesick 2001,
Janesick 2007). This task calculates the PTC from a series of pairs of
flat-field images; each pair taken at identical exposure times. The
difference image of each pair is formed to eliminate fixed pattern noise,
and then the variance of the difference image and the mean of the average image
are used to produce the PTC. An n-degree polynomial or the approximation in Equation
16 of Astier+19 ("The Shape of the Photon Transfer Curve of CCD sensors",
arXiv:1905.08677) can be fitted to the PTC curve. These models include
parameters such as the gain (e/ADU) and readout noise.

Parameters
----------

*args: `list`
    Positional arguments passed to the Task constructor. None used at this
    time.
**kwargs: `dict`
    Keyword arguments passed on to the Task constructor. None used at this
    time.

Definition at line 243 of file ptc.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.cp.pipe.ptc.MeasurePhotonTransferCurveTask.__init__ (   self,
  args,
  kwargs 
)

Definition at line 273 of file ptc.py.

Member Function Documentation

◆ calculateLinearityResidualAndLinearizers()

def lsst.cp.pipe.ptc.MeasurePhotonTransferCurveTask.calculateLinearityResidualAndLinearizers (   self,
  exposureTimeVector,
  meanSignalVector 
)
Calculate linearity residual and fit an n-order polynomial to the mean vs time curve
to produce corrections (deviation from linear part of polynomial) for a particular amplifier
to populate LinearizeLookupTable. Use quadratic and linear parts of this polynomial to approximate
c0 for LinearizeSquared."

Parameters
---------

exposureTimeVector: `list` of `np.float`
    List of exposure times for each flat pair

meanSignalVector: `list` of `np.float`
    List of mean signal from diference image of flat pairs

Returns
-------
c0: `np.float`
    Coefficient for LinearizeSquared, where corrImage = uncorrImage + c0*uncorrImage^2.
    c0 ~ -k2/(k1^2), where k1 and k2 are fit from
    meanSignalVector = k0 + k1*exposureTimeVector + k2*exposureTimeVector^2 +...
               + kn*exposureTimeVector^n, with n = "polynomialFitDegreeNonLinearity".

linearizerTableRow: list of `np.float`
   One dimensional array with deviation from linear part of n-order polynomial fit
   to mean vs time curve. This array will be one row (for the particular amplifier at hand)
   of the table array for LinearizeLookupTable.

linResidual: list of `np.float`
    Linearity residual from the mean vs time curve, defined as
    100*(1 - meanSignalReference/expTimeReference/(meanSignal/expTime).

parsFit: list of `np.float`
    Parameters from n-order polynomial fit to mean vs time curve.

parsFitErr: list of `np.float`
    Parameters from n-order polynomial fit to mean vs time curve.

Definition at line 609 of file ptc.py.

◆ fitPtcAndNonLinearity()

def lsst.cp.pipe.ptc.MeasurePhotonTransferCurveTask.fitPtcAndNonLinearity (   self,
  dataset,
  ptcFitType,
  tableArray = None 
)
Fit the photon transfer curve and calculate linearity and residuals.

Fit the photon transfer curve with either a polynomial of the order
specified in the task config, or using the Astier approximation.

Sigma clipping is performed iteratively for the fit, as well as an
initial clipping of data points that are more than
config.initialNonLinearityExclusionThreshold away from lying on a
straight line. This other step is necessary because the photon transfer
curve turns over catastrophically at very high flux (because saturation
drops the variance to ~0) and these far outliers cause the initial fit
to fail, meaning the sigma cannot be calculated to perform the
sigma-clipping.

Parameters
----------
dataset : `lsst.cp.pipe.ptc.PhotonTransferCurveDataset`
    The dataset containing the means, variances and exposure times
ptcFitType : `str`
    Fit a 'POLYNOMIAL' (degree: 'polynomialFitDegree') or
    'ASTIERAPPROXIMATION' to the PTC
tableArray : `np.array`
    Optional. Look-up table array with size rows=nAmps and columns=ADU values.
    It will be modified in-place if supplied.

Returns
-------
dataset: `lsst.cp.pipe.ptc.PhotonTransferCurveDataset`
    This is the same dataset as the input paramter, however, it has been modified
    to include information such as the fit vectors and the fit parameters. See
    the class `PhotonTransferCurveDatase`.

Definition at line 686 of file ptc.py.

◆ funcAstier()

def lsst.cp.pipe.ptc.MeasurePhotonTransferCurveTask.funcAstier (   self,
  pars,
  x 
)
Single brighter-fatter parameter model for PTC; Equation 16 of Astier+19

Definition at line 542 of file ptc.py.

◆ funcPolynomial()

def lsst.cp.pipe.ptc.MeasurePhotonTransferCurveTask.funcPolynomial (   self,
  pars,
  x 
)
Polynomial function definition

Definition at line 538 of file ptc.py.

◆ measureMeanVarPair()

def lsst.cp.pipe.ptc.MeasurePhotonTransferCurveTask.measureMeanVarPair (   self,
  exposure1,
  exposure2,
  region = None 
)
Calculate the mean signal of two exposures and the variance of their difference.

Parameters
----------
exposure1 : `lsst.afw.image.exposure.exposure.ExposureF`
    First exposure of flat field pair.

exposure2 : `lsst.afw.image.exposure.exposure.ExposureF`
    Second exposure of flat field pair.

region : `lsst.geom.Box2I`
    Region of each exposure where to perform the calculations (e.g, an amplifier).

Return
------

mu : `np.float`
    0.5*(mu1 + mu2), where mu1, and mu2 are the clipped means of the regions in
    both exposures.

varDiff : `np.float`
    Half of the clipped variance of the difference of the regions inthe two input
    exposures.

Definition at line 372 of file ptc.py.

◆ plot()

def lsst.cp.pipe.ptc.MeasurePhotonTransferCurveTask.plot (   self,
  dataRef,
  dataset,
  ptcFitType 
)

Definition at line 842 of file ptc.py.

◆ runDataRef()

def lsst.cp.pipe.ptc.MeasurePhotonTransferCurveTask.runDataRef (   self,
  dataRef,
  visitPairs 
)
Run the Photon Transfer Curve (PTC) measurement task.

For a dataRef (which is each detector here),
and given a list of visit pairs at different exposure times,
measure the PTC.

Parameters
----------
dataRef : list of lsst.daf.persistence.ButlerDataRef
    dataRef for the detector for the visits to be fit.
visitPairs : `iterable` of `tuple` of `int`
    Pairs of visit numbers to be processed together

Definition at line 294 of file ptc.py.

Member Data Documentation

◆ ConfigClass

lsst.cp.pipe.ptc.MeasurePhotonTransferCurveTask.ConfigClass = MeasurePhotonTransferCurveTaskConfig
static

Definition at line 270 of file ptc.py.

◆ RunnerClass

lsst.cp.pipe.ptc.MeasurePhotonTransferCurveTask.RunnerClass = PairedVisitListTaskRunner
static

Definition at line 269 of file ptc.py.


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