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
|
#include <BaselineUtils.h>
Public Types | |
typedef lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > | MaskedImageT |
typedef std::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > > | MaskedImagePtrT |
typedef lsst::afw::image::Image< ImagePixelT > | ImageT |
typedef std::shared_ptr< lsst::afw::image::Image< ImagePixelT > > | ImagePtrT |
typedef lsst::afw::image::Mask< MaskPixelT > | MaskT |
typedef std::shared_ptr< lsst::afw::image::Mask< MaskPixelT > > | MaskPtrT |
typedef lsst::afw::detection::Footprint | FootprintT |
typedef std::shared_ptr< lsst::afw::detection::Footprint > | FootprintPtrT |
typedef lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > | HeavyFootprintT |
typedef std::shared_ptr< lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > | HeavyFootprintPtrT |
Static Public Member Functions | |
static std::shared_ptr< lsst::afw::detection::Footprint > | symmetrizeFootprint (lsst::afw::detection::Footprint const &foot, int cx, int cy) |
Given a Footprint foot and peak cx,cy, returns a Footprint that is symmetric around the peak (with twofold rotational symmetry) – the AND of the two symmetric halves. More... | |
static std::pair< ImagePtrT, FootprintPtrT > | buildSymmetricTemplate (MaskedImageT const &img, lsst::afw::detection::Footprint const &foot, lsst::afw::detection::PeakRecord const &pk, double sigma1, bool minZero, bool patchEdges, bool *patchedEdges) |
Given an img, footprint foot, and peak, creates a symmetric template around the peak; produce a MaskedImage and Footprint describing a footprint where: output pixels (cx + dx, cy + dy) and (cx - dx, cy - dy) = min(input pixels (cx + dx, cy + dy) and (cx - dx, cy - dy)) More... | |
static void | medianFilter (ImageT const &img, ImageT &outimg, int halfsize) |
Run a spatial median filter over the given input img, writing the results to out. More... | |
static void | makeMonotonic (ImageT &img, lsst::afw::detection::PeakRecord const &pk) |
Given an image mimg and Peak location peak, overwrite mimg so that pixels further from the peak have values smaller than those close to the peak; make the profile monotonic-decreasing. More... | |
static std::vector< typename std::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > > > | apportionFlux (MaskedImageT const &img, lsst::afw::detection::Footprint const &foot, std::vector< typename std::shared_ptr< lsst::afw::image::Image< ImagePixelT >>> templates, std::vector< std::shared_ptr< lsst::afw::detection::Footprint > > templ_footprints, ImagePtrT templ_sum, std::vector< bool > const &ispsf, std::vector< int > const &pkx, std::vector< int > const &pky, std::vector< std::shared_ptr< typename lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > > &strays, int strayFluxOptions, double clipStrayFluxFraction) |
Splits flux in a given image img, within a given footprint foot, among a number of templates timgs,tfoots. More... | |
static bool | hasSignificantFluxAtEdge (ImagePtrT, std::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold) |
Returns true if the given Footprint sfoot in image img has flux above value thresh at its edge. More... | |
static std::shared_ptr< lsst::afw::detection::Footprint > | getSignificantEdgePixels (ImagePtrT, std::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold) |
Returns a list of pixels that are on the edge of the given Footprint sfoot* in image img, above threshold thresh. More... | |
static void | _sum_templates (std::vector< ImagePtrT > timgs, ImagePtrT tsum) |
static void | _find_stray_flux (lsst::afw::detection::Footprint const &foot, ImagePtrT tsum, MaskedImageT const &img, int strayFluxOptions, std::vector< std::shared_ptr< lsst::afw::detection::Footprint > > tfoots, std::vector< bool > const &ispsf, std::vector< int > const &pkx, std::vector< int > const &pky, double clipStrayFluxFraction, std::vector< std::shared_ptr< typename lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > > &strays) |
Static Public Attributes | |
static const int | ASSIGN_STRAYFLUX = 0x1 |
static const int | STRAYFLUX_TO_POINT_SOURCES_WHEN_NECESSARY = 0x2 |
static const int | STRAYFLUX_TO_POINT_SOURCES_ALWAYS = 0x4 |
static const int | STRAYFLUX_R_TO_FOOTPRINT = 0x8 |
static const int | STRAYFLUX_NEAREST_FOOTPRINT = 0x10 |
static const int | STRAYFLUX_TRIM = 0x20 |
Definition at line 22 of file BaselineUtils.h.
typedef std::shared_ptr<lsst::afw::detection::Footprint> lsst::meas::deblender::BaselineUtils< ImagePixelT, MaskPixelT, VariancePixelT >::FootprintPtrT |
Definition at line 33 of file BaselineUtils.h.
typedef lsst::afw::detection::Footprint lsst::meas::deblender::BaselineUtils< ImagePixelT, MaskPixelT, VariancePixelT >::FootprintT |
Definition at line 32 of file BaselineUtils.h.
typedef std::shared_ptr<lsst::afw::detection::HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT> > lsst::meas::deblender::BaselineUtils< ImagePixelT, MaskPixelT, VariancePixelT >::HeavyFootprintPtrT |
Definition at line 36 of file BaselineUtils.h.
typedef lsst::afw::detection::HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT> lsst::meas::deblender::BaselineUtils< ImagePixelT, MaskPixelT, VariancePixelT >::HeavyFootprintT |
Definition at line 34 of file BaselineUtils.h.
typedef std::shared_ptr<lsst::afw::image::Image<ImagePixelT> > lsst::meas::deblender::BaselineUtils< ImagePixelT, MaskPixelT, VariancePixelT >::ImagePtrT |
Definition at line 28 of file BaselineUtils.h.
typedef lsst::afw::image::Image<ImagePixelT> lsst::meas::deblender::BaselineUtils< ImagePixelT, MaskPixelT, VariancePixelT >::ImageT |
Definition at line 27 of file BaselineUtils.h.
typedef std::shared_ptr<lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT> > lsst::meas::deblender::BaselineUtils< ImagePixelT, MaskPixelT, VariancePixelT >::MaskedImagePtrT |
Definition at line 26 of file BaselineUtils.h.
typedef lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT> lsst::meas::deblender::BaselineUtils< ImagePixelT, MaskPixelT, VariancePixelT >::MaskedImageT |
Definition at line 25 of file BaselineUtils.h.
typedef std::shared_ptr<lsst::afw::image::Mask<MaskPixelT> > lsst::meas::deblender::BaselineUtils< ImagePixelT, MaskPixelT, VariancePixelT >::MaskPtrT |
Definition at line 30 of file BaselineUtils.h.
typedef lsst::afw::image::Mask<MaskPixelT> lsst::meas::deblender::BaselineUtils< ImagePixelT, MaskPixelT, VariancePixelT >::MaskT |
Definition at line 29 of file BaselineUtils.h.
|
static |
Hmm, this is a little bit dangerous: we're assuming that the HeavyFootprint stores its pixels in the same order that we iterate over them above (ie, lexicographic).
Definition at line 393 of file BaselineUtils.cc.
|
static |
Definition at line 609 of file BaselineUtils.cc.
|
static |
Splits flux in a given image img, within a given footprint foot, among a number of templates timgs,tfoots.
This is where actual "deblending" takes place.
timgs* and tfoots MUST be the same length.
Flux is assigned to templates according to their relative heights at each pixel.
If strayFluxOptions includes ASSIGN_STRAYFLUX, then "stray flux" – 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.
If strayFluxOptions includes STRAYFLUX_R_TO_FOOTPRINT, the stray flux is distributed to the footprints based on 1/(1+r^2) of the minimum distance from the stray flux to footprint.
If strayFluxOptions includes "STRAYFLUX_NEAREST_FOOTPRINT*, the stray flux is assigned to the footprint with lowest L-1 (Manhattan) distance to the stray flux.
Otherwise, stray flux is assigned based on (1/(1+r^2) from the peaks.
If strayFluxOptions includes STRAYFLUX_TO_POINT_SOURCES_ALWAYS, then point sources are always included in the 1/(1+r^2) splitting. Otherwise, if STRAYFLUX_TO_POINT_SOURCES_WHEN_NECESSARY, point sources are included only if there are no extended sources nearby.
If any stray-flux portion is less than clipStrayFluxFraction, it is clipped to zero.
When doing stray flux, the "strays" arg is used as an extra return value, the stray flux assigned to each template.
When doing stray flux, the ispsf, pkx, and pky arrays are required. They give the peak x,y coords plus whether the peak is believed (by the deblender) to be a point source. pkx and pky MUST be the same length as timgs. If ispsf has nonzero length, it MUST be the same length as timgs.
If tsum is given, is it set to the sum of max(0, template).
The return value is a vector of MaskedImages containing the flux assigned to each template.
Definition at line 692 of file BaselineUtils.cc.
|
static |
Given an img, footprint foot, and peak, creates a symmetric template around the peak; produce a MaskedImage and Footprint describing a footprint where: output pixels (cx + dx, cy + dy) and (cx - dx, cy - dy) = min(input pixels (cx + dx, cy + dy) and (cx - dx, cy - dy))
If patchEdge is 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.
Definition at line 1189 of file BaselineUtils.cc.
|
static |
Returns a list of pixels that are on the edge of the given Footprint sfoot* in image img, above threshold thresh.
Definition at line 1418 of file BaselineUtils.cc.
|
static |
Returns true if the given Footprint sfoot in image img has flux above value thresh at its edge.
Definition at line 1385 of file BaselineUtils.cc.
|
static |
Given an image mimg and Peak location peak, overwrite mimg so that pixels further from the peak have values smaller than those close to the peak; make the profile monotonic-decreasing.
The exact algorithm is a little more complicated than that. The basic idea is of "casting a shadow" from a pixel to pixels farther from the peak in the same direction. Done naively, this results in very narrow "shadows" and ragged profiles. A tweak is to make the shadows "fatter" – make a pixel shadow a wedge of pixels – but if one does this naively, the wedge gets wider and wider too quickly. The algorithm works out from the peak in square "rings" of pixels, so if a pixel shadows a wedge 30 degrees wide, in the next ring of pixels the shadowed pixel at largest angle from the shadowing pixel will shade a yet-larger wedge, expanding the shadowing angle. To reduce this effect, we work in chunks of 5 pixels in radius, only copying the intermediate pixels to the "shadowing" image at the end of each chunk.
Currently the mask and variance planes of the input are totally ignored.
For illustration, run tests/monotonic.py and look at im*.png
Definition at line 225 of file BaselineUtils.cc.
|
static |
Run a spatial median filter over the given input img, writing the results to out.
halfsize is half the box size of the filter; ie, a halfsize of 50 means that each output ixel will be the median of the pixels in a 101 x 101-pixel box in the input image.
Margins are handled horribly: the median is computed only for pixels more than halfsize away from the edges; pixels near the edges are simply copied from the input img to out.
Mask and variance planes are, likewise, simply copied from img to out*.
Definition at line 147 of file BaselineUtils.cc.
|
static |
Given a Footprint foot and peak cx,cy, returns a Footprint that is symmetric around the peak (with twofold rotational symmetry) – the AND of the two symmetric halves.
Definition at line 974 of file BaselineUtils.cc.
|
static |
Definition at line 62 of file BaselineUtils.h.
|
static |
Definition at line 68 of file BaselineUtils.h.
|
static |
Definition at line 67 of file BaselineUtils.h.
|
static |
Definition at line 64 of file BaselineUtils.h.
|
static |
Definition at line 63 of file BaselineUtils.h.
|
static |
Definition at line 69 of file BaselineUtils.h.