LSST Applications g063fba187b+cac8b7c890,g0f08755f38+6aee506743,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+b4475c5878,g1dcb35cd9c+8f9bc1652e,g20f6ffc8e0+6aee506743,g217e2c1bcf+73dee94bd0,g28da252d5a+1f19c529b9,g2bbee38e9b+3f2625acfc,g2bc492864f+3f2625acfc,g3156d2b45e+6e55a43351,g32e5bea42b+1bb94961c2,g347aa1857d+3f2625acfc,g35bb328faa+a8ce1bb630,g3a166c0a6a+3f2625acfc,g3e281a1b8c+c5dd892a6c,g3e8969e208+a8ce1bb630,g414038480c+5927e1bc1e,g41af890bb2+8a9e676b2a,g7af13505b9+809c143d88,g80478fca09+6ef8b1810f,g82479be7b0+f568feb641,g858d7b2824+6aee506743,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+2903d499ea,gb58c049af0+d64f4d3760,gc28159a63d+3f2625acfc,gcab2d0539d+b12535109e,gcf0d15dbbd+46a3f46ba9,gda6a2b7d83+46a3f46ba9,gdaeeff99f8+1711a396fd,ge79ae78c31+3f2625acfc,gef2f8181fd+0a71e47438,gf0baf85859+c1f95f4921,gfa517265be+6aee506743,gfa999e8aa5+17cd334064,w.2024.51
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.