Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-31896: Clarify PTC code #112

Merged
merged 21 commits into from Feb 1, 2022
Merged

DM-31896: Clarify PTC code #112

merged 21 commits into from Feb 1, 2022

Conversation

plazas
Copy link
Contributor

@plazas plazas commented Nov 17, 2021

No description provided.

Copy link
Contributor

@czwa czwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hoping we can still simplify some more by removing the fft/direct choice, and keeping functions that are only called by one task as task methods.

python/lsst/cp/pipe/ptc/cpExtractPtcTask.py Show resolved Hide resolved
The number of partially-filled
`~lsst.ip.isr.PhotonTransferCurveDataset` objects will be less
than the number of input exposures because the task combines
input flats in pairs. However, it is required at this mioment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo.

before this task), produced a list of
`~lsst.ip.isr.PhotonTransferCurveDataset` objects. Each dataset
contains the mean signal and covariances of the
difference image of to flat-field images taken at
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "of the flat-field images"?

@@ -35,11 +35,9 @@
from lsst.utils.timer import timeMethod

from lsst.cp.pipe.utils import (funcAstier, funcPolynomial, NonexistentDatasetTaskDataIdContainer,
calculateWeightedReducedChi2)
calculateWeightedReducedChi2, getFitDataFromCovariances)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we drop this file entirely, as gen2 is now deprecated?

return cov, var, muVals


def symmetrize(inputArray):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplicates/is duplicated by BrighterFatterKernelSolveTask._tileArray(). I've added DM-33353 to unify these methods.

return mu, covariance, covarianceModel, weights, maskFromWeights


def makeCovArray(inputTuple, maxRangeFromTuple=8):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ever called outside of PhotonTransferCurveExtractTask? I have the same question with computeCovDirect above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's only called by the extract class, so I moved it there.

return tupleVec


def computeCovDirect(diffImage, weightImage, maxRange):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to keep both the direct and FFT convolutions? If they give the same result, we should just implement one. I see we use the FFT by default, so maybe keeping that one? However, we tend to use lags of 8, which suggests the direct method should be faster (it's also simpler).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the FFT version.

c = params[lenParams:2*lenParams].reshape((matrixSide, matrixSide))
noise = params[2*lenParams:3*lenParams].reshape((matrixSide, matrixSide))
gain = params[-1]
if key == 'fullModel':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this just be fitResults[key]['a'] = a, and avoid this if/else?

Copy link
Contributor

@czwa czwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. A few minor typos are all I could see.

if (muDiff <= minMeanSignalDict[ampName]) or (muDiff >= maxMeanSignalDict[ampName]):
expIdMask = False

if covAstier is not None:
# Turn the tuples with teh measured information
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

c = CovFastFourierTransform(diffIm.image.array, w, fftShape, maxRangeCov)
covDiffAstier = c.reportCovFastFourierTransform(maxRangeCov)

# Calculate covariances via FFT (default).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the default anymore, as we only have the one option.

@plazas plazas merged commit 72c1dcc into main Feb 1, 2022
@plazas plazas deleted the tickets/DM-31896 branch February 1, 2022 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants