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-33557: Add cp_verify tests to ci_cpp #32

Merged
merged 6 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions pipelines/Latiss/VerifyLinearity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ description: cp_verify LINEARITY calibration verification
instrument: lsst.obs.lsst.Latiss
imports:
- location: $CP_VERIFY_DIR/pipelines/_ingredients/VerifyLinearity.yaml
tasks:
verifyLinearitySecondLinearizer:
class: lsst.cp.verify.verifyLinearity.CpvLinearitySolveTask
config:
linearityType: "Spline"
2 changes: 2 additions & 0 deletions pipelines/_ingredients/VerifyBfk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ tasks:
connections.exposure: 'verifyBfkIsr'
doApCorr: false
doDeblend: false
doMeasurePsf: false
verifyUncorrectedBfkIsr:
class: lsst.ip.isr.isrTask.IsrTask
config:
Expand All @@ -30,6 +31,7 @@ tasks:
connections.outputSchema: 'verifyUncorrBfk_schema'
doApCorr: false
doDeblend: false
doMeasurePsf: false
verifyBfkChip:
class: lsst.cp.verify.verifyBfk.CpVerifyBfkTask
config:
Expand Down
6 changes: 4 additions & 2 deletions python/lsst/cp/verify/verifyBfk.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,13 @@ def catalogStatistics(self, exposure, catalog, uncorrectedCatalog, statControl):
outputStatistics['SIZE_DIFF'] = sizeDiff
return outputStatistics

xxKey = 'ext_shapeHSM_HsmSourceMoments_xx'
yyKey = 'ext_shapeHSM_HsmSourceMoments_yy'
for source, uncorrectedSource, d in matches:
# This uses the simple difference in source moments.
sourceMagnitude = -2.5 * np.log10(source.getPsfInstFlux())
sourceSize = source['base_SdssShape_xx'] + source['base_SdssShape_yy']
uncorrectedSize = uncorrectedSource['base_SdssShape_xx'] + uncorrectedSource['base_SdssShape_yy']
sourceSize = source[xxKey] + source[yyKey]
uncorrectedSize = uncorrectedSource[xxKey] + uncorrectedSource[yyKey]

magnitude.append(float(sourceMagnitude))
sizeDiff.append(float(uncorrectedSize - sourceSize))
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/cp/verify/verifyCalib.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CpVerifyCalibConnections(pipeBase.PipelineTaskConnections,
deferLoad=True,
)

inputCalib = cT.Input(
inputCalib = cT.PrerequisiteInput(
name="calib",
doc="Input calib to calculate statistics for.",
storageClass="IsrCalib",
Expand Down
12 changes: 0 additions & 12 deletions python/lsst/cp/verify/verifyLinearity.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,6 @@ class CpvLinearitySolveConnections(pipeBase.PipelineTaskConnections,
dimensions=("instrument", "detector"),
isCalibration=True,
)
inputPhotodiodeData = cT.PrerequisiteInput(
name="photodiode",
doc="Photodiode readings data.",
storageClass="IsrCalib",
dimensions=("instrument", "exposure"),
multiple=True,
deferLoad=True,
minimum=0,
)
inputPhotodiodeCorrection = cT.Input(
name="cpvPdCorrection",
doc="Input photodiode correction.",
Expand All @@ -270,9 +261,6 @@ def __init__(self, *, config=None):
if config.applyPhotodiodeCorrection is not True:
self.inputs.discard("inputPhotodiodeCorrection")

if config.usePhotodiode is not True:
self.inputs.discard("inputPhotodiodeData")


class CpvLinearitySolveConfig(cpPipe.LinearitySolveConfig,
pipelineConnections=CpvLinearitySolveConnections):
Expand Down
22 changes: 4 additions & 18 deletions python/lsst/cp/verify/verifyPtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,13 @@
import numpy as np
import lsst.pex.config as pexConfig

import lsst.pipe.base.connectionTypes as cT
from .verifyCalib import CpVerifyCalibConfig, CpVerifyCalibTask, CpVerifyCalibConnections

__all__ = ['CpVerifyPtcConnections', 'CpVerifyPtcConfig', 'CpVerifyPtcTask']


class CpVerifyPtcConnections(CpVerifyCalibConnections,
dimensions={"instrument", "detector"},
defaultTemplates={}):
inputCalib = cT.Input(
name="calib",
doc="Input calib to calculate statistics for.",
storageClass="PhotonTransferCurveDataset",
dimensions=["instrument", "detector"],
isCalibration=True
)
__all__ = ['CpVerifyPtcConfig', 'CpVerifyPtcTask']


class CpVerifyPtcConfig(CpVerifyCalibConfig,
pipelineConnections=CpVerifyPtcConnections):
pipelineConnections=CpVerifyCalibConnections):
"""Inherits from base CpVerifyCalibConfig."""

def setDefaults(self):
Expand Down Expand Up @@ -143,10 +130,9 @@ def amplifierStatistics(self, inputCalib, camera=None):
outputStatistics[ampName]['PTC_TURNOFF'] = inputCalib.ptcTurnoff[ampName]
outputStatistics[ampName]['PTC_FIT_TYPE'] = ptcFitType
if ptcFitType == 'EXPAPPROXIMATION':
outputStatistics[ampName]['PTC_BFE_A00'] = inputCalib.ptcFitPars[ampName][0]
outputStatistics[ampName]['PTC_BFE_A00'] = float(inputCalib.ptcFitPars[ampName][0])
if ptcFitType == 'FULLCOVARIANCE':
outputStatistics[ampName]['PTC_BFE_A00'] = inputCalib.aMatrix[ampName][0][0]

outputStatistics[ampName]['PTC_BFE_A00'] = float(inputCalib.aMatrix[ampName][0][0])
return outputStatistics

def verify(self, calib, statisticsDict, camera=None):
Expand Down