LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
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. | |
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)) | |
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. | |
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. | |
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. | |
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. | |
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. | |
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 <em>strayFluxOptions</em> includes <em>STRAYFLUX_TO_POINT_SOURCES_ALWAYS</em>, then point sources are always included in the 1/(1+r^2) splitting. Otherwise, if <em>STRAYFLUX_TO_POINT_SOURCES_WHEN_NECESSARY</em>, point sources are included only if there are no extended sources nearby. If any stray-flux portion is less than <em>clipStrayFluxFraction</em>, 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.