LSST Applications
21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
|
Classes | |
class | DeblenderPlugin |
Functions | |
def | clipFootprintToNonzeroImpl (foot, image) |
def | fitPsfs (debResult, log, psfChisqCut1=1.5, psfChisqCut2=1.5, psfChisqCut2b=1.5, tinyFootprintSize=2) |
def | buildSymmetricTemplates (debResult, log, patchEdges=False, setOrigTemplate=True) |
def | rampFluxAtEdge (debResult, log, patchEdges=False) |
def | medianSmoothTemplates (debResult, log, medianFilterHalfsize=2) |
def | makeTemplatesMonotonic (debResult, log) |
def | clipFootprintsToNonzero (debResult, log) |
def | weightTemplates (debResult, log) |
def | reconstructTemplates (debResult, log, maxTempDotProd=0.5) |
def | apportionFlux (debResult, log, assignStrayFlux=True, strayFluxAssignment='r-to-peak', strayFluxToPointSources='necessary', clipStrayFluxFraction=0.001, getTemplateSum=False) |
def lsst.meas.deblender.plugins.apportionFlux | ( | debResult, | |
log, | |||
assignStrayFlux = True , |
|||
strayFluxAssignment = 'r-to-peak' , |
|||
strayFluxToPointSources = 'necessary' , |
|||
clipStrayFluxFraction = 0.001 , |
|||
getTemplateSum = False |
|||
) |
Apportion flux to all of the peak templates in each filter Divide the ``maskedImage`` flux amongst all of the templates based on the fraction of flux assigned to each ``template``. Leftover "stray flux" is assigned to peaks based on the other parameters. Parameters ---------- debResult: `lsst.meas.deblender.baseline.DeblenderResult` Container for the final deblender results. log: `log.Log` LSST logger for logging purposes. assignStrayFlux: `bool`, optional If True then flux in the parent footprint that is not covered by any of the template footprints is assigned to templates based on their 1/(1+r^2) distance. How the flux is apportioned is determined by ``strayFluxAssignment``. strayFluxAssignment: `string`, optional Determines how stray flux is apportioned. * ``trim``: Trim stray flux and do not include in any footprints * ``r-to-peak`` (default): Stray flux is assigned based on (1/(1+r^2) from the peaks * ``r-to-footprint``: Stray flux is distributed to the footprints based on 1/(1+r^2) of the minimum distance from the stray flux to footprint * ``nearest-footprint``: Stray flux is assigned to the footprint with lowest L-1 (Manhattan) distance to the stray flux strayFluxToPointSources: `string`, optional Determines how stray flux is apportioned to point sources * ``never``: never apportion stray flux to point sources * ``necessary`` (default): point sources are included only if there are no extended sources nearby * ``always``: point sources are always included in the 1/(1+r^2) splitting clipStrayFluxFraction: `float`, optional Minimum stray-flux portion. Any stray-flux portion less than ``clipStrayFluxFraction`` is clipped to zero. getTemplateSum: `bool`, optional As part of the flux calculation, the sum of the templates is calculated. If ``getTemplateSum==True`` then the sum of the templates is stored in the result (a `DeblendedFootprint`). Returns ------- modified: `bool` Apportion flux always modifies the templates, so ``modified`` is always ``True``. However, this should likely be the final step and it is unlikely that any deblender plugins will be re-run.
Definition at line 1250 of file plugins.py.
def lsst.meas.deblender.plugins.buildSymmetricTemplates | ( | debResult, | |
log, | |||
patchEdges = False , |
|||
setOrigTemplate = True |
|||
) |
Build a symmetric template for each peak in each filter Given ``maskedImageF``, ``footprint``, and a ``DebldendedPeak``, creates a symmetric template (``templateImage`` and ``templateFootprint``) around the peak for all peaks not flagged as ``skip`` or ``deblendedAsPsf``. Parameters ---------- debResult: `lsst.meas.deblender.baseline.DeblenderResult` Container for the final deblender results. log: `log.Log` LSST logger for logging purposes. patchEdges: `bool`, optional If True and if the parent Footprint touches pixels with the ``EDGE`` bit set, then grow the parent Footprint to include all symmetric templates. Returns ------- modified: `bool` If any peaks are not skipped or marked as point sources, ``modified`` is ``True. Otherwise ``modified`` is ``False``.
Definition at line 708 of file plugins.py.
def lsst.meas.deblender.plugins.clipFootprintsToNonzero | ( | debResult, | |
log | |||
) |
Clip non-zero spans in the template footprints for every peak in each filter. Peak ``Footprint``\ s are clipped to the region in the image containing non-zero values by dropping spans that are completely zero and moving endpoints to non-zero pixels (but does not split spans that have internal zeros). Parameters ---------- debResult: `lsst.meas.deblender.baseline.DeblenderResult` Container for the final deblender results. log: `log.Log` LSST logger for logging purposes. Returns ------- modified: `bool` Whether or not any templates were modified. This will be ``True`` as long as there is at least one source that is not flagged as a PSF.
Definition at line 1041 of file plugins.py.
def lsst.meas.deblender.plugins.clipFootprintToNonzeroImpl | ( | foot, | |
image | |||
) |
Clips the given *Footprint* to the region in the *Image* containing non-zero values. The clipping drops spans that are totally zero, and moves endpoints to non-zero; it does not split spans that have internal zeros.
Definition at line 38 of file plugins.py.
def lsst.meas.deblender.plugins.fitPsfs | ( | debResult, | |
log, | |||
psfChisqCut1 = 1.5 , |
|||
psfChisqCut2 = 1.5 , |
|||
psfChisqCut2b = 1.5 , |
|||
tinyFootprintSize = 2 |
|||
) |
Fit a PSF + smooth background model (linear) to a small region around each peak. This function will iterate over all filters in deblender result but does not compare results across filters. DeblendedPeaks that pass the cuts have their templates modified to the PSF + background model and their ``deblendedAsPsf`` property set to ``True``. This will likely be replaced in the future with a function that compares the psf chi-squared cuts so that peaks flagged as point sources will be considered point sources in all bands. Parameters ---------- debResult: `lsst.meas.deblender.baseline.DeblenderResult` Container for the final deblender results. log: `log.Log` LSST logger for logging purposes. psfChisqCut*: `float`, optional ``psfChisqCut1`` is the maximum chi-squared-per-degree-of-freedom allowed for a peak to be considered a PSF match without recentering. A fit is also made that includes terms to recenter the PSF. ``psfChisqCut2`` is the same as ``psfChisqCut1`` except it determines the restriction on the fit that includes recentering terms. If the peak is a match for a re-centered PSF, the PSF is repositioned at the new center and the peak footprint is fit again, this time to the new PSF. If the resulting chi-squared-per-degree-of-freedom is less than ``psfChisqCut2b`` then it passes the re-centering algorithm. If the peak passes both the re-centered and fixed position cuts, the better of the two is accepted, but parameters for all three psf fits are stored in the ``DebldendedPeak``. The default for ``psfChisqCut1``, ``psfChisqCut2``, and ``psfChisqCut2b`` is ``1.5``. tinyFootprintSize: `float`, optional The PSF model is shrunk to the size that contains the original footprint. If the bbox of the clipped PSF model for a peak is smaller than ``max(tinyFootprintSize,2)`` then ``tinyFootprint`` for the peak is set to ``True`` and the peak is not fit. The default is 2. Returns ------- modified: `bool` If any templates have been assigned to PSF point sources then ``modified`` is ``True``, otherwise it is ``False``.
Definition at line 164 of file plugins.py.
def lsst.meas.deblender.plugins.makeTemplatesMonotonic | ( | debResult, | |
log | |||
) |
Make the templates monotonic. The pixels in the templates are modified such that pixels further from the peak will have values smaller than those closer to the peak. Parameters ---------- debResult: `lsst.meas.deblender.baseline.DeblenderResult` Container for the final deblender results. log: `log.Log` LSST logger for logging purposes. Returns ------- modified: `bool` Whether or not any templates were modified. This will be ``True`` as long as there is at least one source that is not flagged as a PSF.
Definition at line 1005 of file plugins.py.
def lsst.meas.deblender.plugins.medianSmoothTemplates | ( | debResult, | |
log, | |||
medianFilterHalfsize = 2 |
|||
) |
Applying median smoothing filter to the template images for every peak in every filter. Parameters ---------- debResult: `lsst.meas.deblender.baseline.DeblenderResult` Container for the final deblender results. log: `log.Log` LSST logger for logging purposes. medianFilterHalfSize: `int`, optional Half the box size of the median filter, i.e. a ``medianFilterHalfSize`` of 50 means that each output pixel will be the median of the pixels in a 101 x 101-pixel box in the input image. This parameter is only used when ``medianSmoothTemplate==True``, otherwise it is ignored. Returns ------- modified: `bool` Whether or not any templates were modified. This will be ``True`` as long as there is at least one source that is not flagged as a PSF.
Definition at line 956 of file plugins.py.
def lsst.meas.deblender.plugins.rampFluxAtEdge | ( | debResult, | |
log, | |||
patchEdges = False |
|||
) |
Adjust flux on the edges of the template footprints. Using the PSF, a peak ``~afw.detection.Footprint`` with pixels on the edge of ``footprint`` is grown by the ``psffwhm*1.5`` and filled in with ramped pixels. The result is a new symmetric footprint template for the peaks near the edge. Parameters ---------- debResult: `lsst.meas.deblender.baseline.DeblenderResult` Container for the final deblender results. log: `log.Log` LSST logger for logging purposes. patchEdges: `bool`, optional If True and if the parent Footprint touches pixels with the ``EDGE`` bit set, then grow the parent Footprint to include all symmetric templates. Returns ------- modified: `bool` If any peaks have their templates modified to include flux at the edges, ``modified`` is ``True``.
Definition at line 770 of file plugins.py.
def lsst.meas.deblender.plugins.reconstructTemplates | ( | debResult, | |
log, | |||
maxTempDotProd = 0.5 |
|||
) |
Remove "degenerate templates" If galaxies have substructure, such as face-on spirals, the process of identifying peaks can "shred" the galaxy into many pieces. The templates of shredded galaxies are typically quite similar because they represent the same galaxy, so we try to identify these "degenerate" peaks by looking at the inner product (in pixel space) of pairs of templates. If they are nearly parallel, we only keep one of the peaks and reject the other. If only one of the peaks is a PSF template, the other template is used, otherwise the one with the maximum template value is kept. Parameters ---------- debResult: `lsst.meas.deblender.baseline.DeblenderResult` Container for the final deblender results. log: `log.Log` LSST logger for logging purposes. maxTempDotProd: `float`, optional All dot products between templates greater than ``maxTempDotProd`` will result in one of the templates removed. Returns ------- modified: `bool` If any degenerate templates are found, ``modified`` is ``True``.
Definition at line 1149 of file plugins.py.
def lsst.meas.deblender.plugins.weightTemplates | ( | debResult, | |
log | |||
) |
Weight the templates to best fit the observed image in each filter This function re-weights the templates so that their linear combination best represents the observed image in that filter. In the future it may be useful to simultaneously weight all of the filters together. Parameters ---------- debResult: `lsst.meas.deblender.baseline.DeblenderResult` Container for the final deblender results. log: `log.Log` LSST logger for logging purposes. Returns ------- modified: `bool` ``weightTemplates`` does not actually modify the ``Footprint`` templates other than to add a weight to them, so ``modified`` is always ``False``.
Definition at line 1077 of file plugins.py.