LSSTApplications  19.0.0-14-gb0260a2+4cd158d902,20.0.0+126303c00d,20.0.0+2f3d0e5c40,20.0.0+36ef800059,20.0.0+8d0ab3d2aa,20.0.0+bebc1f60e8,20.0.0+e271cb8385,20.0.0+e2e26847c2,20.0.0+eaf69e532d,20.0.0-1-g10df615+d6cc7df41f,20.0.0-1-g253301a+36ef800059,20.0.0-1-g2b7511a+bebc1f60e8,20.0.0-1-g4d801e7+6fee74fd2f,20.0.0-1-g5b95a8c+6c6c03acd5,20.0.0-1-g660595b+f45b7d88f4,20.0.0-1-gc96f8cb+d4517efcba,20.0.0-1-gd1c87d7+85c46248f3,20.0.0-1-gedffbd8+17eaf5db5c,20.0.0-16-g111fe95+d4517efcba,20.0.0-16-g233ea98+c27695f312,20.0.0-17-ga9337b4+cbc55e0393,20.0.0-19-gcdd82e7+317a1f5500,20.0.0-2-g4dae9ad+d4517efcba,20.0.0-2-g7818986+85c46248f3,20.0.0-2-gec03fae+ff10c6d78d,20.0.0-29-g26d13349+2d5e4f2fd7,20.0.0-3-g4cc78c6+63636aeed8,20.0.0-3-g6a8623c+317a1f5500,20.0.0-3-g750bffe+699cb77157,20.0.0-4-gfea843c+f45b7d88f4,20.0.0-5-g357b56b+f45b7d88f4,20.0.0-5-gfcebe35+ef19f498ed,20.0.0-54-gba713e9+a7d430d1e1,20.0.0-7-gcda7bf1+31d79aecbb,20.0.0-9-g61a2a9a3d+14f89e4eca,20.0.0-9-g70cec07d+482e8042f7,w.2020.40
LSSTDataManagementBasePackage
Public Member Functions | List of all members
lsst.cp.pipe.ptc.PhotonTransferCurveDataset Class Reference

Public Member Functions

def __init__ (self, ampNames, ptcFitType)
 
def __setattr__ (self, attribute, value)
 
def getExpIdsUsed (self, ampName)
 
def getGoodAmps (self)
 

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".

Returns
-------
`lsst.cp.pipe.ptc.PhotonTransferCurveDataset`
    Output dataset from MeasurePhotonTransferCurveTask.

Definition at line 180 of file ptc.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.cp.pipe.ptc.PhotonTransferCurveDataset.__init__ (   self,
  ampNames,
  ptcFitType 
)

Definition at line 214 of file ptc.py.

214  def __init__(self, ampNames, ptcFitType):
215  # add items to __dict__ directly because __setattr__ is overridden
216 
217  # instance variables
218  self.__dict__["ptcFitType"] = ptcFitType
219  self.__dict__["ampNames"] = ampNames
220  self.__dict__["badAmps"] = []
221 
222  # raw data variables
223  # expIdMask is the mask produced after outlier rejection. The mask produced by "FULLCOVARIANCE"
224  # may differ from the one produced in the other two PTC fit types.
225  self.__dict__["inputExpIdPairs"] = {ampName: [] for ampName in ampNames}
226  self.__dict__["expIdMask"] = {ampName: [] for ampName in ampNames}
227  self.__dict__["rawExpTimes"] = {ampName: [] for ampName in ampNames}
228  self.__dict__["rawMeans"] = {ampName: [] for ampName in ampNames}
229  self.__dict__["rawVars"] = {ampName: [] for ampName in ampNames}
230  self.__dict__["photoCharge"] = {ampName: [] for ampName in ampNames}
231 
232  # Gain and noise
233  self.__dict__["gain"] = {ampName: -1. for ampName in ampNames}
234  self.__dict__["gainErr"] = {ampName: -1. for ampName in ampNames}
235  self.__dict__["noise"] = {ampName: -1. for ampName in ampNames}
236  self.__dict__["noiseErr"] = {ampName: -1. for ampName in ampNames}
237 
238  # if ptcFitTye in ["POLYNOMIAL", "EXPAPPROXIMATION"]
239  # fit information
240  self.__dict__["ptcFitPars"] = {ampName: [] for ampName in ampNames}
241  self.__dict__["ptcFitParsError"] = {ampName: [] for ampName in ampNames}
242  self.__dict__["ptcFitReducedChiSquared"] = {ampName: [] for ampName in ampNames}
243 
244  # if ptcFitTye in ["FULLCOVARIANCE"]
245  # "covariancesTuple" is a numpy recarray with entries of the form
246  # ['mu', 'i', 'j', 'var', 'cov', 'npix', 'ext', 'expTime', 'ampName']
247  # "covariancesFits" has CovFit objects that fit the measured covariances to Eq. 20 of Astier+19.
248  # In "covariancesFitsWithNoB", "b"=0 in the model described by Eq. 20 of Astier+19.
249  self.__dict__["covariancesTuple"] = {ampName: [] for ampName in ampNames}
250  self.__dict__["covariancesFitsWithNoB"] = {ampName: [] for ampName in ampNames}
251  self.__dict__["covariancesFits"] = {ampName: [] for ampName in ampNames}
252  self.__dict__["aMatrix"] = {ampName: [] for ampName in ampNames}
253  self.__dict__["bMatrix"] = {ampName: [] for ampName in ampNames}
254 
255  # "final" means that the "raw" vectors above had "expIdMask" applied.
256  self.__dict__["finalVars"] = {ampName: [] for ampName in ampNames}
257  self.__dict__["finalModelVars"] = {ampName: [] for ampName in ampNames}
258  self.__dict__["finalMeans"] = {ampName: [] for ampName in ampNames}
259 

Member Function Documentation

◆ __setattr__()

def lsst.cp.pipe.ptc.PhotonTransferCurveDataset.__setattr__ (   self,
  attribute,
  value 
)
Protect class attributes

Definition at line 260 of file ptc.py.

260  def __setattr__(self, attribute, value):
261  """Protect class attributes"""
262  if attribute not in self.__dict__:
263  raise AttributeError(f"{attribute} is not already a member of PhotonTransferCurveDataset, which"
264  " does not support setting of new attributes.")
265  else:
266  self.__dict__[attribute] = value
267 

◆ getExpIdsUsed()

def lsst.cp.pipe.ptc.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.

Definition at line 268 of file ptc.py.

268  def getExpIdsUsed(self, ampName):
269  """Get the exposures used, i.e. not discarded, for a given amp.
270 
271  If no mask has been created yet, all exposures are returned.
272  """
273  if len(self.expIdMask[ampName]) == 0:
274  return self.inputExpIdPairs[ampName]
275 
276  # if the mask exists it had better be the same length as the expIdPairs
277  assert len(self.expIdMask[ampName]) == len(self.inputExpIdPairs[ampName])
278 
279  pairs = self.inputExpIdPairs[ampName]
280  mask = self.expIdMask[ampName]
281  # cast to bool required because numpy
282  return [(exp1, exp2) for ((exp1, exp2), m) in zip(pairs, mask) if bool(m) is True]
283 

◆ getGoodAmps()

def lsst.cp.pipe.ptc.PhotonTransferCurveDataset.getGoodAmps (   self)

Definition at line 284 of file ptc.py.

284  def getGoodAmps(self):
285  return [amp for amp in self.ampNames if amp not in self.badAmps]
286 
287 

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