LSST Applications g0fba68d861+bb7a7cfa1f,g1ec0fe41b4+f536777771,g1fd858c14a+470a99fdf4,g216c3ac8a7+0d4d80193f,g35bb328faa+fcb1d3bbc8,g4d2262a081+23bd310d1b,g53246c7159+fcb1d3bbc8,g56a49b3a55+369644a549,g5a012ec0e7+3632fc3ff3,g60b5630c4e+3bfb9058a5,g67b6fd64d1+ed4b5058f4,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g8180f54f50+60bd39f3b6,g8352419a5c+fcb1d3bbc8,g87d29937c9+57a68d035f,g8852436030+4699110379,g89139ef638+ed4b5058f4,g9125e01d80+fcb1d3bbc8,g94187f82dc+3bfb9058a5,g989de1cb63+ed4b5058f4,g9ccd5d7f00+b7cae620c0,g9d31334357+3bfb9058a5,g9f33ca652e+00883ace41,gabe3b4be73+1e0a283bba,gabf8522325+fa80ff7197,gb1101e3267+27b24065a3,gb58c049af0+f03b321e39,gb89ab40317+ed4b5058f4,gc0af124501+708fe67c54,gcf25f946ba+4699110379,gd6cbbdb0b4+bb83cc51f8,gde0f65d7ad+acd5afb0eb,ge1ad929117+3bfb9058a5,ge278dab8ac+d65b3c2b70,ge410e46f29+ed4b5058f4,gf5e32f922b+fcb1d3bbc8,gf67bdafdda+ed4b5058f4,w.2025.17
LSST Data Management Base Package
|
Public Member Functions | |
run (self, template, science, sources, visitSummary=None) | |
runPreconvolve (self, template, science, matchedScience, selectSources, preConvKernel) | |
computeImageMetrics (self, science, difference, stars) | |
runConvolveTemplate (self, template, science, selectSources) | |
runConvolveScience (self, template, science, selectSources) | |
finalize (self, template, science, difference, kernel, templateMatched=True, preConvMode=False, preConvKernel=None, spatiallyVarying=False) | |
updateMasks (self, template, science) | |
Public Attributes | |
convolutionControl = lsst.afw.math.ConvolutionControl() | |
templatePsfSize = getPsfFwhm(template.psf) | |
sciencePsfSize = getPsfFwhm(science.psf) | |
log = self.runConvolveScience(template, science, selectSources) | |
Static Public Attributes | |
ConfigClass = AlardLuptonSubtractConfig | |
Protected Member Functions | |
_applyExternalCalibrations (self, exposure, visitSummary) | |
_calculateMagLim (self, exposure, nsigma=5.0, fallbackPsfSize=None) | |
_convolveExposure (self, exposure, kernel, convolutionControl, bbox=None, psf=None, photoCalib=None, interpolateBadMaskPlanes=False) | |
_sourceSelector (self, sources, mask) | |
_prepareInputs (self, template, science, visitSummary=None) | |
_clearMask (self, mask, clearMaskPlanes=None) | |
Static Protected Member Functions | |
_validateExposures (template, science) | |
_checkMask (mask, sources, excludeMaskPlanes, checkAdjacent=True) | |
_renameMaskPlanes (mask, maskPlane, newMaskPlane) | |
Static Protected Attributes | |
str | _DefaultName = "alardLuptonSubtract" |
Subtract a template from a science image, convolving the science image before computing the kernel, and also convolving the template before subtraction.
Definition at line 1071 of file subtractImages.py.
|
protectedinherited |
Replace calibrations (psf, and ApCorrMap) on this exposure with external ones.". Parameters ---------- exposure : `lsst.afw.image.exposure.Exposure` Input exposure to adjust calibrations. visitSummary : `lsst.afw.table.ExposureCatalog` Exposure catalog with external calibrations to be applied. Catalog uses the detector id for the catalog id, sorted on id for fast lookup. Returns ------- exposure : `lsst.afw.image.exposure.Exposure` Exposure with adjusted calibrations.
Definition at line 290 of file subtractImages.py.
|
protectedinherited |
Calculate an exposure's limiting magnitude. This method uses the photometric zeropoint together with the PSF size from the average position of the exposure. Parameters ---------- exposure : `lsst.afw.image.Exposure` The target exposure to calculate the limiting magnitude for. nsigma : `float`, optional The detection threshold in sigma. fallbackPsfSize : `float`, optional PSF FWHM to use in the event the exposure PSF cannot be retrieved. Returns ------- maglim : `astropy.units.Quantity` The limiting magnitude of the exposure, or np.nan.
Definition at line 729 of file subtractImages.py.
|
staticprotectedinherited |
Exclude sources that are located on or adjacent to masked pixels. Parameters ---------- mask : `lsst.afw.image.Mask` The image mask plane to use to reject sources based on the location of their centroid on the ccd. sources : `lsst.afw.table.SourceCatalog` The source catalog to evaluate. excludeMaskPlanes : `list` of `str` List of the names of the mask planes to exclude. Returns ------- flags : `numpy.ndarray` of `bool` Array indicating whether each source in the catalog should be kept (True) or rejected (False) based on the value of the mask plane at its location.
Definition at line 898 of file subtractImages.py.
|
protectedinherited |
Clear the mask plane of an exposure. Parameters ---------- mask : `lsst.afw.image.Mask` The mask plane to erase, which will be modified in place. clearMaskPlanes : `list` of `str`, optional Erase the specified mask planes. If not supplied, the entire mask will be erased.
Definition at line 1043 of file subtractImages.py.
|
protectedinherited |
Convolve an exposure with the given kernel. Parameters ---------- exposure : `lsst.afw.Exposure` exposure to convolve. kernel : `lsst.afw.math.LinearCombinationKernel` PSF matching kernel computed in the ``makeKernel`` subtask. convolutionControl : `lsst.afw.math.ConvolutionControl` Configuration for convolve algorithm. bbox : `lsst.geom.Box2I`, optional Bounding box to trim the convolved exposure to. psf : `lsst.afw.detection.Psf`, optional Point spread function (PSF) to set for the convolved exposure. photoCalib : `lsst.afw.image.PhotoCalib`, optional Photometric calibration of the convolved exposure. Returns ------- convolvedExp : `lsst.afw.Exposure` The convolved image.
Definition at line 799 of file subtractImages.py.
|
protectedinherited |
Perform preparatory calculations common to all Alard&Lupton Tasks. Parameters ---------- template : `lsst.afw.image.ExposureF` Template exposure, warped to match the science exposure. The variance plane of the template image is modified in place. science : `lsst.afw.image.ExposureF` Science exposure to subtract from the template. The variance plane of the science image is modified in place. visitSummary : `lsst.afw.table.ExposureCatalog`, optional Exposure catalog with external calibrations to be applied. Catalog uses the detector id for the catalog id, sorted on id for fast lookup.
Definition at line 938 of file subtractImages.py.
|
staticprotectedinherited |
Rename a mask plane by adding the new name and copying the data. Parameters ---------- mask : `lsst.afw.image.Mask` The mask image to update in place. maskPlane : `str` The name of the existing mask plane to copy. newMaskPlane : `str` The new name of the mask plane that will be added. If the mask plane already exists, it will be updated in place.
Definition at line 1025 of file subtractImages.py.
|
protectedinherited |
Select sources from a catalog that meet the selection criteria. Parameters ---------- sources : `lsst.afw.table.SourceCatalog` Input source catalog to select sources from. mask : `lsst.afw.image.Mask` The image mask plane to use to reject sources based on their location on the ccd. Returns ------- selectSources : `lsst.afw.table.SourceCatalog` The input source catalog, with flagged and low signal-to-noise sources removed. Raises ------ RuntimeError If there are too few sources to compute the PSF matching kernel remaining after source selection.
Definition at line 844 of file subtractImages.py.
|
staticprotectedinherited |
Check that the WCS of the two Exposures match, the template bbox contains the science bbox, and that the bands match. Parameters ---------- template : `lsst.afw.image.ExposureF` Template exposure, warped to match the science exposure. science : `lsst.afw.image.ExposureF` Science exposure to subtract from the template. Raises ------ AssertionError Raised if the WCS of the template is not equal to the science WCS, if the science image is not fully contained in the template bounding box, or if the bands do not match.
Definition at line 770 of file subtractImages.py.
|
inherited |
Compute quality metrics (saved to the task metadata) on the difference image, at the locations of detected stars on the science image. This restricts the metric to locations that should be well-subtracted. Parameters ---------- science : `lsst.afw.image.ExposureF` Science exposure that was subtracted. difference : `lsst.afw.image.ExposureF` Result of subtracting template and science. stars : `lsst.afw.table.SourceCatalog` Good calibration sources detected on science image; these footprints are what the metrics are computed on. Notes ----- The task metadata does not include docstrings, so descriptions of the computed metrics are given here: differenceFootprintRatioMean Mean of the ratio of the absolute value of the difference image (with the mean absolute value of the sky regions on the difference image removed) to the science image, computed in the footprints of stars detected on the science image (the sums below are of the pixels in each star or sky footprint): :math:`\mathrm{mean}_{footprints}((\sum |difference| - \mathrm{mean}(\sum |difference_{sky}|)) / \sum science)` differenceFootprintRatioStdev Standard Deviation across footprints of the above ratio. differenceFootprintSkyRatioMean Mean of the ratio of the absolute value of sky source regions on the difference image to the science image (the sum below is of the pixels in each sky source footprint): :math:`\mathrm{mean}_{footprints}(\sum |difference_{sky}| / \sum science_{sky})` differenceFootprintSkyRatioStdev Standard Deivation across footprints of the above sky ratio.
Definition at line 471 of file subtractImages.py.
|
inherited |
Decorrelate the difference image to undo the noise correlations caused by convolution. Parameters ---------- template : `lsst.afw.image.ExposureF` Template exposure, warped to match the science exposure. science : `lsst.afw.image.ExposureF` Science exposure to subtract from the template. difference : `lsst.afw.image.ExposureF` Result of subtracting template and science. kernel : `lsst.afw.math.Kernel` An (optionally spatially-varying) PSF matching kernel templateMatched : `bool`, optional Was the template PSF-matched to the science image? preConvMode : `bool`, optional Was the science image preconvolved with its own PSF before PSF matching the template? preConvKernel : `lsst.afw.detection.Psf`, optional If not `None`, then the science image was pre-convolved with (the reflection of) this kernel. Must be normalized to sum to 1. spatiallyVarying : `bool`, optional Compute the decorrelation kernel spatially varying across the image? Returns ------- correctedExposure : `lsst.afw.image.ExposureF` The decorrelated image difference.
Definition at line 680 of file subtractImages.py.
lsst.ip.diffim.subtractImages.AlardLuptonPreconvolveSubtractTask.run | ( | self, | |
template, | |||
science, | |||
sources, | |||
visitSummary = None ) |
Preconvolve the science image with its own PSF, convolve the template image with a PSF-matching kernel and subtract from the preconvolved science image. Parameters ---------- template : `lsst.afw.image.ExposureF` The template image, which has previously been warped to the science image. The template bbox will be padded by a few pixels compared to the science bbox. science : `lsst.afw.image.ExposureF` The science exposure. sources : `lsst.afw.table.SourceCatalog` Identified sources on the science exposure. This catalog is used to select sources in order to perform the AL PSF matching on stamp images around them. visitSummary : `lsst.afw.table.ExposureCatalog`, optional Exposure catalog with complete external calibrations. Catalog uses the detector id for the catalog id, sorted on id for fast lookup. Returns ------- results : `lsst.pipe.base.Struct` ``scoreExposure`` : `lsst.afw.image.ExposureF` Result of subtracting the convolved template and science images. Attached PSF is that of the original science image. ``matchedTemplate`` : `lsst.afw.image.ExposureF` Warped and PSF-matched template exposure. Attached PSF is that of the original science image. ``matchedScience`` : `lsst.afw.image.ExposureF` The science exposure after convolving with its own PSF. Attached PSF is that of the original science image. ``backgroundModel`` : `lsst.afw.math.Function2D` Background model that was fit while solving for the PSF-matching kernel ``psfMatchingKernel`` : `lsst.afw.math.Kernel` Final kernel used to PSF-match the template to the science image.
Reimplemented from lsst.ip.diffim.subtractImages.AlardLuptonSubtractTask.
Definition at line 1079 of file subtractImages.py.
|
inherited |
Convolve the science image with a PSF-matching kernel and subtract the template image. Parameters ---------- template : `lsst.afw.image.ExposureF` Template exposure, warped to match the science exposure. science : `lsst.afw.image.ExposureF` Science exposure to subtract from the template. selectSources : `lsst.afw.table.SourceCatalog` Identified sources on the science exposure. This catalog is used to select sources in order to perform the AL PSF matching on stamp images around them. Returns ------- results : `lsst.pipe.base.Struct` ``difference`` : `lsst.afw.image.ExposureF` Result of subtracting template and science. ``matchedTemplate`` : `lsst.afw.image.ExposureF` Warped template exposure. Note that in this case, the template is not PSF-matched to the science image. ``backgroundModel`` : `lsst.afw.math.Function2D` Background model that was fit while solving for the PSF-matching kernel ``psfMatchingKernel`` : `lsst.afw.math.Kernel` Kernel used to PSF-match the science image to the template.
Definition at line 613 of file subtractImages.py.
|
inherited |
Convolve the template image with a PSF-matching kernel and subtract from the science image. Parameters ---------- template : `lsst.afw.image.ExposureF` Template exposure, warped to match the science exposure. science : `lsst.afw.image.ExposureF` Science exposure to subtract from the template. selectSources : `lsst.afw.table.SourceCatalog` Identified sources on the science exposure. This catalog is used to select sources in order to perform the AL PSF matching on stamp images around them. Returns ------- results : `lsst.pipe.base.Struct` ``difference`` : `lsst.afw.image.ExposureF` Result of subtracting template and science. ``matchedTemplate`` : `lsst.afw.image.ExposureF` Warped and PSF-matched template exposure. ``backgroundModel`` : `lsst.afw.math.Function2D` Background model that was fit while solving for the PSF-matching kernel ``psfMatchingKernel`` : `lsst.afw.math.Kernel` Kernel used to PSF-match the template to the science image.
Definition at line 541 of file subtractImages.py.
lsst.ip.diffim.subtractImages.AlardLuptonPreconvolveSubtractTask.runPreconvolve | ( | self, | |
template, | |||
science, | |||
matchedScience, | |||
selectSources, | |||
preConvKernel ) |
Convolve the science image with its own PSF, then convolve the template with a matching kernel and subtract to form the Score exposure. Parameters ---------- template : `lsst.afw.image.ExposureF` Template exposure, warped to match the science exposure. science : `lsst.afw.image.ExposureF` Science exposure to subtract from the template. matchedScience : `lsst.afw.image.ExposureF` The science exposure, convolved with the reflection of its own PSF. selectSources : `lsst.afw.table.SourceCatalog` Identified sources on the science exposure. This catalog is used to select sources in order to perform the AL PSF matching on stamp images around them. preConvKernel : `lsst.afw.math.Kernel` The reflection of the kernel that was used to preconvolve the `science` exposure. Must be normalized to sum to 1. Returns ------- results : `lsst.pipe.base.Struct` ``scoreExposure`` : `lsst.afw.image.ExposureF` Result of subtracting the convolved template and science images. Attached PSF is that of the original science image. ``matchedTemplate`` : `lsst.afw.image.ExposureF` Warped and PSF-matched template exposure. Attached PSF is that of the original science image. ``matchedScience`` : `lsst.afw.image.ExposureF` The science exposure after convolving with its own PSF. Attached PSF is that of the original science image. ``backgroundModel`` : `lsst.afw.math.Function2D` Background model that was fit while solving for the PSF-matching kernel ``psfMatchingKernel`` : `lsst.afw.math.Kernel` Final kernel used to PSF-match the template to the science image.
Definition at line 1143 of file subtractImages.py.
|
inherited |
Update the science and template mask planes before differencing. Parameters ---------- template : `lsst.afw.image.Exposure` Template exposure, warped to match the science exposure. The template mask planes will be erased, except for a few specified in the task config. science : `lsst.afw.image.Exposure` Science exposure to subtract from the template. The DETECTED and DETECTED_NEGATIVE mask planes of the science image will be erased.
Definition at line 980 of file subtractImages.py.
|
staticprotectedinherited |
Definition at line 274 of file subtractImages.py.
|
staticinherited |
Definition at line 273 of file subtractImages.py.
|
inherited |
Definition at line 284 of file subtractImages.py.
|
inherited |
Definition at line 460 of file subtractImages.py.
|
inherited |
Definition at line 392 of file subtractImages.py.
|
inherited |
Definition at line 391 of file subtractImages.py.