lsst.ip.isr g42cc332696+2cf095541c
|
Public Member Functions | |
def | __init__ (self, ampNames=[], ptcFitType=None, covMatrixSide=1, **kwargs) |
def | 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) |
def | updateMetadata (self, **kwargs) |
def | fromDict (cls, dictionary) |
def | toDict (self) |
def | fromTable (cls, tableList) |
def | toTable (self) |
def | fromDetector (self, detector) |
def | getExpIdsUsed (self, ampName) |
def | getGoodAmps (self) |
def | getGoodPoints (self, ampName) |
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. 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). 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. Version 1.1 adds the `ptcTurnoff` attribute.
Definition at line 35 of file ptcDataset.py.
def lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.__init__ | ( | self, | |
ampNames = [] , |
|||
ptcFitType = None , |
|||
covMatrixSide = 1 , |
|||
** | kwargs | ||
) |
Reimplemented from lsst.ip.isr.calibType.IsrCalib.
Definition at line 167 of file ptcDataset.py.
def 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 640 of file ptcDataset.py.
def 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 312 of file ptcDataset.py.
def 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 468 of file ptcDataset.py.
def 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 656 of file ptcDataset.py.
def lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.getGoodAmps | ( | self | ) |
Get the good amps from this PTC.
Definition at line 690 of file ptcDataset.py.
def 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 694 of file ptcDataset.py.
def 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 |
|||
) |
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 218 of file ptcDataset.py.
def 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 410 of file ptcDataset.py.
def 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 575 of file ptcDataset.py.
def 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 296 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.aMatrix |
Definition at line 198 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.aMatrixNoB |
Definition at line 201 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.ampNames |
Definition at line 169 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.badAmps |
Definition at line 172 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.bMatrix |
Definition at line 199 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.covariances |
Definition at line 195 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.covariancesModel |
Definition at line 196 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.covariancesModelNoB |
Definition at line 200 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.covariancesSqrtWeights |
Definition at line 197 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.covMatrixSide |
Definition at line 170 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.expIdMask |
Definition at line 175 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.finalMeans |
Definition at line 205 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.finalModelVars |
Definition at line 204 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.finalVars |
Definition at line 203 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.gain |
Definition at line 181 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.gainErr |
Definition at line 182 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.histChi2Dofs |
Definition at line 187 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.histVars |
Definition at line 186 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.inputExpIdPairs |
Definition at line 174 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.kspValues |
Definition at line 188 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.noise |
Definition at line 183 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.noiseErr |
Definition at line 184 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.photoCharges |
Definition at line 179 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.ptcFitChiSq |
Definition at line 192 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.ptcFitPars |
Definition at line 190 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.ptcFitParsError |
Definition at line 191 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.ptcFitType |
Definition at line 168 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.ptcTurnoff |
Definition at line 193 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.rawExpTimes |
Definition at line 176 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.rawMeans |
Definition at line 177 of file ptcDataset.py.
lsst.ip.isr.ptcDataset.PhotonTransferCurveDataset.rawVars |
Definition at line 178 of file ptcDataset.py.