Skip to content

Commit

Permalink
Propagates flat pair read noises to ptcDataset
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Broughton committed Jan 27, 2024
1 parent f251df0 commit d79ed7a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions python/lsst/ip/isr/ptcDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class PhotonTransferCurveDataset(IsrCalib):
gainErr : `dict`, [`str`, `float`]
Dictionary keyed by amp names containing the errors on the
fitted gains.
noiseList : `dict`, [`str`, `np.ndarray`]
Dictionary keyed by amp names containing the mean read noise from
each flat pair (as measured from overscan).
noise : `dict`, [`str`, `float`]
Dictionary keyed by amp names containing the fitted noise.
noiseErr : `dict`, [`str`, `float`]
Expand Down Expand Up @@ -183,7 +186,7 @@ class PhotonTransferCurveDataset(IsrCalib):
Version 1.6 adds the `rowMeanVariance` attribute.
"""

_OBSTYPE = 'PTC'
_OBSTYPE = 'PTC' #Version 1.7 adds the `noiseList` attribute.

Check failure on line 189 in python/lsst/ip/isr/ptcDataset.py

View workflow job for this annotation

GitHub Actions / call-workflow / lint

E261

at least two spaces before inline comment

Check failure on line 189 in python/lsst/ip/isr/ptcDataset.py

View workflow job for this annotation

GitHub Actions / call-workflow / lint

E262

inline comment should start with '# '
_SCHEMA = 'Gen3 Photon Transfer Curve'
_VERSION = 1.6

Expand All @@ -209,6 +212,7 @@ def __init__(self, ampNames=[], ptcFitType=None, covMatrixSide=1,

self.gain = {ampName: np.nan for ampName in ampNames}
self.gainErr = {ampName: np.nan for ampName in ampNames}
self.noiseList = {ampName: np.array([]) for ampName in ampNames}
self.noise = {ampName: np.nan for ampName in ampNames}
self.noiseErr = {ampName: np.nan for ampName in ampNames}

Expand Down Expand Up @@ -238,7 +242,7 @@ def __init__(self, ampNames=[], ptcFitType=None, covMatrixSide=1,
# Try this as a dict of arrays.
self.auxValues = {}

super().__init__(**kwargs)
super().__init__(**kwargs) #'noiseList'

Check failure on line 245 in python/lsst/ip/isr/ptcDataset.py

View workflow job for this annotation

GitHub Actions / call-workflow / lint

E261

at least two spaces before inline comment

Check failure on line 245 in python/lsst/ip/isr/ptcDataset.py

View workflow job for this annotation

GitHub Actions / call-workflow / lint

E262

inline comment should start with '# '
self.requiredAttributes.update(['badAmps', 'inputExpIdPairs', 'expIdMask', 'rawExpTimes',
'rawMeans', 'rawVars', 'rowMeanVariance', 'gain',
'gainErr', 'noise', 'noiseErr',
Expand Down Expand Up @@ -418,6 +422,7 @@ def fromDict(cls, dictionary):
dtype=np.float64)
calib.gain[ampName] = float(dictionary['gain'][ampName])
calib.gainErr[ampName] = float(dictionary['gainErr'][ampName])
calib.noiseList[ampName] = np.array(dictionary['noiseList'][ampName], dtype=np.float64)
calib.noise[ampName] = float(dictionary['noise'][ampName])
calib.noiseErr[ampName] = float(dictionary['noiseErr'][ampName])
calib.histVars[ampName] = np.array(dictionary['histVars'][ampName], dtype=np.float64)
Expand Down Expand Up @@ -518,6 +523,7 @@ def _dictOfArraysToDictOfLists(dictOfArrays):
outDict['rowMeanVariance'] = _dictOfArraysToDictOfLists(self.rowMeanVariance)
outDict['gain'] = self.gain
outDict['gainErr'] = self.gainErr
outDict['noiseList'] = _dictOfArraysToDictOfLists(self.noiseList)
outDict['noise'] = self.noise
outDict['noiseErr'] = self.noiseErr
outDict['histVars'] = self.histVars
Expand Down Expand Up @@ -578,6 +584,7 @@ def fromTable(cls, tableList):
inDict['rowMeanVariance'] = dict()
inDict['gain'] = dict()
inDict['gainErr'] = dict()
inDict['noiseList'] = dict()
inDict['noise'] = dict()
inDict['noiseErr'] = dict()
inDict['histVars'] = dict()
Expand Down Expand Up @@ -620,6 +627,7 @@ def fromTable(cls, tableList):
inDict['rowMeanVariance'][ampName] = record['ROW_MEAN_VARIANCE']
inDict['gain'][ampName] = record['GAIN']
inDict['gainErr'][ampName] = record['GAIN_ERR']
inDict['noiseList'][ampName] = record['NOISE_LIST']
inDict['noise'][ampName] = record['NOISE']
inDict['noiseErr'][ampName] = record['NOISE_ERR']
inDict['ptcFitPars'][ampName] = record['PTC_FIT_PARS']
Expand Down Expand Up @@ -713,6 +721,7 @@ def toTable(self):
'ROW_MEAN_VARIANCE': self.rowMeanVariance[ampName],
'GAIN': self.gain[ampName],
'GAIN_ERR': self.gainErr[ampName],
'NOISE_LIST': self.noiseList[ampName],
'NOISE': self.noise[ampName],
'NOISE_ERR': self.noiseErr[ampName],
'HIST_VARS': self.histVars[ampName],
Expand Down

0 comments on commit d79ed7a

Please sign in to comment.