LSSTApplications
21.0.0+1b62c9342b,21.0.0+45a059f35e,21.0.0-1-ga51b5d4+ceb9cf20a3,21.0.0-19-g7c7630f+a88ebbf2d9,21.0.0-2-g103fe59+3522cf3bc7,21.0.0-2-g1367e85+571a348718,21.0.0-2-g2909d54+45a059f35e,21.0.0-2-g45278ab+1b62c9342b,21.0.0-2-g4bc9b9f+35a70d5868,21.0.0-2-g5242d73+571a348718,21.0.0-2-g54e2caa+aa129c4686,21.0.0-2-g66bcc37+3caef57c29,21.0.0-2-g7f82c8f+6f9059e2fe,21.0.0-2-g8dde007+5d1b9cb3f5,21.0.0-2-g8f08a60+73884b2cf5,21.0.0-2-g973f35b+1d054a08b9,21.0.0-2-ga326454+6f9059e2fe,21.0.0-2-ga63a54e+3d2c655db6,21.0.0-2-gc738bc1+a567cb0f17,21.0.0-2-gde069b7+5a8f2956b8,21.0.0-2-ge17e5af+571a348718,21.0.0-2-ge712728+834f2a3ece,21.0.0-2-gecfae73+dfe6e80958,21.0.0-2-gfc62afb+571a348718,21.0.0-21-g006371a9+88174a2081,21.0.0-3-g4c5b185+7fd31a6834,21.0.0-3-g6d51c4a+3caef57c29,21.0.0-3-gaa929c8+55f5a6a5c9,21.0.0-3-gd222c45+afc8332dbe,21.0.0-3-gd5de2f2+3caef57c29,21.0.0-4-g3300ddd+1b62c9342b,21.0.0-4-g5873dc9+9a92674037,21.0.0-4-g8a80011+5955f0fd15,21.0.0-5-gb7080ec+8658c79ec4,21.0.0-5-gcff38f6+89f2a0074d,21.0.0-6-gd3283ba+55f5a6a5c9,21.0.0-8-g19111d86+2c4b0a9f47,21.0.0-9-g7bed000b9+c7d3cce47e,w.2021.03
LSSTDataManagementBasePackage
|
Public Member Functions | |
def | __init__ (self, inputTuple, maxRangeFromTuple=8, meanSignalMask=[]) |
def | subtractDistantOffset (self, maxLag=8, startLag=5, polDegree=1) |
def | copy (self) |
def | initFit (self) |
def | getParamValues (self) |
def | setParamValues (self, p) |
def | evalCovModel (self, mu=None) |
def | getA (self) |
def | getB (self) |
def | getC (self) |
def | getACov (self) |
def | getASig (self) |
def | getBCov (self) |
def | getCCov (self) |
def | getGainErr (self) |
def | getNoiseCov (self) |
def | getNoiseSig (self) |
def | getGain (self) |
def | getRon (self) |
def | getRonErr (self) |
def | getNoise (self) |
def | getMaskCov (self, i, j) |
def | setAandB (self, a, b) |
def | chi2 (self) |
def | wres (self, params=None) |
def | weightedRes (self, params=None) |
def | fitFullModel (self, pInit=None) |
def | ndof (self) |
def | getFitData (self, i, j, divideByMu=False, unitsElectrons=False, returnMasked=False) |
def | __call__ (self, params) |
Public Attributes | |
mu | |
sqrtW | |
r | |
logger | |
maskMu | |
cov | |
vcov | |
params | |
covParams | |
A class to fit the models in Astier+19 to flat covariances. This code implements the model(and the fit thereof) described in Astier+19: https://arxiv.org/pdf/1905.08677.pdf For the time being it uses as input a numpy recarray (tuple with named tags) which contains one row per covariance and per pair: see the routine makeCovArray. Parameters ---------- inputTuple: `numpy.recarray` Tuple with at least (mu, cov, var, i, j, npix), where: mu : 0.5*(m1 + m2), where: mu1: mean value of flat1 mu2: mean value of flat2 cov: covariance value at lag(i, j) var: variance(covariance value at lag(0, 0)) i: lag dimension j: lag dimension npix: number of pixels used for covariance calculation. maxRangeFromTuple: `int`, optional Maximum range to select from tuple. meanSignalMask: `list`[`bool`], optional Mask of mean signal 1D array. Use all entries if empty.
Definition at line 213 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.__init__ | ( | self, | |
inputTuple, | |||
maxRangeFromTuple = 8 , |
|||
meanSignalMask = [] |
|||
) |
Definition at line 241 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.__call__ | ( | self, | |
params | |||
) |
Definition at line 664 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.chi2 | ( | self | ) |
def lsst.cp.pipe.astierCovPtcFit.CovFit.copy | ( | self | ) |
Make a copy of params
Definition at line 284 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.evalCovModel | ( | self, | |
mu = None |
|||
) |
Computes full covariances model (Eq. 20 of Astier+19). Parameters ---------- mu: `numpy.array`, optional List of mean signals. Returns ------- covModel: `numpy.array` Covariances model. Notes ----- By default, computes the covModel for the mu's stored(self.mu). Returns cov[Nmu, self.r, self.r]. The variance for the PTC is cov[:, 0, 0]. mu and cov are in ADUs and ADUs squared. To use electrons for both, the gain should be set to 1. This routine implements the model in Astier+19 (1905.08677). The parameters of the full model for C_ij(mu) ("C_ij" and "mu" in ADU^2 and ADU, respectively) in Astier+19 (Eq. 20) are: "a" coefficients (r by r matrix), units: 1/e "b" coefficients (r by r matrix), units: 1/e noise matrix (r by r matrix), units: e^2 gain, units: e/ADU "b" appears in Eq. 20 only through the "ab" combination, which is defined in this code as "c=ab".
Definition at line 342 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.fitFullModel | ( | self, | |
pInit = None |
|||
) |
Fit measured covariances to full model in Astier+19 (Eq. 20) Parameters ---------- pInit : `list` Initial parameters of the fit. len(pInit) = #entries(a) + #entries(c) + #entries(noise) + 1 len(pInit) = r^2 + r^2 + r^2 + 1, where "r" is the maximum lag considered for the covariances calculation, and the extra "1" is the gain. If "b" is 0, then "c" is 0, and len(pInit) will have r^2 fewer entries. Returns ------- params : `np.array` Fit parameters (see "Notes" below). Notes ----- The parameters of the full model for C_ij(mu) ("C_ij" and "mu" in ADU^2 and ADU, respectively) in Astier+19 (Eq. 20) are: "a" coefficients (r by r matrix), units: 1/e "b" coefficients (r by r matrix), units: 1/e noise matrix (r by r matrix), units: e^2 gain, units: e/ADU "b" appears in Eq. 20 only through the "ab" combination, which is defined in this code as "c=ab".
Definition at line 544 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getA | ( | self | ) |
'a' matrix from Astier+19(e.g., Eq. 20)
Definition at line 408 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getACov | ( | self | ) |
Get covariance matrix of "a" coefficients from fit
Definition at line 431 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getASig | ( | self | ) |
Square root of diagonal of the parameter covariance of the fitted "a" matrix
Definition at line 439 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getB | ( | self | ) |
'b' matrix from Astier+19(e.g., Eq. 20)
Definition at line 412 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getBCov | ( | self | ) |
Get covariance matrix of "a" coefficients from fit b = c /a
Definition at line 447 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getC | ( | self | ) |
'c'='ab' matrix from Astier+19(e.g., Eq. 20)
Definition at line 416 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getCCov | ( | self | ) |
Get covariance matrix of "c" coefficients from fit
Definition at line 457 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getFitData | ( | self, | |
i, | |||
j, | |||
divideByMu = False , |
|||
unitsElectrons = False , |
|||
returnMasked = False |
|||
) |
Get measured signal and covariance, cov model, weigths, and mask at covariance lag (i, j). Parameters --------- i: `int` Lag for covariance matrix. j: `int` Lag for covariance matrix. divideByMu: `bool`, optional Divide covariance, model, and weights by signal mu? unitsElectrons : `bool`, optional mu, covariance, and model are in ADU (or powers of ADU) If tthis parameter is true, these are multiplied by the adequte factors of the gain to return quantities in electrons (or powers of electrons). returnMasked : `bool`, optional Use mask (based on weights) in returned arrays (mu, covariance, and model)? Returns ------- mu: `numpy.array` list of signal values (mu). covariance: `numpy.array` Covariance arrays, indexed by mean signal mu (self.cov[:, i, j]). covarianceModel: `numpy.array` Covariance model (model). weights: `numpy.array` Weights (self.sqrtW) mask : `numpy.array`, optional Boolean mask of the covariance at (i,j). Notes ----- Using a CovFit object, selects from (i, j) and returns mu*gain, self.cov[:, i, j]*gain**2 model*gain**2, and self.sqrtW/gain**2 in electrons or ADU if unitsElectrons=False.
Definition at line 594 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getGain | ( | self | ) |
Get gain (e/ADU)
Definition at line 484 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getGainErr | ( | self | ) |
Get error on fitted gain parameter
Definition at line 462 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getMaskCov | ( | self, | |
i, | |||
j | |||
) |
Get mask of Cov[i,j]
Definition at line 506 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getNoise | ( | self | ) |
Get noise matrix
Definition at line 502 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getNoiseCov | ( | self | ) |
Get covariances of noise matrix from fit
Definition at line 470 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getNoiseSig | ( | self | ) |
Square root of diagonal of the parameter covariance of the fitted "noise" matrix
Definition at line 475 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getParamValues | ( | self | ) |
Return an array of free parameter values (it is a copy).
Definition at line 333 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getRon | ( | self | ) |
Get readout noise (e^2)
Definition at line 488 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.getRonErr | ( | self | ) |
def lsst.cp.pipe.astierCovPtcFit.CovFit.initFit | ( | self | ) |
Performs a crude parabolic fit of the data in order to start the full fit close to the solution.
Definition at line 292 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.ndof | ( | self | ) |
Number of degrees of freedom Returns ------- mask.sum() - len(self.params.free): `int` Number of usable pixels - number of parameters of fit.
Definition at line 582 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.setAandB | ( | self, | |
a, | |||
b | |||
) |
Set "a" and "b" coeffcients forfull Astier+19 model (Eq. 20). "c=a*b".
Definition at line 512 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.setParamValues | ( | self, | |
p | |||
) |
Set parameter values.
Definition at line 337 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.subtractDistantOffset | ( | self, | |
maxLag = 8 , |
|||
startLag = 5 , |
|||
polDegree = 1 |
|||
) |
Subtract a background/offset to the measured covariances. Parameters --------- maxLag: `int` Maximum lag considered startLag: `int` First lag from where to start the offset subtraction. polDegree: `int` Degree of 2D polynomial to fit to covariance to define offse to be subtracted.
Definition at line 252 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.weightedRes | ( | self, | |
params = None |
|||
) |
Weighted residuas. Notes ----- To be used via: c = CovFit(nt) c.initFit() coeffs, cov, _, mesg, ierr = leastsq(c.weightedRes, c.getParamValues(), full_output=True)
Definition at line 532 of file astierCovPtcFit.py.
def lsst.cp.pipe.astierCovPtcFit.CovFit.wres | ( | self, | |
params = None |
|||
) |
To be used in weightedRes
Definition at line 522 of file astierCovPtcFit.py.
lsst.cp.pipe.astierCovPtcFit.CovFit.cov |
Definition at line 278 of file astierCovPtcFit.py.
lsst.cp.pipe.astierCovPtcFit.CovFit.covParams |
Definition at line 578 of file astierCovPtcFit.py.
lsst.cp.pipe.astierCovPtcFit.CovFit.logger |
Definition at line 246 of file astierCovPtcFit.py.
lsst.cp.pipe.astierCovPtcFit.CovFit.maskMu |
Definition at line 248 of file astierCovPtcFit.py.
lsst.cp.pipe.astierCovPtcFit.CovFit.mu |
Definition at line 242 of file astierCovPtcFit.py.
lsst.cp.pipe.astierCovPtcFit.CovFit.params |
Definition at line 299 of file astierCovPtcFit.py.
lsst.cp.pipe.astierCovPtcFit.CovFit.r |
Definition at line 245 of file astierCovPtcFit.py.
lsst.cp.pipe.astierCovPtcFit.CovFit.sqrtW |
Definition at line 244 of file astierCovPtcFit.py.
lsst.cp.pipe.astierCovPtcFit.CovFit.vcov |
Definition at line 279 of file astierCovPtcFit.py.