|
| clipFootprintToNonzeroImpl (foot, image) |
|
| _setPeakError (debResult, log, pk, cx, cy, filters, msg, flag) |
|
| fitPsfs (debResult, log, psfChisqCut1=1.5, psfChisqCut2=1.5, psfChisqCut2b=1.5, tinyFootprintSize=2) |
|
| _fitPsf (fp, fmask, pk, pkF, pkres, fbb, peaks, peaksF, log, psf, psffwhm, img, varimg, psfChisqCut1, psfChisqCut2, psfChisqCut2b, tinyFootprintSize=2) |
|
| buildSymmetricTemplates (debResult, log, patchEdges=False, setOrigTemplate=True) |
|
| rampFluxAtEdge (debResult, log, patchEdges=False) |
|
| _handle_flux_at_edge (log, psffwhm, t1, tfoot, fp, maskedImage, x0, x1, y0, y1, psf, pk, sigma1, patchEdges) |
|
| medianSmoothTemplates (debResult, log, medianFilterHalfsize=2) |
|
| makeTemplatesMonotonic (debResult, log) |
|
| clipFootprintsToNonzero (debResult, log) |
|
| weightTemplates (debResult, log) |
|
| _weightTemplates (dp) |
|
| reconstructTemplates (debResult, log, maxTempDotProd=0.5) |
|
| apportionFlux (debResult, log, assignStrayFlux=True, strayFluxAssignment='r-to-peak', strayFluxToPointSources='necessary', clipStrayFluxFraction=0.001, getTemplateSum=False) |
|
lsst.meas.deblender.plugins._handle_flux_at_edge |
( |
|
log, |
|
|
|
psffwhm, |
|
|
|
t1, |
|
|
|
tfoot, |
|
|
|
fp, |
|
|
|
maskedImage, |
|
|
|
x0, |
|
|
|
x1, |
|
|
|
y0, |
|
|
|
y1, |
|
|
|
psf, |
|
|
|
pk, |
|
|
|
sigma1, |
|
|
|
patchEdges |
|
) |
| |
|
protected |
Extend a template by the PSF to fill in the footprint.
Using the PSF, a footprint that touches the edge is passed to the
function and is grown by the psffwhm*1.5 and filled in with
ramped pixels.
Parameters
----------
log: `log.Log`
LSST logger for logging purposes.
psffwhm: `float`
PSF FWHM in pixels.
t1: `afw.image.ImageF`
The image template that contains the footprint to extend.
tfoot: `afw.detection.Footprint`
Symmetric Footprint to extend.
fp: `afw.detection.Footprint`
Parent Footprint that is being deblended.
maskedImage: `afw.image.MaskedImageF`
Full MaskedImage containing the parent footprint ``fp``.
x0,y0: `init`
Minimum x,y for the bounding box of the footprint ``fp``.
x1,y1: `int`
Maximum x,y for the bounding box of the footprint ``fp``.
psf: `afw.detection.Psf`
PSF of the image.
pk: `afw.detection.PeakRecord`
The peak within the Footprint whose footprint is being extended.
sigma1: `float`
Estimated noise level in the image.
patchEdges: `bool`
If ``patchEdges==True`` and if the footprint touches pixels with the
``EDGE`` bit set, then for spans whose symmetric mirror are outside
the image, the symmetric footprint is grown to include them and their
pixel values are stored.
Results
-------
t2: `afw.image.ImageF`
Image of the extended footprint.
tfoot2: `afw.detection.Footprint`
Extended Footprint.
patched: `bool`
If the footprint touches an edge pixel, ``patched`` will be set to
``True``. Otherwise ``patched`` is ``False``.
Definition at line 825 of file plugins.py.
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 1249 of file plugins.py.
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 707 of file plugins.py.
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.
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 955 of file plugins.py.
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 769 of file plugins.py.
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 1148 of file plugins.py.