lsst.ip.isr g5e83b0b6c4+64f77a1dfb
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Protected Attributes | List of all members
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset Class Reference
Inheritance diagram for lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset:
lsst.ip.isr.calibType.IsrCalib

Public Member Functions

 __init__ (self, ampNames=[], ptcFitType=None, covMatrixSide=1, **kwargs)
 
 setAmpValuesPartialDataset (self, ampName, inputExpIdPair=(-1, -1), rawExpTime=np.nan, rawMean=np.nan, rawVar=np.nan, photoCharge=np.nan, expIdMask=False, covariance=None, covSqrtWeights=None, gain=np.nan, noise=np.nan, histVar=np.nan, histChi2Dof=np.nan, kspValue=0.0, auxValues=None)
 
 setAuxValuesPartialDataset (self, auxDict)
 
 updateMetadata (self, **kwargs)
 
 fromDict (cls, dictionary)
 
 toDict (self)
 
 fromTable (cls, tableList)
 
 toTable (self)
 
 fromDetector (self, detector)
 
 getExpIdsUsed (self, ampName)
 
 getGoodAmps (self)
 
 getGoodPoints (self, ampName)
 

Public Attributes

 ptcFitType
 
 ampNames
 
 covMatrixSide
 
 badAmps
 
 inputExpIdPairs
 
 expIdMask
 
 rawExpTimes
 
 rawMeans
 
 rawVars
 
 photoCharges
 
 gain
 
 gainErr
 
 noise
 
 noiseErr
 
 histVars
 
 histChi2Dofs
 
 kspValues
 
 ptcFitPars
 
 ptcFitParsError
 
 ptcFitChiSq
 
 ptcTurnoff
 
 covariances
 
 covariancesModel
 
 covariancesSqrtWeights
 
 aMatrix
 
 bMatrix
 
 noiseMatrix
 
 covariancesModelNoB
 
 aMatrixNoB
 
 noiseMatrixNoB
 
 finalVars
 
 finalModelVars
 
 finalMeans
 
 auxValues
 

Static Protected Attributes

str _OBSTYPE = 'PTC'
 
str _SCHEMA = 'Gen3 Photon Transfer Curve'
 
float _VERSION = 1.4
 

Detailed Description

A simple class to hold the output data from the PTC task.

The dataset is made up of a dictionary for each item, keyed by the
amplifiers' names, which much be supplied at construction time.
New items cannot be added to the class to save accidentally saving to the
wrong property, and the class can be frozen if desired.
inputExpIdPairs records the exposures used to produce the data.
When fitPtc() or fitCovariancesAstier() is run, a mask is built up, which
is by definition always the same length as inputExpIdPairs, rawExpTimes,
rawMeans and rawVars, and is a list of bools, which are incrementally set
to False as points are discarded from the fits.
PTC fit parameters for polynomials are stored in a list in ascending order
of polynomial term, i.e. par[0]*x^0 + par[1]*x + par[2]*x^2 etc
with the length of the list corresponding to the order of the polynomial
plus one.

Parameters
----------
ampNames : `list`
    List with the names of the amplifiers of the detector at hand.
ptcFitType : `str`
    Type of model fitted to the PTC: "POLYNOMIAL", "EXPAPPROXIMATION",
    or "FULLCOVARIANCE".
covMatrixSide : `int`
    Maximum lag of covariances (size of square covariance matrices).
kwargs : `dict`, optional
    Other keyword arguments to pass to the parent init.

Notes
-----
The stored attributes are:

badAmps : `list` [`str`]
    List with bad amplifiers names.
inputExpIdPairs : `dict`, [`str`, `list`]
    Dictionary keyed by amp names containing the input exposures IDs.
expIdMask : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the mask produced after
    outlier rejection. The mask produced by the "FULLCOVARIANCE"
    option may differ from the one produced in the other two PTC
    fit types.
rawExpTimes : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the unmasked exposure times.
rawMeans : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the unmasked average of the
    means of the exposures in each flat pair.
rawVars : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the variance of the
    difference image of the exposures in each flat pair.
histVars : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the variance of the
    difference image of the exposures in each flat pair estimated
    by fitting a Gaussian model.
histChi2Dofs : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the chi-squared per degree
    of freedom fitting the difference image to a Gaussian model.
kspValues : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the KS test p-value from
    fitting the difference image to a Gaussian model.
gain : `dict`, [`str`, `float`]
    Dictionary keyed by amp names containing the fitted gains.
gainErr : `dict`, [`str`, `float`]
    Dictionary keyed by amp names containing the errors on the
    fitted gains.
noise : `dict`, [`str`, `float`]
    Dictionary keyed by amp names containing the fitted noise.
noiseErr : `dict`, [`str`, `float`]
    Dictionary keyed by amp names containing the errors on the fitted
    noise.
ptcFitPars : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the fitted parameters of the
    PTC model for ptcFitTye in ["POLYNOMIAL", "EXPAPPROXIMATION"].
ptcFitParsError : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the errors on the fitted
    parameters of the PTC model for ptcFitTye in
    ["POLYNOMIAL", "EXPAPPROXIMATION"].
ptcFitChiSq : `dict`, [`str`, `float`]
    Dictionary keyed by amp names containing the reduced chi squared
    of the fit for ptcFitTye in ["POLYNOMIAL", "EXPAPPROXIMATION"].
ptcTurnoff : `dict` [`str, `float`]
    Flux value (in ADU) where the variance of the PTC curve starts
    decreasing consistently.
covariances : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing a list of measured
    covariances per mean flux.
covariancesModel : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containinging covariances model
    (Eq. 20 of Astier+19) per mean flux.
covariancesSqrtWeights : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containinging sqrt. of covariances
    weights.
aMatrix : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the "a" parameters from
    the model in Eq. 20 of Astier+19.
bMatrix : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the "b" parameters from
    the model in Eq. 20 of Astier+19.
noiseMatrix : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the "noise" parameters from
    the model in Eq. 20 of Astier+19.
covariancesModelNoB : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing covariances model
    (with 'b'=0 in Eq. 20 of Astier+19)
    per mean flux.
aMatrixNoB : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the "a" parameters from the
    model in Eq. 20 of Astier+19
    (and 'b' = 0).
noiseMatrixNoB : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the "noise" parameters from
    the model in Eq. 20 of Astier+19, with 'b' = 0.
finalVars : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the masked variance of the
    difference image of each flat
    pair. If needed, each array will be right-padded with
    np.nan to match the length of rawExpTimes.
finalModelVars : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the masked modeled
    variance of the difference image of each flat pair. If needed, each
    array will be right-padded with np.nan to match the length of
    rawExpTimes.
finalMeans : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the masked average of the
    means of the exposures in each flat pair. If needed, each array
    will be right-padded with np.nan to match the length of
    rawExpTimes.
photoCharges : `dict`, [`str`, `np.ndarray`]
    Dictionary keyed by amp names containing the integrated photocharge
    for linearity calibration.
auxValues : `dict`, [`str`, `np.ndarray`]
    Dictionary of per-detector auxiliary header values that can be used
    for PTC, linearity computation.

Version 1.1 adds the `ptcTurnoff` attribute.
Version 1.2 adds the `histVars`, `histChi2Dofs`, and `kspValues`
attributes.
Version 1.3 adds the `noiseMatrix` and `noiseMatrixNoB` attributes.
Version 1.4 adds the `auxValues` attribute.

Definition at line 35 of file ptcDataset.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.__init__ (   self,
  ampNames = [],
  ptcFitType = None,
  covMatrixSide = 1,
**  kwargs 
)

Reimplemented from lsst.ip.isr.calibType.IsrCalib.

Definition at line 180 of file ptcDataset.py.

Member Function Documentation

◆ fromDetector()

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.fromDetector (   self,
  detector 
)
Read metadata parameters from a detector.

Parameters
----------
detector : `lsst.afw.cameraGeom.detector`
    Input detector with parameters to use.

Returns
-------
calib : `lsst.ip.isr.PhotonTransferCurveDataset`
    The calibration constructed from the detector.

Reimplemented from lsst.ip.isr.calibType.IsrCalib.

Definition at line 711 of file ptcDataset.py.

◆ fromDict()

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.fromDict (   cls,
  dictionary 
)
Construct a calibration from a dictionary of properties.
Must be implemented by the specific calibration subclasses.

Parameters
----------
dictionary : `dict`
    Dictionary of properties.

Returns
-------
calib : `lsst.ip.isr.PhotonTransferCurveDataset`
    Constructed calibration.

Raises
------
RuntimeError
    Raised if the supplied dictionary is for a different
    calibration.

Reimplemented from lsst.ip.isr.calibType.IsrCalib.

Definition at line 346 of file ptcDataset.py.

◆ fromTable()

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.fromTable (   cls,
  tableList 
)
Construct calibration from a list of tables.
This method uses the `fromDict` method to create the
calibration, after constructing an appropriate dictionary from
the input tables.

Parameters
----------
tableList : `list` [`lsst.afw.table.Table`]
    List of tables to use to construct the datasetPtc.

Returns
-------
calib : `lsst.ip.isr.PhotonTransferCurveDataset`
    The calibration defined in the tables.

Reimplemented from lsst.ip.isr.calibType.IsrCalib.

Definition at line 516 of file ptcDataset.py.

◆ getExpIdsUsed()

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.getExpIdsUsed (   self,
  ampName 
)
Get the exposures used, i.e. not discarded, for a given amp.
If no mask has been created yet, all exposures are returned.

Parameters
----------
ampName : `str`

Returns
-------
expIdsUsed : `list` [`tuple`]
    List of pairs of exposure ids used in PTC.

Definition at line 727 of file ptcDataset.py.

◆ getGoodAmps()

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.getGoodAmps (   self)
Get the good amps from this PTC.

Definition at line 761 of file ptcDataset.py.

◆ getGoodPoints()

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.getGoodPoints (   self,
  ampName 
)
Get the good points used for a given amp in the PTC.

Parameters
----------
ampName : `str`

Returns
-------
goodPoints : `np.ndarray`
    Boolean array of good points used in PTC.

Definition at line 765 of file ptcDataset.py.

◆ setAmpValuesPartialDataset()

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.setAmpValuesPartialDataset (   self,
  ampName,
  inputExpIdPair = (-1, -1),
  rawExpTime = np.nan,
  rawMean = np.nan,
  rawVar = np.nan,
  photoCharge = np.nan,
  expIdMask = False,
  covariance = None,
  covSqrtWeights = None,
  gain = np.nan,
  noise = np.nan,
  histVar = np.nan,
  histChi2Dof = np.nan,
  kspValue = 0.0,
  auxValues = None 
)
Set the amp values for a partial PTC Dataset (from cpExtractPtcTask).

Parameters
----------
ampName : `str`
    Name of the amp to set the values.
inputExpIdPair : `tuple` [`int`]
    Exposure IDs of input pair.
rawExpTime : `float`, optional
    Exposure time for this exposure pair.
rawMean : `float`, optional
    Average of the means of the exposures in this pair.
rawVar : `float`, optional
    Variance of the difference of the exposures in this pair.
photoCharge : `float`, optional
    Integrated photocharge for flat pair for linearity calibration.
expIdMask : `bool`, optional
    Flag setting if this exposure pair should be used (True)
    or not used (False).
covariance : `np.ndarray` or None, optional
    Measured covariance for this exposure pair.
covSqrtWeights : `np.ndarray` or None, optional
    Measured sqrt of covariance weights in this exposure pair.
gain : `float`, optional
    Estimated gain for this exposure pair.
noise : `float`, optional
    Estimated read noise for this exposure pair.
histVar : `float`, optional
    Variance estimated from fitting a histogram with a Gaussian model.
histChi2Dof : `float`, optional
    Chi-squared per degree of freedom from Gaussian histogram fit.
kspValue : `float`, optional
    KS test p-value from the Gaussian histogram fit.

Definition at line 237 of file ptcDataset.py.

◆ setAuxValuesPartialDataset()

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.setAuxValuesPartialDataset (   self,
  auxDict 
)
Set a dictionary of auxiliary values for a partial dataset.

Parameters
----------
auxDict : `dict` [`str`, `float`]
    Dictionary of float values.

Definition at line 318 of file ptcDataset.py.

◆ toDict()

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.toDict (   self)
Return a dictionary containing the calibration properties.
The dictionary should be able to be round-tripped through
`fromDict`.

Returns
-------
dictionary : `dict`
    Dictionary of properties.

Reimplemented from lsst.ip.isr.calibType.IsrCalib.

Definition at line 455 of file ptcDataset.py.

◆ toTable()

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.toTable (   self)
Construct a list of tables containing the information in this
calibration.

The list of tables should create an identical calibration
after being passed to this class's fromTable method.

Returns
-------
tableList : `list` [`astropy.table.Table`]
    List of tables containing the linearity calibration
    information.

Reimplemented from lsst.ip.isr.calibType.IsrCalib.

Definition at line 639 of file ptcDataset.py.

◆ updateMetadata()

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.updateMetadata (   self,
**  kwargs 
)
Update calibration metadata.
This calls the base class's method after ensuring the required
calibration keywords will be saved.

Parameters
----------
setDate : `bool`, optional
    Update the CALIBDATE fields in the metadata to the current
    time. Defaults to False.
kwargs :
    Other keyword parameters to set in the metadata.

Reimplemented from lsst.ip.isr.calibType.IsrCalib.

Definition at line 330 of file ptcDataset.py.

Member Data Documentation

◆ _OBSTYPE

str lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset._OBSTYPE = 'PTC'
staticprotected

Definition at line 176 of file ptcDataset.py.

◆ _SCHEMA

str lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset._SCHEMA = 'Gen3 Photon Transfer Curve'
staticprotected

Definition at line 177 of file ptcDataset.py.

◆ _VERSION

float lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset._VERSION = 1.4
staticprotected

Definition at line 178 of file ptcDataset.py.

◆ aMatrix

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.aMatrix

Definition at line 211 of file ptcDataset.py.

◆ aMatrixNoB

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.aMatrixNoB

Definition at line 215 of file ptcDataset.py.

◆ ampNames

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.ampNames

Definition at line 182 of file ptcDataset.py.

◆ auxValues

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.auxValues

Definition at line 223 of file ptcDataset.py.

◆ badAmps

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.badAmps

Definition at line 185 of file ptcDataset.py.

◆ bMatrix

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.bMatrix

Definition at line 212 of file ptcDataset.py.

◆ covariances

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.covariances

Definition at line 208 of file ptcDataset.py.

◆ covariancesModel

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.covariancesModel

Definition at line 209 of file ptcDataset.py.

◆ covariancesModelNoB

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.covariancesModelNoB

Definition at line 214 of file ptcDataset.py.

◆ covariancesSqrtWeights

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.covariancesSqrtWeights

Definition at line 210 of file ptcDataset.py.

◆ covMatrixSide

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.covMatrixSide

Definition at line 183 of file ptcDataset.py.

◆ expIdMask

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.expIdMask

Definition at line 188 of file ptcDataset.py.

◆ finalMeans

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.finalMeans

Definition at line 220 of file ptcDataset.py.

◆ finalModelVars

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.finalModelVars

Definition at line 219 of file ptcDataset.py.

◆ finalVars

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.finalVars

Definition at line 218 of file ptcDataset.py.

◆ gain

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.gain

Definition at line 194 of file ptcDataset.py.

◆ gainErr

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.gainErr

Definition at line 195 of file ptcDataset.py.

◆ histChi2Dofs

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.histChi2Dofs

Definition at line 200 of file ptcDataset.py.

◆ histVars

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.histVars

Definition at line 199 of file ptcDataset.py.

◆ inputExpIdPairs

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.inputExpIdPairs

Definition at line 187 of file ptcDataset.py.

◆ kspValues

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.kspValues

Definition at line 201 of file ptcDataset.py.

◆ noise

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.noise

Definition at line 196 of file ptcDataset.py.

◆ noiseErr

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.noiseErr

Definition at line 197 of file ptcDataset.py.

◆ noiseMatrix

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.noiseMatrix

Definition at line 213 of file ptcDataset.py.

◆ noiseMatrixNoB

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.noiseMatrixNoB

Definition at line 216 of file ptcDataset.py.

◆ photoCharges

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.photoCharges

Definition at line 192 of file ptcDataset.py.

◆ ptcFitChiSq

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.ptcFitChiSq

Definition at line 205 of file ptcDataset.py.

◆ ptcFitPars

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.ptcFitPars

Definition at line 203 of file ptcDataset.py.

◆ ptcFitParsError

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.ptcFitParsError

Definition at line 204 of file ptcDataset.py.

◆ ptcFitType

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.ptcFitType

Definition at line 181 of file ptcDataset.py.

◆ ptcTurnoff

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.ptcTurnoff

Definition at line 206 of file ptcDataset.py.

◆ rawExpTimes

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.rawExpTimes

Definition at line 189 of file ptcDataset.py.

◆ rawMeans

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.rawMeans

Definition at line 190 of file ptcDataset.py.

◆ rawVars

lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.rawVars

Definition at line 191 of file ptcDataset.py.


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