get_template_inputs#

lsst.analysis.ap.get_template_inputs(butler, dia_sources, *, instrument=None, template_dataset='template_detector')#

Find the observation times and weights of the images that make up the template at the position of each diaSource.

Parameters#

butlerlsst.daf.butler.Butler

Butler with the templates and the coadds they were built from. Coadds are found by dataset ID, so their collections need not be searched.

dia_sourcesastropy.table.Table or pandas.DataFrame

DiaSources, with columns diaSourceId, visit, detector, ra, dec (degrees) and x, y (science image pixels).

instrumentstr, optional

Instrument name, if the butler has no default.

template_datasetstr, optional

Template dataset type; must be an lsst.images.DifferenceImage.

Returns#

inputsastropy.table.Table

One row per (diaSource, template coadd, input image), with columns:

diaSourceId, visit, detector

The diaSource and its science image.

tract, patch

Template coadd the input contributed through.

input_visit, input_detector

The input image.

mid_mjd_tai

Mid-exposure time of the input (MJD, TAI); nan if unknown.

exposure_time

Exposure time of the input (s); nan if unknown.

coadd_weight

Weight of the input as recorded by the coadd.

weight

Fraction of the template flux at the diaSource that came from this input through this coadd. These sum to 1 for each diaSource; an input in several overlapping coadds has one row for each.

Raises#

TypeError

Raised if template_dataset has no templates component (a legacy Exposure), or if a coadd has no known provenance component.

LookupError

Raised if a template coadd is missing from the butler.

Notes#

The weights are evaluated at the diaSource position only. Warping the template and PSF matching both mix in nearby template pixels, which can come from other coadds or inputs; that is not modeled. Per-pixel input rejection (masked pixels, or artifacts clipped by lsst.drp.tasks.assemble_coadd.CompareWarpAssembleCoaddTask) is not recorded in coadd provenance, so a rejected input is still reported.