|
LSST Applications
21.0.0-131-g8cabc107+528f53ee53,22.0.0+00495a2688,22.0.0+0ef2527977,22.0.0+11a2aa21cd,22.0.0+269b7e55e3,22.0.0+2c6b6677a3,22.0.0+64c1bc5aa5,22.0.0+7b3a3f865e,22.0.0+e1b6d2281c,22.0.0+ff3c34362c,22.0.1-1-g1b65d06+c95cbdf3df,22.0.1-1-g7058be7+1cf78af69b,22.0.1-1-g7dab645+2a65e40b06,22.0.1-1-g8760c09+64c1bc5aa5,22.0.1-1-g949febb+64c1bc5aa5,22.0.1-1-ga324b9c+269b7e55e3,22.0.1-1-gf9d8b05+ff3c34362c,22.0.1-10-g781e53d+9b51d1cd24,22.0.1-10-gba590ab+b9624b875d,22.0.1-13-g76f9b8d+2c6b6677a3,22.0.1-14-g22236948+57af756299,22.0.1-18-g3db9cf4b+9b7092c56c,22.0.1-18-gb17765a+2264247a6b,22.0.1-2-g8ef0a89+2c6b6677a3,22.0.1-2-gcb770ba+c99495d3c6,22.0.1-24-g2e899d296+4206820b0d,22.0.1-3-g7aa11f2+2c6b6677a3,22.0.1-3-g8c1d971+f253ffa91f,22.0.1-3-g997b569+ff3b2f8649,22.0.1-4-g1930a60+6871d0c7f6,22.0.1-4-g5b7b756+6b209d634c,22.0.1-6-ga02864e+6871d0c7f6,22.0.1-7-g3402376+a1a2182ac4,22.0.1-7-g65f59fa+54b92689ce,master-gcc5351303a+e1b6d2281c,w.2021.32
LSST Data Management Base Package
|
Classes | |
| class | PairedVisitListTaskRunner |
| class | SingleVisitListTaskRunner |
| class | NonexistentDatasetTaskDataIdContainer |
Functions | |
| def | sigmaClipCorrection (nSigClip) |
| def | calculateWeightedReducedChi2 (measured, model, weightsMeasured, nData, nParsModel) |
| def | makeMockFlats (expTime, gain=1.0, readNoiseElectrons=5, fluxElectrons=1000, randomSeedFlat1=1984, randomSeedFlat2=666, powerLawBfParams=[], expId1=0, expId2=1) |
| def | countMaskedPixels (maskedIm, maskPlane) |
| def | parseCmdlineNumberString (inputString) |
| def | irlsFit (initialParams, dataX, dataY, function, weightsY=None, weightType='Cauchy') |
| def | fitLeastSq (initialParams, dataX, dataY, function, weightsY=None) |
| def | fitBootstrap (initialParams, dataX, dataY, function, weightsY=None, confidenceSigma=1.) |
| def | funcPolynomial (pars, x) |
| def | funcAstier (pars, x) |
| def | arrangeFlatsByExpTime (exposureList, exposureIdList) |
| def | arrangeFlatsByExpId (exposureList, exposureIdList) |
| def | checkExpLengthEqual (exp1, exp2, v1=None, v2=None, raiseWithMessage=False) |
| def | validateIsrConfig (isrTask, mandatory=None, forbidden=None, desirable=None, undesirable=None, checkTrim=True, logName=None) |
| def | ddict2dict (d) |
| def lsst.cp.pipe.utils.arrangeFlatsByExpId | ( | exposureList, | |
| exposureIdList | |||
| ) |
Arrange exposures by exposure ID.
There is no guarantee that this will properly group exposures, but
allows a sequence of flats that have different illumination
(despite having the same exposure time) to be processed.
Parameters
----------
exposureList : `list`[`lsst.afw.image.exposure.exposure.ExposureF`]
Input list of exposures.
exposureIdList : `list`[`int`]
List of exposure ids as obtained by dataId[`exposure`].
Returns
------
flatsAtExpId : `dict` [`float`,
`list`[(`lsst.afw.image.exposure.exposure.ExposureF`, `int`)]]
Dictionary that groups flat-field exposures (and their IDs)
sequentially by their exposure id.
Notes
-----
This algorithm sorts the input exposures by their exposure id, and
then assigns each pair of exposures (exp_j, exp_{j+1}) to pair k,
such that 2*k = j, where j is the python index of one of the
exposures (starting from zero). By checking for the IndexError
while appending, we can ensure that there will only ever be fully
populated pairs.
Definition at line 622 of file utils.py.
| def lsst.cp.pipe.utils.arrangeFlatsByExpTime | ( | exposureList, | |
| exposureIdList | |||
| ) |
Arrange exposures by exposure time.
Parameters
----------
exposureList : `list`[`lsst.afw.image.exposure.exposure.ExposureF`]
Input list of exposures.
exposureIdList : `list`[`int`]
List of exposure ids as obtained by dataId[`exposure`].
Returns
------
flatsAtExpTime : `dict` [`float`,
`list`[(`lsst.afw.image.exposure.exposure.ExposureF`, `int`)]]
Dictionary that groups flat-field exposures (and their IDs) that have
the same exposure time (seconds).
Definition at line 594 of file utils.py.
| def lsst.cp.pipe.utils.calculateWeightedReducedChi2 | ( | measured, | |
| model, | |||
| weightsMeasured, | |||
| nData, | |||
| nParsModel | |||
| ) |
Calculate weighted reduced chi2.
Parameters
----------
measured : `list`
List with measured data.
model : `list`
List with modeled data.
weightsMeasured : `list`
List with weights for the measured data.
nData : `int`
Number of data points.
nParsModel : `int`
Number of parameters in the model.
Returns
-------
redWeightedChi2 : `float`
Reduced weighted chi2.
Definition at line 69 of file utils.py.
| def lsst.cp.pipe.utils.checkExpLengthEqual | ( | exp1, | |
| exp2, | |||
v1 = None, |
|||
v2 = None, |
|||
raiseWithMessage = False |
|||
| ) |
Check the exposure lengths of two exposures are equal.
Parameters:
-----------
exp1 : `lsst.afw.image.exposure.ExposureF`
First exposure to check
exp2 : `lsst.afw.image.exposure.ExposureF`
Second exposure to check
v1 : `int` or `str`, optional
First visit of the visit pair
v2 : `int` or `str`, optional
Second visit of the visit pair
raiseWithMessage : `bool`
If True, instead of returning a bool, raise a RuntimeError if exposure
times are not equal, with a message about which visits mismatch if the
information is available.
Raises:
-------
RuntimeError
Raised if the exposure lengths of the two exposures are not equal
Definition at line 673 of file utils.py.
| def lsst.cp.pipe.utils.countMaskedPixels | ( | maskedIm, | |
| maskPlane | |||
| ) |
Count the number of pixels in a given mask plane.
Definition at line 200 of file utils.py.
| def lsst.cp.pipe.utils.ddict2dict | ( | d | ) |
| def lsst.cp.pipe.utils.fitBootstrap | ( | initialParams, | |
| dataX, | |||
| dataY, | |||
| function, | |||
weightsY = None, |
|||
confidenceSigma = 1. |
|||
| ) |
Do a fit using least squares and bootstrap to estimate parameter errors.
The bootstrap error bars are calculated by fitting 100 random data sets.
Parameters
----------
initialParams : `list` of `float`
initial values for fit parameters. For ptcFitType=POLYNOMIAL, its length
determines the degree of the polynomial.
dataX : `numpy.array` of `float`
Data in the abscissa axis.
dataY : `numpy.array` of `float`
Data in the ordinate axis.
function : callable object (function)
Function to fit the data with.
weightsY : `numpy.array` of `float`, optional.
Weights of the data in the ordinate axis.
confidenceSigma : `float`, optional.
Number of sigmas that determine confidence interval for the bootstrap errors.
Return
------
pFitBootstrap : `list` of `float`
List with fitted parameters.
pErrBootstrap : `list` of `float`
List with errors for fitted parameters.
reducedChiSqBootstrap : `float`
Reduced chi squared, unweighted if weightsY is not provided.
Definition at line 487 of file utils.py.
| def lsst.cp.pipe.utils.fitLeastSq | ( | initialParams, | |
| dataX, | |||
| dataY, | |||
| function, | |||
weightsY = None |
|||
| ) |
Do a fit and estimate the parameter errors using using scipy.optimize.leastq.
optimize.leastsq returns the fractional covariance matrix. To estimate the
standard deviation of the fit parameters, multiply the entries of this matrix
by the unweighted reduced chi squared and take the square root of the diagonal elements.
Parameters
----------
initialParams : `list` of `float`
initial values for fit parameters. For ptcFitType=POLYNOMIAL, its length
determines the degree of the polynomial.
dataX : `numpy.array` of `float`
Data in the abscissa axis.
dataY : `numpy.array` of `float`
Data in the ordinate axis.
function : callable object (function)
Function to fit the data with.
weightsY : `numpy.array` of `float`
Weights of the data in the ordinate axis.
Return
------
pFitSingleLeastSquares : `list` of `float`
List with fitted parameters.
pErrSingleLeastSquares : `list` of `float`
List with errors for fitted parameters.
reducedChiSqSingleLeastSquares : `float`
Reduced chi squared, unweighted if weightsY is not provided.
Definition at line 420 of file utils.py.
| def lsst.cp.pipe.utils.funcAstier | ( | pars, | |
| x | |||
| ) |
Single brighter-fatter parameter model for PTC; Equation 16 of Astier+19.
Parameters
----------
params : `list`
Parameters of the model: a00 (brightter-fatter), gain (e/ADU), and noise (e^2).
x : `numpy.array`
Signal mu (ADU).
Returns
-------
C_00 (variance) in ADU^2.
Definition at line 575 of file utils.py.
| def lsst.cp.pipe.utils.funcPolynomial | ( | pars, | |
| x | |||
| ) |
| def lsst.cp.pipe.utils.irlsFit | ( | initialParams, | |
| dataX, | |||
| dataY, | |||
| function, | |||
weightsY = None, |
|||
weightType = 'Cauchy' |
|||
| ) |
Iteratively reweighted least squares fit.
This uses the `lsst.cp.pipe.utils.fitLeastSq`, but applies weights
based on the Cauchy distribution by default. Other weight options
are implemented. See e.g. Holland and Welsch, 1977,
doi:10.1080/03610927708827533
Parameters
----------
initialParams : `list` [`float`]
Starting parameters.
dataX : `numpy.array` [`float`]
Abscissa data.
dataY : `numpy.array` [`float`]
Ordinate data.
function : callable
Function to fit.
weightsY : `numpy.array` [`float`]
Weights to apply to the data.
weightType : `str`, optional
Type of weighting to use. One of Cauchy, Anderson, bisquare,
box, Welsch, Huber, logistic, or Fair.
Returns
-------
polyFit : `list` [`float`]
Final best fit parameters.
polyFitErr : `list` [`float`]
Final errors on fit parameters.
chiSq : `float`
Reduced chi squared.
weightsY : `list` [`float`]
Final weights used for each point.
Raises
------
RuntimeError :
Raised if an unknown weightType string is passed.
Definition at line 327 of file utils.py.
| def lsst.cp.pipe.utils.makeMockFlats | ( | expTime, | |
gain = 1.0, |
|||
readNoiseElectrons = 5, |
|||
fluxElectrons = 1000, |
|||
randomSeedFlat1 = 1984, |
|||
randomSeedFlat2 = 666, |
|||
powerLawBfParams = [], |
|||
expId1 = 0, |
|||
expId2 = 1 |
|||
| ) |
Create a pair or mock flats with isrMock.
Parameters
----------
expTime : `float`
Exposure time of the flats.
gain : `float`, optional
Gain, in e/ADU.
readNoiseElectrons : `float`, optional
Read noise rms, in electrons.
fluxElectrons : `float`, optional
Flux of flats, in electrons per second.
randomSeedFlat1 : `int`, optional
Random seed for the normal distrubutions for the mean signal and noise (flat1).
randomSeedFlat2 : `int`, optional
Random seed for the normal distrubutions for the mean signal and noise (flat2).
powerLawBfParams : `list`, optional
Parameters for `galsim.cdmodel.PowerLawCD` to simulate the brightter-fatter effect.
expId1 : `int`, optional
Exposure ID for first flat.
expId2 : `int`, optional
Exposure ID for second flat.
Returns
-------
flatExp1 : `lsst.afw.image.exposure.exposure.ExposureF`
First exposure of flat field pair.
flatExp2 : `lsst.afw.image.exposure.exposure.ExposureF`
Second exposure of flat field pair.
Notes
-----
The parameters of `galsim.cdmodel.PowerLawCD` are `n, r0, t0, rx, tx, r, t, alpha`. For more
information about their meaning, see the Galsim documentation
https://galsim-developers.github.io/GalSim/_build/html/_modules/galsim/cdmodel.html
and Gruen+15 (1501.02802).
Example: galsim.cdmodel.PowerLawCD(8, 1.1e-7, 1.1e-7, 1.0e-8, 1.0e-8, 1.0e-9, 1.0e-9, 2.0)
Definition at line 101 of file utils.py.
| def lsst.cp.pipe.utils.parseCmdlineNumberString | ( | inputString | ) |
Parse command line numerical expression sytax and return as list of int Take an input of the form "'1..5:2^123..126'" as a string, and return a list of ints as [1, 3, 5, 123, 124, 125, 126]
Definition at line 242 of file utils.py.
| def lsst.cp.pipe.utils.sigmaClipCorrection | ( | nSigClip | ) |
Correct measured sigma to account for clipping.
If we clip our input data and then measure sigma, then the
measured sigma is smaller than the true value because real
points beyond the clip threshold have been removed. This is a
small (1.5% at nSigClip=3) effect when nSigClip >~ 3, but the
default parameters for measure crosstalk use nSigClip=2.0.
This causes the measured sigma to be about 15% smaller than
real. This formula corrects the issue, for the symmetric case
(upper clip threshold equal to lower clip threshold).
Parameters
----------
nSigClip : `float`
Number of sigma the measurement was clipped by.
Returns
-------
scaleFactor : `float`
Scale factor to increase the measured sigma by.
| def lsst.cp.pipe.utils.validateIsrConfig | ( | isrTask, | |
mandatory = None, |
|||
forbidden = None, |
|||
desirable = None, |
|||
undesirable = None, |
|||
checkTrim = True, |
|||
logName = None |
|||
| ) |
Check that appropriate ISR settings have been selected for the task.
Note that this checks that the task itself is configured correctly rather
than checking a config.
Parameters
----------
isrTask : `lsst.ip.isr.IsrTask`
The task whose config is to be validated
mandatory : `iterable` of `str`
isr steps that must be set to True. Raises if False or missing
forbidden : `iterable` of `str`
isr steps that must be set to False. Raises if True, warns if missing
desirable : `iterable` of `str`
isr steps that should probably be set to True. Warns is False, info if
missing
undesirable : `iterable` of `str`
isr steps that should probably be set to False. Warns is True, info if
missing
checkTrim : `bool`
Check to ensure the isrTask's assembly subtask is trimming the images.
This is a separate config as it is very ugly to do this within the
normal configuration lists as it is an option of a sub task.
Raises
------
RuntimeError
Raised if ``mandatory`` config parameters are False,
or if ``forbidden`` parameters are True.
TypeError
Raised if parameter ``isrTask`` is an invalid type.
Notes
-----
Logs warnings using an isrValidation logger for desirable/undesirable
options that are of the wrong polarity or if keys are missing.
Definition at line 710 of file utils.py.