Guards on SFM PSF quality for inclusion in coaddition now activated by default

As of DM-32625, the MakeCoaddTempExpTask (now often referred to as makeWarp, e.g. in pipeline yaml files) now retargets its select subtask – inherited from CoaddBaseTask where it defaults to WcsSelectImagesTask – to PsfWcsSelectImagesTask. The selection under consideration is whether or not a given visit-level Single Frame Processed detector should be included in the coadd, based on two PSF model quality metrics:

  • maxEllipResidual: Maximum median ellipticity residual"
  • maxScaledSizeScatter:Maximum scatter in the size residuals, scaled by the median size"

These are configurable thresholds and are defined here:

Any detectors that have metric values (as recorded in the visitSummary tables persisted during SFP) that do not meet either of these criteria are deemed to be of poor quality and are not included in the coadd. When this occurs, the logs will print something along the lines of:

{"name": "", "asctime": "2022-01-08T05:27:30.246430+00:00", "message": "Removing visit 23876 detector 80 because scaled size scatter too large: 0.009733 vs 0.009000", "levelno": 20, "levelname": "INFO", "filename": "", "pathname": "/software/lsstsw/stack_20210813/stack/miniconda3-py38_4.", "lineno": 460, "funcName": "isValid", "process": 4671, "processName": "MainProcess", "MDC": {"LABEL": "makeWarp:{instrument: 'HSC', skymap: 'hsc_rings_v1', tract: 9615, patch: 69, visit: 23876, ...}", "RUN": "HSC/runs/RC2/w_2021_50/DM-32987/20220107T222123Z"}}
{"name": "", "asctime": "2022-01-08T05:33:26.119952+00:00", "message": "Removing visit 34464 detector 1 because median e residual too large: 0.012069 vs 0.007000", "levelno": 20, "levelname": "INFO", "filename": "", "pathname": "/software/lsstsw/stack_20210813/stack/miniconda3-py38_4.9.2-0.7.0/Linux64/pipe_tasks/21.0.0-178-g80f1dd77+8321431476/python/lsst/pipe/tasks/", "lineno": 452, "funcName": "isValid", "process": 27433, "processName": "MainProcess", "MDC": {"LABEL": "makeWarp:{instrument: 'HSC', skymap: 'hsc_rings_v1', tract: 9697, patch: 69, visit: 34464, ...}", "RUN": "HSC/runs/RC2/w_2021_50/DM-32987/20220107T222123Z"}}

Of particular note, the threshold defaults currently in place are those which have been calibrated for HSC data (i.e. these are used in the official production runs). While, in theory, these values are meant to apply for any dataset with weak lensing as one of its primary science cases, the optimal values for a given observational campaign may depend on data quality considerations unique to the campaign itself. We have indeed already included overrides in the obs_lsst package for the LSSTCam-imSim (a.k.a imsim) here as the current defaults were not appropriate for the simulated dataset. See DM-32625]([DM-32625] Activate guards on SFM PSF quality for inclusion in coaddition for LSSTCam-imSim - Jira) for details on how the appropriate values were determined. We are keeping a tight eye on these thresholds, especially looking at data from different cameras (@lskelvin is already looking at the distributions for some DECam data) and may revisit the current strategy if necessary.

Since this culling of “bad quality PSF model” detectors from SFP is now the default behavior, all coadd creation via the MakeCoaddTempExpTask will be subject to it, and users should take care to make sure the threshold values are appropriate for their use case. If reverting to the previous behavior is desired, this can be accomplished by retargeting the select subtask to back to the one used prior to this update, namely WcsSelectImagesTask. So, for example, in a pipeline yaml file for obs_lsst imsim, this would look like:

description: Example of retargeting select task in makeWarp for imsim
instrument: lsst.obs.lsst.LsstCamImSim
    # Inherits directly from obs_lsst
    - location: $OBS_LSST_DIR/pipelines/imsim/DRP.yaml
    class: lsst.pipe.tasks.makeCoaddTempExp.MakeWarpTask
      python: >
        from lsst.pipe.tasks.selectImages import WcsSelectImagesTask;

or, if one simply wanted to override the defaults, the makeWarp section would look like:

     class: lsst.pipe.tasks.makeCoaddTempExp.MakeWarpTask
       select.maxEllipResidual: 9.999
       select.maxScaledSizeScatter: 9.999