Skip to content

Commit

Permalink
Add test cases for PhotonTransferCurveDataset.evalCovModel
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Broughton committed Sep 25, 2024
1 parent 6052b6d commit 123c861
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_ptc.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,15 @@ def test_covAstier(self):
self.assertEqual(
ptc.covariancesModelNoB[ampName].shape, covModelNoBShape
)
# Check if evalPtcModel produces expected values
nanMask = ~np.isnan(ptc.finalMeans[ampName])
means = ptc.finalMeans[ampName][nanMask]
covModel = ptc.covariancesModel[ampName][nanMask]
covariancesModel = ptc.evalPtcModel(means, setBtoZero=False)[ampName]
self.assertFloatsAlmostEqual(covariancesModel, covModel, atol=1e-13)
# Note that the PhotoTransferCurveDataset does not store the gain
# fit parameter for FULLCOVARIANCE with b=0, so we can't compare
# exactly.

# And check that this is serializable
with tempfile.NamedTemporaryFile(suffix=".fits") as f:
Expand Down Expand Up @@ -545,6 +554,14 @@ def ptcFitAndCheckPtc(
np.sqrt(self.noiseSq)
)

# Check if evalColModel produces expected values
if not doFitBootstrap:
nanMask = ~np.isnan(localDataset.finalMeans[ampName])
means = localDataset.finalMeans[ampName][nanMask]
model = localDataset.finalModelVars[ampName][nanMask]
evalVarModel = localDataset.evalPtcModel(means)[ampName]
self.assertFloatsEqual(evalVarModel, model)

def test_lsstcam_samples(self):
for dense in [False, True]:
for mode in ["normal", "upturn", "dip"]:
Expand Down

0 comments on commit 123c861

Please sign in to comment.