How do I make a patchRef?

makeWarpTask.runDataRef wants a patchRef. I have the tract, patch, band information. But how do I make the required patchRef object?

dataId = {'tract': 4431, 'patch': 17, 'band': 'i'}

I’m running under w_2022_32 using the DP0.2 dataset on the RSP.

Hi @mwv, could I see more the executable statement you used, and the error message? In running a pipeline task my first thought is perhaps the skymap wasn’t passed along with tract, patch, and band.

Gen2 support was completely removed in w.2022.31 so your code will not run at all in weekly 32…

Just noticed this part of your message. runDataRef is a Gen2 API, hence my comment above, but of course if you are using DP0.2 on RSP that is a Gen3 butler. The gen3 equivalent of runDataRef is runQuantum but setting up the parameters to call runQuantum is non-trivial (you need to populate a dict with all the DatasetRef information). You can therefore either get the datasets you want separately from butler and call .run()or else go a bit higher level and call lsst.ctrl.mpexec.SimplePipelineExecutor, which is a simple frontend to pipetask command line.

Thanks, both.

Yeah, I was really struggling to figure out how to structure the call to runQuantum.

I’ve posted a Notebook example in How do I coadd specifically selected calexps in a Jupyter notebook

along with the larger thing I’m trying to do: make coadds for templates.

FWIW, I think

patch_ref = butler.registry.findDataset(datasetType="skyMap", dataId=dataId)

is one incorrect answer to my question. It generates a datasetRef to the patch.

But as @timj points out, that doesn’t generate the actual patchRef object that the Gen2 runDataRef call was expecting.

I responded in the new thread you started, and I think the draft notebook I sent you via direct message, which demos use of the SimplePipelineExecutor but is not yet ready as a production-level tutorial, will be what you need here.

So I’ll mark this topic as resolved, and we’ll continue in the new thread.

Yes. patchRef is a gen2 butler reference to a dataset, equivalent, but not the same as, a gen3 DeferredDatasetHandle.