Skip to content

Commit

Permalink
Fix PTC fit type saving
Browse files Browse the repository at this point in the history
Also, ensure POLYNOMIAL is always used regardless of
upstream default, and improve error message on failure.
  • Loading branch information
mfisherlevine committed Jan 14, 2020
1 parent 6f3c7dc commit 558d81d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/lsst/cp/pipe/makeBrighterFatterKernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ def runDataRef(self, dataRef, visitPairs):
ptcConfig = MeasurePhotonTransferCurveTaskConfig()
ptcConfig.isrForbiddenSteps = []
ptcConfig.doFitBootstrap = True
ptcConfig.ptcFitType = 'POLYNOMIAL' # default Astier doesn't work for gain correction
ptcConfig.polynomialFitDegree = 3
ptcConfig.minMeanSignal = self.config.minMeanSignal
ptcConfig.maxMeanSignal = self.config.maxMeanSignal
ptcTask = MeasurePhotonTransferCurveTask(config=ptcConfig)
Expand Down Expand Up @@ -671,9 +673,9 @@ def _applyGains(self, means, xcorrs, ptcData):
mask = ptcData.visitMask[ampName]
gain = ptcData.gain[ampName]

fitType = ptcData.ptcFitType
fitType = ptcData.ptcFitType[ampName]
if fitType != 'POLYNOMIAL':
raise RuntimeError("Only polynomial fit types supported currently")
raise RuntimeError(f"Only polynomial fit types supported currently, found {fitType}")
ptcFitPars = ptcData.ptcFitPars[ampName]
# polynomial params go in ascending order, so this is safe w.r.t.
# the polynomial order, as the constant term is always first,
Expand Down
1 change: 1 addition & 0 deletions python/lsst/cp/pipe/ptc.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ def errFunc(p, x, y):
dataset.gainErr[ampName] = ptcGainErr
dataset.noise[ampName] = ptcNoise
dataset.noiseErr[ampName] = ptcNoiseErr
dataset.ptcFitType[ampName] = ptcFitType

# Non-linearity residuals (NL of mean vs time curve): percentage, and fit to a quadratic function
# In this case, len(parsIniNl) = 3 indicates that we want a quadratic fit
Expand Down

0 comments on commit 558d81d

Please sign in to comment.