DECam data: RuntimeError: Templates constructed from multiple Tracts not yet supported

We are attempting to process DECam data starting from raw files. We seem to process the data properly to the calexp phase. At this point, we make a skymap with
butler register-skymap -c name='Skymap_1' .
This command appears to run without error. We then generate templates with a command similar to
pipetask run -j30 --register-dataset-types -d "exposure IN ([LONG LIST OF EXPOSURES])" -b . -i skymaps,processed_data/calibrate -o processed_data/template_58576 -p yamls/coadd.yaml

where coadd.yaml is

description: The AP template building pipeline specialized for DECam
# This pipeline assumes the working repo has raws, calibs, refcats, and a skymap.
# An example of running it:
  # pipetask run -j 4
  #              -b REPO
  #              -d "exposure IN (289409, 289697, 288935)"
  #              -i DECam/raw/all,DECam/calib,DECam/calib/DM-26971,refcats/gen2,skymaps
  #              -o DECam/templates/test1
  #              -p APTemplate.yaml --register-dataset-types
instrument: lsst.obs.decam.DarkEnergyCamera
tasks:
  makeWarp:
    class: lsst.pipe.tasks.makeCoaddTempExp.MakeWarpTask
    config:
      makePsfMatched: true
      doWriteEmptyWarps: true
  assembleCoadd:
    class: lsst.pipe.tasks.assembleCoadd.CompareWarpAssembleCoaddTask
    config:
      doInputMap: true

Then, when we try to run image differencing with

pipetask run -j30 --register-dataset-types -d "exposure IN ([DIFFERENT LONG LIST OF EXPOSURES])" -b . -i skymaps,processed_data/template_58576,processed_data/calibrate -o processed_data/diff_58611 -p yamls/imdiff.yaml
where imdiff.yaml is

description: The AP template building pipeline specialized for DECam
# This pipeline assumes the working repo has raws, calibs, refcats, and a skymap.
# An example of running it:
  # pipetask run -j 4
  #              -b REPO
  #              -d "exposure IN (289409, 289697, 288935)"
  #              -i DECam/raw/all,DECam/calib,DECam/calib/DM-26971,refcats/gen2,skymaps
  #              -o DECam/templates/test1
  #              -p APTemplate.yaml --register-dataset-types
instrument: lsst.obs.decam.DarkEnergyCamera
tasks:
  imageDifference:
    class: lsst.pipe.tasks.imageDifference.ImageDifferenceTask
    config:
      # Always prefer decorrelation; may eventually become ImageDifferenceTask default
      doDecorrelation: True
      detection.thresholdValue: 5.0  # needed with doDecorrelation
      # Don't have source catalogs for templates
      doSelectSources: False

we get the error RuntimeError: Templates constructed from multiple Tracts not yet supported.

How can we adjust our scripts to solve this error? Is there a way to make a skymap centered on a given collection so that the collection is within a single tract? All of the images in the collection are aligned to the approx. 20’’ level.

This is a known limitation in image differencing that we are actively working on. If you need a workaround, you’ll need to define a different skymap with one giant tract… and I’m not sure exactly how to do that offhand :slight_smile: You can follow https://jira.lsstcorp.org/browse/DM-29310 for the latest.

Thanks for the info. DM-29310 mentions making another DM to track the issue of not being able to use templates over multiple tracts. I couldn’t find that DM with a quick search. Do you happen to know if it has been made yet?

Can anyone point me to how I might implement the workaround that Meredith is suggesting (or any other possible workaround)?

A new ticket was just made yesterday for me to do it. I haven’t had a chance yet. It’s DM-30496.

Thank you for the ticket number. I’ll be sure to keep an eye on the progress.

Just to make sure I understand the nature of this RuntimeError limitation, I have a couple questions. Is this a problem only with wide field data across large regions of the sky? The current data we are trying to process is all centered around the same location on the sky. It is about 200 images all with the same RA and DEC. i.e. it’s a single focal plane observed many times over. Is there any way to adjust the skymap generation so that the tracts are somehow centered on this focal plane location, and thus the templates only belong to a single tract?

I’m sure there is a way, and figuring out how to do this is exactly what I plan to work on… soon. Any bored skymap experts reading this are welcome to chime in with tips. The size of the tract isn’t inherently an issue; exactly where it is plopped on the sky so all your stuff falls inside it is the issue. We’re on the same page.