LVV-57 specifies the requirement that DM verify calibration products. We currently do not have code for this, but will want to by the end of the year. The goal of this RFC is to get my current thoughts down, and ensure that there's a consensus on how this will work.
The first point is that there will be no intent to write direct Gen2 middleware implementation of LVV-57. Gen3 is usable now, and has better calibration handling than Gen2, which should make performing the validation on newly constructed calibrations possible.
Currently, the only calibration validation code is in `cp_pipe`. This includes the debug code in measureCrosstalk, and the PTC plots in plotPtc. This is largely diagnostic code to track down bad input data and algorithm differences. I don't think this framework is going to work in the long term, and so I think we'll want to add a new package to the stack to handle this work, tentatively named `cp_verify`.
`cp_verify` should supply a set of pipelineTasks that implement all the tests defined in a final version of DMTN-101. Each task should take as input the calibration to be validated, any post-`IsrTask` processed raw frames to be used for comparison, and optionally any pre-existing calibrations to compare the input calibration against. These `lsst.cp.verify.CalibXyVerifyTask` will perform all the tests defined, and output a yaml dataset describing the status for those tests. This will likely need some visualization code to view those datasets (checking for failures as a function of the amplifier/detector position on the focal plane). In addition, the items recorded in those yaml datasets should be used to create proper `lsst.verify` metrics (as is done by `ap_verify`). These tasks will provide the step necessary to validate a proposed calibration can be certified into the main Gen3 calibration collection.
In addition to this validation mode, the same tasks will be able to provide a way to monitor performance over time, either by passing newly taken "raw" calibration frames to compare against, or by passing newly constructed proposed calibrations to compare against the current version in the calibration collection. Combining this with the metrics code will provide an easily trackable way to identify jumps and drifts in the residual values over time.
`ci_cpp` has not yet merged, but as the tests are defined in `cp_verify`, they should be used as part of the unit tests used in the `ci_cpp` packages, with failures used to identify ways to improve either the `cp_pipe` code or the scope of the `ci_cpp` test data.
DMTN-101 currently describes tests to perform for bias and dark frames (among other calibrations), but is incomplete for some calibrations (including flats). This needs to be finalized before `cp_verify` can claim to satisfy LVV-57.
I've set the end date for this RFC to the end of the month, as any implementation is unlikely to start before then. This should provide enough time to identify anything else that could be a blocker to `cp_verify` implementation.