Task to measure covariances from flat fields.
This task receives as input a list of flat-field images
(flats), and sorts these flats in pairs taken at the
same time (if there's a different number of flats,
those flats are discarded). The mean, variance, and
covariances are measured from the difference of the flat
pairs at a given time. The variance is calculated
via afwMath, and the covariance via the methods in Astier+19
(appendix A). In theory, var = covariance[0,0]. This should
be validated, and in the future, we may decide to just keep
one (covariance).
The measured covariances at a particular time (along with
other quantities such as the mean) are stored in a PTC dataset
object (`PhotonTransferCurveDataset`), which gets partially
filled. The number of partially-filled PTC dataset objects
will be less than the number of input exposures, but gen3
requires/assumes that the number of input dimensions matches
bijectively the number of output dimensions. Therefore, a
number of "dummy" PTC dataset are inserted in the output list
that has the partially-filled PTC datasets with the covariances.
This output list will be used as input of
`PhotonTransferCurveSolveTask`, which will assemble the multiple
`PhotonTransferCurveDataset`s into a single one in order to fit
the measured covariances as a function of flux to a particular
model.
Astier+19: "The Shape of the Photon Transfer Curve of CCD
sensors", arXiv:1905.08677.
Definition at line 142 of file cpExtractPtcTask.py.
def lsst.cp.pipe.ptc.cpExtractPtcTask.PhotonTransferCurveExtractTask.measureMeanVarCov |
( |
|
self, |
|
|
|
exposure1, |
|
|
|
exposure2, |
|
|
|
region = None , |
|
|
|
covAstierRealSpace = False |
|
) |
| |
Calculate the mean of each of two exposures and the variance
and covariance of their difference. The variance is calculated
via afwMath, and the covariance via the methods in Astier+19
(appendix A). In theory, var = covariance[0,0]. This should
be validated, and in the future, we may decide to just keep
one (covariance).
Parameters
----------
exposure1 : `lsst.afw.image.exposure.exposure.ExposureF`
First exposure of flat field pair.
exposure2 : `lsst.afw.image.exposure.exposure.ExposureF`
Second exposure of flat field pair.
region : `lsst.geom.Box2I`, optional
Region of each exposure where to perform the calculations (e.g, an amplifier).
covAstierRealSpace : `bool`, optional
Should the covariannces in Astier+19 be calculated in real space or via FFT?
See Appendix A of Astier+19.
Returns
-------
mu : `float` or `NaN`
0.5*(mu1 + mu2), where mu1, and mu2 are the clipped means of the regions in
both exposures. If either mu1 or m2 are NaN's, the returned value is NaN.
varDiff : `float` or `NaN`
Half of the clipped variance of the difference of the regions inthe two input
exposures. If either mu1 or m2 are NaN's, the returned value is NaN.
covDiffAstier : `list` or `NaN`
List with tuples of the form (dx, dy, var, cov, npix), where:
dx : `int`
Lag in x
dy : `int`
Lag in y
var : `float`
Variance at (dx, dy).
cov : `float`
Covariance at (dx, dy).
nPix : `int`
Number of pixel pairs used to evaluate var and cov.
If either mu1 or m2 are NaN's, the returned value is NaN.
Definition at line 344 of file cpExtractPtcTask.py.
def lsst.cp.pipe.ptc.cpExtractPtcTask.PhotonTransferCurveExtractTask.run |
( |
|
self, |
|
|
|
inputExp, |
|
|
|
inputDims |
|
) |
| |
Measure covariances from difference of flat pairs
Parameters
----------
inputExp : `dict` [`float`,
(`~lsst.afw.image.exposure.exposure.ExposureF`,
`~lsst.afw.image.exposure.exposure.ExposureF`, ...,
`~lsst.afw.image.exposure.exposure.ExposureF`)]
Dictionary that groups flat-field exposures that have the same
exposure time (seconds).
inputDims : `list`
List of exposure IDs.
Definition at line 200 of file cpExtractPtcTask.py.